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.
diff --git a/ripd/ChangeLog b/ripd/ChangeLog
index e9f7e07..a3c0e24 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 17b25ff..0bc5a31 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -388,59 +388,6 @@
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 2e2b284..ec7bd19 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -1131,8 +1131,8 @@
/* 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 cc4aef6..4d0c04e 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -391,7 +391,6 @@
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 *);