aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-10 06:24:11 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:01:27 -0500
commit8ad4942cd5bdad4143f7aa1d1bd4f7b2526c19c5 (patch)
tree9fc1c79ae579e20063d577912ad4aeb1aef3ba6d /include/net
parent93456b6d7753def8760b423ac6b986eb9d5a4a95 (diff)
[NETNS]: Add netns parameter to fib_get_table/fib_new_table.
This patch extends the fib_get_table and the fib_new_table functions with the network namespace pointer. That will allow to access the table relatively from the network namespace. Acked-by: Benjamin Thery <benjamin.thery@bull.net> Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip_fib.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 249af662e897..dfb95d732aa5 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -165,7 +165,7 @@ struct fib_table {
165#define TABLE_LOCAL_INDEX 0 165#define TABLE_LOCAL_INDEX 0
166#define TABLE_MAIN_INDEX 1 166#define TABLE_MAIN_INDEX 1
167 167
168static inline struct fib_table *fib_get_table(u32 id) 168static inline struct fib_table *fib_get_table(struct net *net, u32 id)
169{ 169{
170 struct hlist_head *ptr; 170 struct hlist_head *ptr;
171 171
@@ -175,20 +175,20 @@ static inline struct fib_table *fib_get_table(u32 id)
175 return hlist_entry(ptr->first, struct fib_table, tb_hlist); 175 return hlist_entry(ptr->first, struct fib_table, tb_hlist);
176} 176}
177 177
178static inline struct fib_table *fib_new_table(u32 id) 178static inline struct fib_table *fib_new_table(struct net *net, u32 id)
179{ 179{
180 return fib_get_table(id); 180 return fib_get_table(net, id);
181} 181}
182 182
183static inline int fib_lookup(const struct flowi *flp, struct fib_result *res) 183static inline int fib_lookup(const struct flowi *flp, struct fib_result *res)
184{ 184{
185 struct fib_table *table; 185 struct fib_table *table;
186 186
187 table = fib_get_table(RT_TABLE_LOCAL); 187 table = fib_get_table(&init_net, RT_TABLE_LOCAL);
188 if (!table->tb_lookup(table, flp, res)) 188 if (!table->tb_lookup(table, flp, res))
189 return 0; 189 return 0;
190 190
191 table = fib_get_table(RT_TABLE_MAIN); 191 table = fib_get_table(&init_net, RT_TABLE_MAIN);
192 if (!table->tb_lookup(table, flp, res)) 192 if (!table->tb_lookup(table, flp, res))
193 return 0; 193 return 0;
194 return -ENETUNREACH; 194 return -ENETUNREACH;
@@ -197,7 +197,7 @@ static inline int fib_lookup(const struct flowi *flp, struct fib_result *res)
197static inline void fib_select_default(const struct flowi *flp, 197static inline void fib_select_default(const struct flowi *flp,
198 struct fib_result *res) 198 struct fib_result *res)
199{ 199{
200 struct fib_table *table = fib_get_table(RT_TABLE_MAIN); 200 struct fib_table *table = fib_get_table(&init_net, RT_TABLE_MAIN);
201 if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) 201 if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK)
202 table->tb_select_default(table, flp, res); 202 table->tb_select_default(table, flp, res);
203} 203}
@@ -212,8 +212,8 @@ extern u32 fib_rules_tclass(struct fib_result *res);
212 212
213extern int fib_lookup(struct flowi *flp, struct fib_result *res); 213extern int fib_lookup(struct flowi *flp, struct fib_result *res);
214 214
215extern struct fib_table *fib_new_table(u32 id); 215extern struct fib_table *fib_new_table(struct net *net, u32 id);
216extern struct fib_table *fib_get_table(u32 id); 216extern struct fib_table *fib_get_table(struct net *net, u32 id);
217extern void fib_select_default(const struct flowi *flp, struct fib_result *res); 217extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
218 218
219#endif /* CONFIG_IP_MULTIPLE_TABLES */ 219#endif /* CONFIG_IP_MULTIPLE_TABLES */