From 8795d6838c61ccc316b74b7e07cc1946cf387e30 Mon Sep 17 00:00:00 2001 From: Michele Marchetto Date: Fri, 3 Nov 2006 15:21:26 +0000 Subject: if the nexthop is not reachable through outgoing interface set it to INADDR_ANY. Spotted out by Martin Boehme. OK claudio@ henning@ --- usr.sbin/ripd/message.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'usr.sbin') 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 @@ -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)); -- cgit v1.2.3