diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-08-05 02:20:06 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 17:53:39 -0400 |
commit | c71099acce933455123ee505cc75964610a209ad (patch) | |
tree | cf167c926350ff6c4040289dacce54849824c240 /include/net | |
parent | 5d0bbeeb144f631150881712607345c532e38e7e (diff) |
[IPV6]: Multiple Routing Tables
Adds the framework to support multiple IPv6 routing tables.
Currently all automatically generated routes are put into the
same table. This could be changed at a later point after
considering the produced locking overhead.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/ip6_fib.h | 39 | ||||
-rw-r--r-- | include/net/ip6_route.h | 3 |
2 files changed, 40 insertions, 2 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index a66e9de16a6c..818411519c89 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -51,6 +51,8 @@ struct rt6key | |||
51 | int plen; | 51 | int plen; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | struct fib6_table; | ||
55 | |||
54 | struct rt6_info | 56 | struct rt6_info |
55 | { | 57 | { |
56 | union { | 58 | union { |
@@ -71,6 +73,7 @@ struct rt6_info | |||
71 | u32 rt6i_flags; | 73 | u32 rt6i_flags; |
72 | u32 rt6i_metric; | 74 | u32 rt6i_metric; |
73 | atomic_t rt6i_ref; | 75 | atomic_t rt6i_ref; |
76 | struct fib6_table *rt6i_table; | ||
74 | 77 | ||
75 | struct rt6key rt6i_dst; | 78 | struct rt6key rt6i_dst; |
76 | struct rt6key rt6i_src; | 79 | struct rt6key rt6i_src; |
@@ -143,12 +146,43 @@ struct rt6_statistics { | |||
143 | 146 | ||
144 | typedef void (*f_pnode)(struct fib6_node *fn, void *); | 147 | typedef void (*f_pnode)(struct fib6_node *fn, void *); |
145 | 148 | ||
146 | extern struct fib6_node ip6_routing_table; | 149 | struct fib6_table { |
150 | struct hlist_node tb6_hlist; | ||
151 | u32 tb6_id; | ||
152 | rwlock_t tb6_lock; | ||
153 | struct fib6_node tb6_root; | ||
154 | }; | ||
155 | |||
156 | #define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC | ||
157 | #define RT6_TABLE_MAIN RT_TABLE_MAIN | ||
158 | #define RT6_TABLE_LOCAL RT6_TABLE_MAIN | ||
159 | #define RT6_TABLE_DFLT RT6_TABLE_MAIN | ||
160 | #define RT6_TABLE_INFO RT6_TABLE_MAIN | ||
161 | #define RT6_TABLE_PREFIX RT6_TABLE_MAIN | ||
162 | |||
163 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
164 | #define FIB6_TABLE_MIN 1 | ||
165 | #define FIB6_TABLE_MAX RT_TABLE_MAX | ||
166 | #else | ||
167 | #define FIB6_TABLE_MIN RT_TABLE_MAIN | ||
168 | #define FIB6_TABLE_MAX FIB6_TABLE_MIN | ||
169 | #endif | ||
170 | |||
171 | #define RT6_F_STRICT 1 | ||
172 | #define RT6_F_HAS_SADDR 2 | ||
173 | |||
174 | typedef struct rt6_info *(*pol_lookup_t)(struct fib6_table *, | ||
175 | struct flowi *, int); | ||
147 | 176 | ||
148 | /* | 177 | /* |
149 | * exported functions | 178 | * exported functions |
150 | */ | 179 | */ |
151 | 180 | ||
181 | extern struct fib6_table * fib6_get_table(u32 id); | ||
182 | extern struct fib6_table * fib6_new_table(u32 id); | ||
183 | extern struct dst_entry * fib6_rule_lookup(struct flowi *fl, int flags, | ||
184 | pol_lookup_t lookup); | ||
185 | |||
152 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, | 186 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, |
153 | struct in6_addr *daddr, | 187 | struct in6_addr *daddr, |
154 | struct in6_addr *saddr); | 188 | struct in6_addr *saddr); |
@@ -161,6 +195,9 @@ extern void fib6_clean_tree(struct fib6_node *root, | |||
161 | int (*func)(struct rt6_info *, void *arg), | 195 | int (*func)(struct rt6_info *, void *arg), |
162 | int prune, void *arg); | 196 | int prune, void *arg); |
163 | 197 | ||
198 | extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg), | ||
199 | int prune, void *arg); | ||
200 | |||
164 | extern int fib6_walk(struct fib6_walker_t *w); | 201 | extern int fib6_walk(struct fib6_walker_t *w); |
165 | extern int fib6_walk_continue(struct fib6_walker_t *w); | 202 | extern int fib6_walk_continue(struct fib6_walker_t *w); |
166 | 203 | ||
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 96b0e66406ec..d49c8c90eb68 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -58,7 +58,8 @@ extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); | |||
58 | extern int ip6_route_add(struct in6_rtmsg *rtmsg, | 58 | extern int ip6_route_add(struct in6_rtmsg *rtmsg, |
59 | struct nlmsghdr *, | 59 | struct nlmsghdr *, |
60 | void *rtattr, | 60 | void *rtattr, |
61 | struct netlink_skb_parms *req); | 61 | struct netlink_skb_parms *req, |
62 | u32 table_id); | ||
62 | extern int ip6_ins_rt(struct rt6_info *, | 63 | extern int ip6_ins_rt(struct rt6_info *, |
63 | struct nlmsghdr *, | 64 | struct nlmsghdr *, |
64 | void *rtattr, | 65 | void *rtattr, |