summaryrefslogtreecommitdiffstats
path: root/proto/rip/rip.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-03-29 10:58:06 +0200
committerPavel Machek <pavel@ucw.cz>2000-03-29 10:58:06 +0200
commit8d2e3eba92e339f0635e0cb2fbfb49482b26295a (patch)
tree5eb5eb7e6052cdbadf4a609cca05043941dde758 /proto/rip/rip.c
parent963ea03d872db30e1a0d0216e488b1960590af2d (diff)
downloadbird-8d2e3eba92e339f0635e0cb2fbfb49482b26295a.tar
bird-8d2e3eba92e339f0635e0cb2fbfb49482b26295a.zip
Cross-protocol issues solved better
Diffstat (limited to 'proto/rip/rip.c')
-rw-r--r--proto/rip/rip.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index f65a1f3..09bf5a2 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -704,15 +704,19 @@ rip_rt_notify(struct proto *p, struct network *net, struct rte *new, struct rte
e->nexthop = new->attrs->gw;
e->metric = 0;
e->whotoldme = IPA_NONE;
- if (new->attrs->proto == p) {
- e->tag = ea_find(attrs, EA_RIP_TAG)->u.data;
- e->metric = ea_find(attrs, EA_RIP_METRIC)->u.data;
- if (e->metric > P_CF->infinity)
- e->metric = P_CF->infinity;
+
+ e->tag = ea_find(attrs, EA_RIP_TAG)->u.data;
+ e->metric = ea_find(attrs, EA_RIP_METRIC)->u.data;
+ if (e->metric > P_CF->infinity)
+ e->metric = P_CF->infinity;
+
+ if (new->attrs->proto == p)
e->whotoldme = new->attrs->from;
- }
- if (!e->metric) /* FIXME: this is metric for external routes. Should it be configurable? */
+ if (!e->metric) /* This is metric for external routes. Notice
+ that I do honour it even if it comes from other protocol than this
+ rip. That's okay: this way user can set his own value for external
+ routes in rip. */
e->metric = 5;
e->updated = e->changed = now;
e->flags = 0;
@@ -722,6 +726,8 @@ rip_rt_notify(struct proto *p, struct network *net, struct rte *new, struct rte
static int
rip_rte_better(struct rte *new, struct rte *old)
{
+ struct proto *p = new->attrs->proto;
+
if (ipa_equal(old->attrs->from, new->attrs->from))
return 1;
@@ -731,14 +737,14 @@ rip_rte_better(struct rte *new, struct rte *old)
if (old->u.rip.metric > new->u.rip.metric)
return 1;
- if ((old->u.rip.metric != 16) && (new->u.rip.metric == 16)) { /* FIXME: check wrt. strange infinity values */
- struct proto *p = new->attrs->proto;
+ if ((old->u.rip.metric < 16) && (new->u.rip.metric == P_CF->infinity)) {
new->u.rip.lastmodX = now - P_CF->timeout_time; /* Check this: if new metric is 16, act as it was timed out */
}
- if ((old->u.rip.metric == new->u.rip.metric) &&
- ((now - old->u.rip.lastmodX) > 60)) /* FIXME (nonurgent): this probably should be P_CF->timeout_time / 2 if old->attrs->proto == new->attrs->proto, else don't do this check */
- return 1;
+ if (old->attrs->proto == new->attrs->proto) /* This does not make much sense for different protocols */
+ if ((old->u.rip.metric == new->u.rip.metric) &&
+ ((now - old->u.rip.lastmodX) > (P_CF->timeout_time / 2)))
+ return 1;
return 0;
}