Fix timing and fix endianity in metrics.

This commit is contained in:
Pavel Machek 1999-12-08 12:51:45 +00:00
parent 2e18b87dcf
commit 4d4de35f00
2 changed files with 6 additions and 4 deletions

View file

@ -20,6 +20,9 @@
after that), says RFC. We do something else: once in 5 second after that), says RFC. We do something else: once in 5 second
we look for any changed routes and broadcast them. we look for any changed routes and broadcast them.
FIXME: (nonurgent) allow bigger frequencies than 1 regular update in 6 seconds (?)
FIXME: propagation of metric=infinity into main routing table may or may not be good idea.
*/ */
#define LOCAL_DEBUG #define LOCAL_DEBUG
@ -102,7 +105,7 @@ rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_e
b->metric = htonl( e->metric ); b->metric = htonl( e->metric );
if (ipa_equal(e->whotoldme, daddr)) { /* FIXME: ouch, daddr is some kind of broadcast address. How am I expected to do split horizont?!?!? */ if (ipa_equal(e->whotoldme, daddr)) { /* FIXME: ouch, daddr is some kind of broadcast address. How am I expected to do split horizont?!?!? */
DBG( "(split horizont)" ); DBG( "(split horizont)" );
b->metric = P_CF->infinity; b->metric = htonl( P_CF->infinity );
} }
ipa_hton( b->network ); ipa_hton( b->network );
} }
@ -471,7 +474,7 @@ rip_start(struct proto *p)
P->timer = tm_new( p->pool ); P->timer = tm_new( p->pool );
P->timer->data = p; P->timer->data = p;
P->timer->randomize = 5; P->timer->randomize = 5;
P->timer->recurrent = P_CF->period; P->timer->recurrent = (P_CF->period / 6)+1;
P->timer->hook = rip_timer; P->timer->hook = rip_timer;
tm_start( P->timer, 5 ); tm_start( P->timer, 5 );
rif = new_iface(p, NULL, 0, NULL); /* Initialize dummy interface */ rif = new_iface(p, NULL, 0, NULL); /* Initialize dummy interface */
@ -712,7 +715,7 @@ rip_rte_better(struct rte *new, struct rte *old)
if (old->u.rip.metric > new->u.rip.metric) if (old->u.rip.metric > new->u.rip.metric)
return 1; return 1;
if ((old->u.rip.metric != 16) && (new->u.rip.metric == 16)) { if ((old->u.rip.metric != 16) && (new->u.rip.metric == 16)) { /* FIXME: check wrt. strange infinity values */
struct proto *p = new->attrs->proto; struct proto *p = new->attrs->proto;
new->u.rip.lastmodX = now - P_CF->timeout_time; /* Check this: if new metric is 16, act as it was timed out */ new->u.rip.lastmodX = now - P_CF->timeout_time; /* Check this: if new metric is 16, act as it was timed out */
} }

View file

@ -109,7 +109,6 @@ struct rip_patt {
int metric; int metric;
int mode; int mode;
#define IM_MULTICAST 1
#define IM_BROADCAST 2 #define IM_BROADCAST 2
#define IM_QUIET 4 #define IM_QUIET 4
#define IM_NOLISTEN 8 #define IM_NOLISTEN 8