From 2ef9177a47e7137dd09b06a353a6e5f6e671c951 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 14 Nov 2010 05:49:56 +0100 Subject: Add multicast support to static protocol and generic route handling. --- nest/route.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'nest/route.h') diff --git a/nest/route.h b/nest/route.h index a849bf0..0634ab7 100644 --- a/nest/route.h +++ b/nest/route.h @@ -124,7 +124,8 @@ struct rtable_config { typedef struct rtable { node n; /* Node in list of all tables */ - struct fib fib; + struct fib fib_unicast; + struct fib fib_multicast; char *name; /* Name of this table */ list hooks; /* List of announcement hooks */ int pipe_busy; /* Pipe loop detection */ @@ -140,8 +141,10 @@ 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; /* Next Hop Update state */ - struct fib_iterator nhu_fit; /* Next Hop Update FIB iterator */ + 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 { @@ -225,8 +228,6 @@ void rt_commit(struct config *new, struct config *old); void rt_lock_table(rtable *); void rt_unlock_table(rtable *); void rt_setup(pool *, rtable *, char *, struct rtable_config *); -static inline net *net_find(rtable *tab, ip_addr addr, unsigned len) { return (net *) fib_find(&tab->fib, &addr, len); } -static inline net *net_get(rtable *tab, ip_addr addr, unsigned len) { return (net *) fib_get(&tab->fib, &addr, len); } rte *rte_find(net *net, struct proto *p); rte *rte_get_temp(struct rta *); void rte_update(rtable *tab, net *net, struct proto *p, struct proto *src, rte *new); @@ -245,6 +246,7 @@ struct rtable_config *rt_new_table(struct symbol *s); struct rt_show_data { ip_addr prefix; unsigned pxlen; + int cast; rtable *table; struct filter *filter; int verbose; @@ -316,6 +318,13 @@ typedef struct rta { #define IGP_METRIC_UNKNOWN 0x80000000 /* Default igp_metric used when no other protocol-specific metric is availabe */ +static inline struct fib *rt_fib(rtable *tab, int cast) { return (cast == RTC_MULTICAST) ? &tab->fib_multicast : &tab->fib_unicast; } +static inline net *net_find2(rtable *tab, ip_addr addr, unsigned len, int cast) { return (net *) fib_find(rt_fib(tab, cast), &addr, len); } +static inline net *net_find(rtable *tab, ip_addr addr, unsigned len) { return net_find2(tab, addr, len, RTC_UNICAST); } +static inline net *net_get2(rtable *tab, ip_addr addr, unsigned len, int cast) { return (net *) fib_get(rt_fib(tab, cast), &addr, len); } +static inline net *net_get(rtable *tab, ip_addr addr, unsigned len) { return net_get2(tab, addr, len, RTC_UNICAST); } + + /* * Extended Route Attributes */ -- cgit v1.2.3