diff options
Diffstat (limited to 'nest')
-rw-r--r-- | nest/route.h | 9 | ||||
-rw-r--r-- | nest/rt-table.c | 17 |
2 files changed, 19 insertions, 7 deletions
diff --git a/nest/route.h b/nest/route.h index c41ebf6..e954284 100644 --- a/nest/route.h +++ b/nest/route.h @@ -141,14 +141,15 @@ typedef struct rtable { bird_clock_t gc_time; /* Time of last GC */ byte gc_scheduled; /* GC is scheduled */ byte hcu_scheduled; /* Hostcache update is scheduled */ - byte nhu_state_unicast; /* Next Hop Update state */ - byte nhu_state_multicast; /* Next Hop Update state (multicast) */ - struct fib_iterator nhu_fit_unicast; /* Next Hop Update FIB iterator */ - struct fib_iterator nhu_fit_multicast; /* Next Hop Update FIB iterator (multicast) */ + byte nhu_state_unicast; /* Next Hop Update state */ + byte nhu_state_multicast; /* Next Hop Update state (multicast) */ + struct fib_iterator nhu_fit_unicast; /* Next Hop Update FIB iterator */ + struct fib_iterator nhu_fit_multicast;/* Next Hop Update FIB iterator (multicast) */ } rtable; typedef struct network { struct fib_node n; /* FIB flags reserved for kernel syncer */ + int cast; /* Unicast/Multicast flag */ struct rte *routes; /* Available routes for this network */ } net; diff --git a/nest/rt-table.c b/nest/rt-table.c index 1303843..2ebd114 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -78,11 +78,22 @@ net_route(rtable *tab, ip_addr a, int len, int cast) } static void -rte_init(struct fib_node *N) +rte_init_unicast(struct fib_node *N) { net *n = (net *) N; N->flags = 0; + n->cast = RTC_UNICAST; + n->routes = NULL; +} + +static void +rte_init_multicast(struct fib_node *N) +{ + net *n = (net *) N; + + N->flags = 0; + n->cast = RTC_MULTICAST; n->routes = NULL; } @@ -867,8 +878,8 @@ void rt_setup(pool *p, rtable *t, char *name, struct rtable_config *cf) { bzero(t, sizeof(*t)); - fib_init(&t->fib_unicast, p, sizeof(net), 0, rte_init); - fib_init(&t->fib_multicast, p, sizeof(net), 0, rte_init); + fib_init(&t->fib_unicast, p, sizeof(net), 0, rte_init_unicast); + fib_init(&t->fib_multicast, p, sizeof(net), 0, rte_init_multicast); t->name = name; t->config = cf; init_list(&t->hooks); |