From 35a60c2d3c217e3b835821a7f6ea458e2eff44cf Mon Sep 17 00:00:00 2001
From: ajs <ajs>
Date: Sun, 30 Oct 2005 23:51:32 +0000
Subject: 2005-10-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* ripd.c: (rip_response_process) Instead of calling
	  rip_interface.c:if_valid_neighbor(), call the equivalent
	  library function if_lookup_address().
	* rip_interface.c: (if_valid_neighbor) Remove function, since it is
	  essentially equivalent to the if_lookup_address() library function.
	* ripd.h: (if_valid_neighbor) Remove function declaration.
---
 ripd/ChangeLog       |  9 +++++++++
 ripd/rip_interface.c | 53 ----------------------------------------------------
 ripd/ripd.c          |  4 ++--
 ripd/ripd.h          |  1 -
 4 files changed, 11 insertions(+), 56 deletions(-)

(limited to 'ripd')

diff --git a/ripd/ChangeLog b/ripd/ChangeLog
index e9f7e07c..a3c0e24b 100644
--- a/ripd/ChangeLog
+++ b/ripd/ChangeLog
@@ -1,3 +1,12 @@
+2005-10-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+	* ripd.c: (rip_response_process) Instead of calling
+	  rip_interface.c:if_valid_neighbor(), call the equivalent
+	  library function if_lookup_address().
+	* rip_interface.c: (if_valid_neighbor) Remove function, since it is
+	  essentially equivalent to the if_lookup_address() library function.
+	* ripd.h: (if_valid_neighbor) Remove function declaration.
+
 2005-10-28 Paul Jakma <paul.jakma@sun.com>
 
 	* Makefile.am: Add rip_interface.h, or else it doesn't get
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 17b25ff8..0bc5a311 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -388,59 +388,6 @@ if_check_address (struct in_addr addr)
   return 0;
 }
 
-/* is this address from a valid neighbor? (RFC2453 - Sec. 3.9.2) */
-int
-if_valid_neighbor (struct in_addr addr)
-{
-  struct listnode *node;
-  struct connected *connected = NULL;
-  struct interface *ifp;
-  struct prefix_ipv4 *p;
-  struct prefix_ipv4 pa;
-
-  pa.family = AF_INET;
-  pa.prefix = addr;
-  pa.prefixlen = IPV4_MAX_PREFIXLEN;
-
-  for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
-    {
-      struct listnode *cnode;
-
-      for (ALL_LIST_ELEMENTS_RO (ifp->connected, cnode, connected))
-	{
-	  if (if_is_pointopoint (ifp))
-	    {
-	      p = (struct prefix_ipv4 *) connected->address;
-
-	      if (p && p->family == AF_INET)
-		{
-		  if (IPV4_ADDR_SAME (&p->prefix, &addr))
-		    return 1;
-
-		  p = (struct prefix_ipv4 *) connected->destination;
-		  if (p)
-		    {
-		      if (IPV4_ADDR_SAME (&p->prefix, &addr))
-			return 1;
-		    }
-		  else
-		    {
-		      if (prefix_match(connected->address,(struct prefix *)&pa))
-			return 1;
-		    }
-		}
-	    }
-	  else
-	    {
-	      if ((connected->address->family == AF_INET) &&
-		  prefix_match(connected->address,(struct prefix *)&pa))
-		return 1;
-	    }
-	}
-    }
-  return 0;
-}
-
 /* Inteface link down message processing. */
 int
 rip_interface_down (int command, struct zclient *zclient, zebra_size_t length)
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 2e2b2849..ec7bd199 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1131,8 +1131,8 @@ rip_response_process (struct rip_packet *packet, int size,
 
   /* The datagram's IPv4 source address should be checked to see
      whether the datagram is from a valid neighbor; the source of the
-     datagram must be on a directly connected network  */
-  if (! if_valid_neighbor (from->sin_addr)) 
+     datagram must be on a directly connected network (RFC2453 - Sec. 3.9.2) */
+  if (if_lookup_address(from->sin_addr) == NULL) 
     {
       zlog_info ("This datagram doesn't came from a valid neighbor: %s",
 		 inet_ntoa (from->sin_addr));
diff --git a/ripd/ripd.h b/ripd/ripd.h
index cc4aef67..4d0c04e2 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -391,7 +391,6 @@ extern void rip_zclient_start (void);
 extern void rip_zclient_reset (void);
 extern void rip_offset_init (void);
 extern int if_check_address (struct in_addr addr);
-extern int if_valid_neighbor (struct in_addr addr);
 
 extern int rip_request_send (struct sockaddr_in *, struct interface *, u_char,
                       struct connected *);
-- 
cgit v1.2.1