diff options
author | Pavel Machek <pavel@ucw.cz> | 2000-05-10 12:23:06 +0000 |
---|---|---|
committer | Pavel Machek <pavel@ucw.cz> | 2000-05-10 12:23:06 +0000 |
commit | 14758d87c48e9d829f58ace0736b0c5b3c7dc6ae (patch) | |
tree | 2a217146a421fe2d457babd3f64e508efcb12fae /proto/rip/rip.c | |
parent | 353f3261385267fd07b634284989a760fc37b79d (diff) |
Only announce change to main routing table if it is better than current.
Diffstat (limited to 'proto/rip/rip.c')
-rw-r--r-- | proto/rip/rip.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 39b38a66..52dce5d7 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -235,6 +235,16 @@ find_interface(struct proto *p, struct iface *what) * Input processing */ +static void +rip_rte_update_if_better(rtable *tab, net *net, struct proto *p, rte *new) +{ + rte *old; + + old = rte_find(net, p); + if (!old || rip_rte_better(new, old)) + rte_update(tab, net, p, new); +} + /* Let main routing table know about our new entry */ static void advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme ) @@ -292,7 +302,7 @@ advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme ) r->u.rip.tag = ntohl(b->tag); r->net = n; r->pflags = 0; /* Here go my flags */ - rte_update( p->table, n, p, r ); + rip_rte_update_if_better( p->table, n, p, r ); DBG( "done\n" ); } |