Browse Source

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.
ajs 15 years ago
parent
commit
35a60c2d3c
4 changed files with 11 additions and 56 deletions
  1. 9 0
      ripd/ChangeLog
  2. 0 53
      ripd/rip_interface.c
  3. 2 2
      ripd/ripd.c
  4. 0 1
      ripd/ripd.h

+ 9 - 0
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

+ 0 - 53
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)

+ 2 - 2
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));

+ 0 - 1
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 *);