diff options
author | Martin Mares <mj@ucw.cz> | 1999-04-03 15:05:18 +0200 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-04-03 15:05:18 +0200 |
commit | c10421d3d4b5f23dc953c887332bdb6e80ae0540 (patch) | |
tree | 17ea979a4796bfccbf9e58bb50fc6f501e0390be /nest | |
parent | 69ec9087ad3fb631f46275220909a876deadb6b5 (diff) | |
download | bird-c10421d3d4b5f23dc953c887332bdb6e80ae0540.tar bird-c10421d3d4b5f23dc953c887332bdb6e80ae0540.zip |
More changes to the kernel syncer.
o Now compatible with filtering.
o Learning of kernel routes supported only on CONFIG_SELF_CONSCIOUS
systems (on the others it's impossible to get it semantically correct).
o Learning now stores all of its routes in a separate fib and selects
the ones the kernel really uses for forwarding packets.
o Better treatment of CONFIG_AUTO_ROUTES ports.
o Lots of internal changes.
Diffstat (limited to 'nest')
-rw-r--r-- | nest/route.h | 14 | ||||
-rw-r--r-- | nest/rt-table.c | 14 |
2 files changed, 15 insertions, 13 deletions
diff --git a/nest/route.h b/nest/route.h index 0de5455..5fcae2b 100644 --- a/nest/route.h +++ b/nest/route.h @@ -140,18 +140,20 @@ typedef struct rte { struct { } bgp; #endif - struct { /* Routes internally generated by krt sync */ - int src; /* Alleged route source (see krt.h) */ - } krt_sync; + struct { /* Routes generated by krt sync (both temporary and inherited ones) */ + s8 src; /* Alleged route source (see krt.h) */ + u8 proto; /* Kernel source protocol ID */ + u8 type; /* Kernel route type */ + u8 seen; /* Seen during last scan */ + u32 metric; /* Kernel metric */ + } krt; } u; } rte; -#define REF_CHOSEN 1 /* Currently chosen route */ - extern rtable master_table; void rt_init(void); -void rt_setup(rtable *, char *); +void rt_setup(pool *, rtable *, char *); net *net_find(rtable *tab, unsigned tos, ip_addr addr, unsigned len); net *net_get(rtable *tab, unsigned tos, ip_addr addr, unsigned len); rte *rte_find(net *net, struct proto *p); diff --git a/nest/rt-table.c b/nest/rt-table.c index e84937a..8a5c593 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -38,10 +38,10 @@ rte_init(struct fib_node *N) } void -rt_setup(rtable *t, char *name) +rt_setup(pool *p, rtable *t, char *name) { bzero(t, sizeof(*t)); - fib_init(&t->fib, &root_pool, sizeof(rte), 0, rte_init); + fib_init(&t->fib, p, sizeof(rte), 0, rte_init); t->name = name; } @@ -67,7 +67,7 @@ net_get(rtable *tab, unsigned tos, ip_addr mask, unsigned len) while (tab->sibling) tab = tab->sibling; t = mb_alloc(&root_pool, sizeof(rtable)); - rt_setup(t, NULL); + rt_setup(&root_pool, t, NULL); /* FIXME: Either delete all the TOS logic or use the right pool */ tab->sibling = t; t->tos = tos; } @@ -305,10 +305,10 @@ rte_dump(rte *e) debug("%1I/%2d ", n->n.prefix, n->n.pxlen); else debug("??? "); - debug("PF=%02x pref=%d lm=%d ", e->pflags, e->pref, now-e->lastmod); + debug("KF=%02x PF=%02x pref=%d lm=%d ", n->n.flags, e->pflags, e->pref, now-e->lastmod); rta_dump(e->attrs); - if (e->flags & REF_CHOSEN) - debug(" [*]"); + if (e->attrs->proto->proto->dump_attrs) + e->attrs->proto->proto->dump_attrs(e); debug("\n"); } @@ -357,7 +357,7 @@ rt_init(void) { rta_init(); rt_table_pool = rp_new(&root_pool, "Routing tables"); - rt_setup(&master_table, "master"); + rt_setup(rt_table_pool, &master_table, "master"); rte_slab = sl_new(rt_table_pool, sizeof(rte)); rt_last_gc = now; rt_gc_event = ev_new(rt_table_pool); |