summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2006-11-03 15:21:26 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2006-11-03 15:21:26 +0000
commit8795d6838c61ccc316b74b7e07cc1946cf387e30 (patch)
tree5cf17999c52abe3762183339762d74dbbef0edf1 /usr.sbin
parent665ad9cf6533bef71fd740a80c04bc1f5dfe2e60 (diff)
if the nexthop is not reachable through outgoing interface set it to
INADDR_ANY. Spotted out by Martin Boehme. OK claudio@ henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ripd/message.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/ripd/message.c b/usr.sbin/ripd/message.c
index 7d86d174de8..fc1f69b8207 100644
--- a/usr.sbin/ripd/message.c
+++ b/usr.sbin/ripd/message.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: message.c,v 1.3 2006/10/31 23:43:11 michele Exp $ */
+/* $OpenBSD: message.c,v 1.4 2006/11/03 15:21:25 michele Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -251,7 +251,7 @@ send_response(struct packet_head *r_list, struct iface *i, struct nbr *nbr)
}
while ((entry = TAILQ_FIRST(r_list)) != NULL &&
- nentries < 25) {
+ nentries < MAX_RIP_ENTRIES) {
address = entry->rr->address.s_addr;
netmask = entry->rr->mask.s_addr;
nexthop = entry->rr->nexthop.s_addr;
@@ -264,6 +264,12 @@ send_response(struct packet_head *r_list, struct iface *i, struct nbr *nbr)
metric = htonl(INFINITY);
}
+ /* If the nexthop is not reachable through the
+ * outgoing interface set it to INADDR_ANY */
+ if ((nexthop & iface->mask.s_addr) !=
+ (iface->addr.s_addr & iface->mask.s_addr))
+ nexthop = INADDR_ANY;
+
buf_add(buf, &afi, sizeof(afi));
buf_add(buf, &route_tag, sizeof(route_tag));
buf_add(buf, &address, sizeof(address));