summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--proto/rip/rip.c28
-rw-r--r--proto/rip/rip.h1
2 files changed, 24 insertions, 5 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index de45c20..fbe7fe1 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -8,7 +8,15 @@
FIXME: IpV6 support: packet size
FIXME: IpV6 support: use right address for broadcasts
FIXME: IpV6 support: receive "route using" blocks
- 1 FIXME
+ FIXME: Do we send "triggered updates" correctly?
+ FIXME: When route's metric changes to 16, start garbage collection immediately? Do _not_ restart on new updates with metric == 16.
+ FIXME: When route's 60 seconds old and we get same metric, use that!
+ FIXME: Triggered updates. When triggered update was sent, don't send new one for something between 1 and 5 seconds (and send one after that).
+
+ We are not going to honour requests for sending part of
+ routing table. That would need to turn split horizont off,
+ etc.
+
*/
#define LOCAL_DEBUG
@@ -392,12 +400,19 @@ rip_timer(timer *t)
rte = SKIP_BACK( struct rte, u.rip.garbage, e );
DBG( "Garbage: " ); rte_dump( rte );
- if (now - rte->lastmod > P_CF->garbage_time) {
+ if (now - rte->lastmod > P_CF->timeout_time) {
debug( "RIP: entry is too old: " ); rte_dump( rte );
+ e->metric = P_CF->infinity;
+ }
+
+ if (now - rte->lastmod > P_CF->garbage_time) {
+ debug( "RIP: entry is much too old: " ); rte_dump( rte );
rte_discard(p->table, rte);
}
}
+ /* FIXME: we need to do triggered updates */
+
DBG( "RIP: Broadcasting routing tables\n" );
{
struct rip_interface *rif;
@@ -662,15 +677,17 @@ 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)
{
+ if (ipa_equal(old->attrs->from, new->attrs->from))
+ return 1;
+
if (old->u.rip.metric < new->u.rip.metric)
return 0;
if (old->u.rip.metric > new->u.rip.metric)
return 1;
- /* FIXME */
-#define old_metric_is_much_older_than_new_metric 0
- if ((old->u.rip.metric == new->u.rip.metric) && (old_metric_is_much_older_than_new_metric))
+ if ((old->u.rip.metric == new->u.rip.metric) &&
+ ((now - old->lastmod) > 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;
return 0;
@@ -712,6 +729,7 @@ rip_init_config(struct rip_proto_config *c)
c->port = 520;
c->period = 30;
c->garbage_time = 120+180;
+ c->timeout_time = 120;
c->passwords = NULL;
c->authtype = AT_NONE;
}
diff --git a/proto/rip/rip.h b/proto/rip/rip.h
index 7bf225c..2f4d037 100644
--- a/proto/rip/rip.h
+++ b/proto/rip/rip.h
@@ -123,6 +123,7 @@ struct rip_proto_config {
int port;
int period;
int garbage_time;
+ int timeout_time;
struct password_item *passwords;
int authtype;