aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip6_fib.h
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-08-05 02:20:06 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:53:39 -0400
commitc71099acce933455123ee505cc75964610a209ad (patch)
treecf167c926350ff6c4040289dacce54849824c240 /include/net/ip6_fib.h
parent5d0bbeeb144f631150881712607345c532e38e7e (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/ip6_fib.h')
-rw-r--r--include/net/ip6_fib.h39
1 files changed, 38 insertions, 1 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
54struct fib6_table;
55
54struct rt6_info 56struct 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
144typedef void (*f_pnode)(struct fib6_node *fn, void *); 147typedef void (*f_pnode)(struct fib6_node *fn, void *);
145 148
146extern struct fib6_node ip6_routing_table; 149struct 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
174typedef 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
181extern struct fib6_table * fib6_get_table(u32 id);
182extern struct fib6_table * fib6_new_table(u32 id);
183extern struct dst_entry * fib6_rule_lookup(struct flowi *fl, int flags,
184 pol_lookup_t lookup);
185
152extern struct fib6_node *fib6_lookup(struct fib6_node *root, 186extern 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
198extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg),
199 int prune, void *arg);
200
164extern int fib6_walk(struct fib6_walker_t *w); 201extern int fib6_walk(struct fib6_walker_t *w);
165extern int fib6_walk_continue(struct fib6_walker_t *w); 202extern int fib6_walk_continue(struct fib6_walker_t *w);
166 203