diff options
author | melifaro <melifaro@FreeBSD.org> | 2016-01-25 06:33:15 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2016-01-25 06:33:15 +0000 |
commit | 23582454c7061201dc41b9ab4083ccbefd5dd88c (patch) | |
tree | e3d1ff0a530bc18a45f34e089f84583c63d778c7 /sys/net/route.h | |
parent | 23ee6b6bf28dd68ee75ec7a21424cd765fb32fb4 (diff) | |
download | FreeBSD-src-23582454c7061201dc41b9ab4083ccbefd5dd88c.zip FreeBSD-src-23582454c7061201dc41b9ab4083ccbefd5dd88c.tar.gz |
MFP r287070,r287073: split radix implementation and route table structure.
There are number of radix consumers in kernel land (pf,ipfw,nfs,route)
with different requirements. In fact, first 3 don't have _any_ requirements
and first 2 does not use radix locking. On the other hand, routing
structure do have these requirements (rnh_gen, multipath, custom
to-be-added control plane functions, different locking).
Additionally, radix should not known anything about its consumers internals.
So, radix code now uses tiny 'struct radix_head' structure along with
internal 'struct radix_mask_head' instead of 'struct radix_node_head'.
Existing consumers still uses the same 'struct radix_node_head' with
slight modifications: they need to pass pointer to (embedded)
'struct radix_head' to all radix callbacks.
Routing code now uses new 'struct rib_head' with different locking macro:
RADIX_NODE_HEAD prefix was renamed to RIB_ (which stands for routing
information base).
New net/route_var.h header was added to hold routing subsystem internal
data. 'struct rib_head' was placed there. 'struct rtentry' will also
be moved there soon.
Diffstat (limited to 'sys/net/route.h')
-rw-r--r-- | sys/net/route.h | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/sys/net/route.h b/sys/net/route.h index ed21a29..6cc1e1c 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -204,21 +204,6 @@ struct rtentry { /* Control plane route request flags */ #define NHR_COPY 0x100 /* Copy rte data */ -/* rte<>nhop translation */ -static inline uint16_t -fib_rte_to_nh_flags(int rt_flags) -{ - uint16_t res; - - res = (rt_flags & RTF_REJECT) ? NHF_REJECT : 0; - res |= (rt_flags & RTF_BLACKHOLE) ? NHF_BLACKHOLE : 0; - res |= (rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) ? NHF_REDIRECT : 0; - res |= (rt_flags & RTF_BROADCAST) ? NHF_BROADCAST : 0; - res |= (rt_flags & RTF_GATEWAY) ? NHF_GATEWAY : 0; - - return (res); -} - #ifdef _KERNEL /* rte<>ro_flags translation */ static inline void @@ -413,9 +398,8 @@ struct rt_addrinfo { } \ } while (0) -struct radix_node_head *rt_tables_get_rnh(int, int); - struct ifmultiaddr; +struct rib_head; void rt_ieee80211msg(struct ifnet *, int, void *, size_t); void rt_ifannouncemsg(struct ifnet *, int); @@ -429,6 +413,8 @@ int rt_routemsg(int, struct ifnet *ifp, int, struct rtentry *, int); void rt_newmaddrmsg(int, struct ifmultiaddr *); int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); +struct rib_head *rt_table_init(int); +void rt_table_destroy(struct rib_head *); int rtsock_addrmsg(int, struct ifaddr *, int); int rtsock_routemsg(int, struct ifnet *ifp, int, struct rtentry *, int); @@ -447,7 +433,7 @@ void rtfree(struct rtentry *); void rt_updatemtu(struct ifnet *); typedef int rt_walktree_f_t(struct rtentry *, void *); -typedef void rt_setwarg_t(struct radix_node_head *, uint32_t, int, void *); +typedef void rt_setwarg_t(struct rib_head *, uint32_t, int, void *); void rt_foreach_fib_walk(int af, rt_setwarg_t *, rt_walktree_f_t *, void *); void rt_foreach_fib_walk_del(int af, rt_filter_f_t *filter_f, void *arg); void rt_flushifroutes(struct ifnet *ifp); |