SCCS-vsn: sbin/routed/input.c 5.13
-static char sccsid[] = "@(#)input.c 5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)input.c 5.13 (Berkeley) %G%";
else
rt = 0;
n->rip_metric = rt == 0 ? HOPCNT_INFINITY :
else
rt = 0;
n->rip_metric = rt == 0 ? HOPCNT_INFINITY :
- min(rt->rt_metric+1, HOPCNT_INFINITY);
+ min(rt->rt_metric + 1, HOPCNT_INFINITY);
if (msg->rip_vers > 0) {
n->rip_dst.sa_family =
htons(n->rip_dst.sa_family);
if (msg->rip_vers > 0) {
n->rip_dst.sa_family =
htons(n->rip_dst.sa_family);
ntohs(n->rip_dst.sa_family);
n->rip_metric = ntohl(n->rip_metric);
}
ntohs(n->rip_dst.sa_family);
n->rip_metric = ntohl(n->rip_metric);
}
- if ((unsigned) n->rip_metric > HOPCNT_INFINITY)
- continue;
if (n->rip_dst.sa_family >= af_max ||
(afp = &afswitch[n->rip_dst.sa_family])->af_hash ==
(int (*)())0) {
if (n->rip_dst.sa_family >= af_max ||
(afp = &afswitch[n->rip_dst.sa_family])->af_hash ==
(int (*)())0) {
/*
* Adjust metric according to incoming interface.
*/
/*
* Adjust metric according to incoming interface.
*/
- if ((unsigned)n->rip_metric < HOPCNT_INFINITY)
+ if ((unsigned) n->rip_metric < HOPCNT_INFINITY)
n->rip_metric += ifp->int_metric;
n->rip_metric += ifp->int_metric;
+ if ((unsigned) n->rip_metric > HOPCNT_INFINITY)
+ n->rip_metric = HOPCNT_INFINITY;
rt = rtlookup(&n->rip_dst);
if (rt == 0 ||
(rt->rt_state & (RTS_INTERNAL|RTS_INTERFACE)) ==
rt = rtlookup(&n->rip_dst);
if (rt == 0 ||
(rt->rt_state & (RTS_INTERNAL|RTS_INTERFACE)) ==
GARBAGE_TIME - EXPIRE_TIME;
} else if (rt->rt_metric < HOPCNT_INFINITY)
rt->rt_timer = 0;
GARBAGE_TIME - EXPIRE_TIME;
} else if (rt->rt_metric < HOPCNT_INFINITY)
rt->rt_timer = 0;
- } else if ((unsigned) (n->rip_metric) < rt->rt_metric ||
+ } else if ((unsigned) n->rip_metric < rt->rt_metric ||
(rt->rt_timer > (EXPIRE_TIME/2) &&
rt->rt_metric == n->rip_metric &&
(rt->rt_timer > (EXPIRE_TIME/2) &&
rt->rt_metric == n->rip_metric &&
- n->rip_metric < HOPCNT_INFINITY)) {
+ (unsigned) n->rip_metric < HOPCNT_INFINITY)) {
rtchange(rt, from, n->rip_metric);
rt->rt_timer = 0;
}
rtchange(rt, from, n->rip_metric);
rt->rt_timer = 0;
}