summaryrefslogtreecommitdiff
path: root/proto/rip
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-06-01 12:59:50 +0000
committerMartin Mares <mj@ucw.cz>2000-06-01 12:59:50 +0000
commit491cd43b777e46a301ae2a8f5400acaeb28b8ca5 (patch)
tree1dccd01906b4c20f3e19f9495083137dab72a94f /proto/rip
parent4a91150175268d49a1c17131838e5afad925788b (diff)
Updated RIP to new neighbor cache semantics. When presented with next hop
equal to a local address, just ignore the route (as it is usually just an external route exported by us echoed by some RIP peer), when given an invalid next hop, moan to the log.
Diffstat (limited to 'proto/rip')
-rw-r--r--proto/rip/rip.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index e6411246..91a21198 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -282,15 +282,17 @@ advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme )
log( L_REMOTE "%s: %I asked me to route %I/%d using not-neighbor %I.", p->name, A.from, b->network, pxlen, A.gw );
return;
}
+ if (neighbor->scope == SCOPE_HOST) {
+ DBG("Self-destined route, ignoring.\n");
+ return;
+ }
A.iface = neighbor->iface;
if (!(rif = neighbor->data)) {
rif = neighbor->data = find_interface(p, A.iface);
}
- if (!rif) {
+ if (!rif)
bug("Route packet using unknown interface? No.");
- return;
- }
/* set to: interface of nexthop */
a = rta_lookup(&A);
@@ -338,6 +340,7 @@ rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr
{
int i;
int native_class = 0, authenticated = 0;
+ neighbor *neighbor;
switch( packet->heading.version ) {
case RIP_V1: DBG( "Rip1: " ); break;
@@ -360,7 +363,7 @@ rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr
return 1;
}
- if (!neigh_find( p, &whotoldme, 0 )) {
+ if (!(neighbor = neigh_find( p, &whotoldme, 0 )) || neighbor->scope == SCOPE_HOST) {
log( L_REMOTE "%s: %I send me routing info but he is not my neighbor", P_NAME, whotoldme );
return 0;
}