diff options
author | Denis V. Lunev <den@openvz.org> | 2008-01-21 20:31:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:10:19 -0500 |
commit | da0e28cb68a7e22b47c6ae1a5b12cb538c13c69f (patch) | |
tree | ac5bc308d4532f7cd271ee58c9bba5decf9699bd | |
parent | ba93ef746560df597b19bbcee04ce7ed70ebc700 (diff) |
[NETNS]: Add netns parameter to fib_lookup.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ip_fib.h | 9 | ||||
-rw-r--r-- | net/ipv4/fib_frontend.c | 4 | ||||
-rw-r--r-- | net/ipv4/fib_rules.c | 4 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 6 |
5 files changed, 13 insertions, 12 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index f580542f08ed..a85912434189 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -178,15 +178,16 @@ static inline struct fib_table *fib_new_table(struct net *net, u32 id) | |||
178 | return fib_get_table(net, id); | 178 | return fib_get_table(net, id); |
179 | } | 179 | } |
180 | 180 | ||
181 | static inline int fib_lookup(const struct flowi *flp, struct fib_result *res) | 181 | static inline int fib_lookup(struct net *net, const struct flowi *flp, |
182 | struct fib_result *res) | ||
182 | { | 183 | { |
183 | struct fib_table *table; | 184 | struct fib_table *table; |
184 | 185 | ||
185 | table = fib_get_table(&init_net, RT_TABLE_LOCAL); | 186 | table = fib_get_table(net, RT_TABLE_LOCAL); |
186 | if (!table->tb_lookup(table, flp, res)) | 187 | if (!table->tb_lookup(table, flp, res)) |
187 | return 0; | 188 | return 0; |
188 | 189 | ||
189 | table = fib_get_table(&init_net, RT_TABLE_MAIN); | 190 | table = fib_get_table(net, RT_TABLE_MAIN); |
190 | if (!table->tb_lookup(table, flp, res)) | 191 | if (!table->tb_lookup(table, flp, res)) |
191 | return 0; | 192 | return 0; |
192 | return -ENETUNREACH; | 193 | return -ENETUNREACH; |
@@ -208,7 +209,7 @@ extern void __net_exit fib4_rules_exit(struct net *net); | |||
208 | extern u32 fib_rules_tclass(struct fib_result *res); | 209 | extern u32 fib_rules_tclass(struct fib_result *res); |
209 | #endif | 210 | #endif |
210 | 211 | ||
211 | extern int fib_lookup(struct flowi *flp, struct fib_result *res); | 212 | extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res); |
212 | 213 | ||
213 | extern struct fib_table *fib_new_table(struct net *net, u32 id); | 214 | extern struct fib_table *fib_new_table(struct net *net, u32 id); |
214 | extern struct fib_table *fib_get_table(struct net *net, u32 id); | 215 | extern struct fib_table *fib_get_table(struct net *net, u32 id); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 8987046d97f3..e056154076b3 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -241,7 +241,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
241 | if (in_dev == NULL) | 241 | if (in_dev == NULL) |
242 | goto e_inval; | 242 | goto e_inval; |
243 | 243 | ||
244 | if (fib_lookup(&fl, &res)) | 244 | if (fib_lookup(&init_net, &fl, &res)) |
245 | goto last_resort; | 245 | goto last_resort; |
246 | if (res.type != RTN_UNICAST) | 246 | if (res.type != RTN_UNICAST) |
247 | goto e_inval_res; | 247 | goto e_inval_res; |
@@ -265,7 +265,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
265 | fl.oif = dev->ifindex; | 265 | fl.oif = dev->ifindex; |
266 | 266 | ||
267 | ret = 0; | 267 | ret = 0; |
268 | if (fib_lookup(&fl, &res) == 0) { | 268 | if (fib_lookup(&init_net, &fl, &res) == 0) { |
269 | if (res.type == RTN_UNICAST) { | 269 | if (res.type == RTN_UNICAST) { |
270 | *spec_dst = FIB_RES_PREFSRC(res); | 270 | *spec_dst = FIB_RES_PREFSRC(res); |
271 | ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; | 271 | ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index d2001f1c28a2..1effb4ab688c 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -54,14 +54,14 @@ u32 fib_rules_tclass(struct fib_result *res) | |||
54 | } | 54 | } |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | int fib_lookup(struct flowi *flp, struct fib_result *res) | 57 | int fib_lookup(struct net *net, struct flowi *flp, struct fib_result *res) |
58 | { | 58 | { |
59 | struct fib_lookup_arg arg = { | 59 | struct fib_lookup_arg arg = { |
60 | .result = res, | 60 | .result = res, |
61 | }; | 61 | }; |
62 | int err; | 62 | int err; |
63 | 63 | ||
64 | err = fib_rules_lookup(init_net.ipv4.rules_ops, flp, 0, &arg); | 64 | err = fib_rules_lookup(net->ipv4.rules_ops, flp, 0, &arg); |
65 | res->r = arg.rule; | 65 | res->r = arg.rule; |
66 | 66 | ||
67 | return err; | 67 | return err; |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 0e08df4d6f9a..ecd91c60975f 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -559,7 +559,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, | |||
559 | /* It is not necessary, but requires a bit of thinking */ | 559 | /* It is not necessary, but requires a bit of thinking */ |
560 | if (fl.fl4_scope < RT_SCOPE_LINK) | 560 | if (fl.fl4_scope < RT_SCOPE_LINK) |
561 | fl.fl4_scope = RT_SCOPE_LINK; | 561 | fl.fl4_scope = RT_SCOPE_LINK; |
562 | if ((err = fib_lookup(&fl, &res)) != 0) | 562 | if ((err = fib_lookup(&init_net, &fl, &res)) != 0) |
563 | return err; | 563 | return err; |
564 | } | 564 | } |
565 | err = -EINVAL; | 565 | err = -EINVAL; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index f80c761ea0bb..a7651c64bb48 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1559,7 +1559,7 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt) | |||
1559 | 1559 | ||
1560 | if (rt->fl.iif == 0) | 1560 | if (rt->fl.iif == 0) |
1561 | src = rt->rt_src; | 1561 | src = rt->rt_src; |
1562 | else if (fib_lookup(&rt->fl, &res) == 0) { | 1562 | else if (fib_lookup(&init_net, &rt->fl, &res) == 0) { |
1563 | src = FIB_RES_PREFSRC(res); | 1563 | src = FIB_RES_PREFSRC(res); |
1564 | fib_res_put(&res); | 1564 | fib_res_put(&res); |
1565 | } else | 1565 | } else |
@@ -1911,7 +1911,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1911 | /* | 1911 | /* |
1912 | * Now we are ready to route packet. | 1912 | * Now we are ready to route packet. |
1913 | */ | 1913 | */ |
1914 | if ((err = fib_lookup(&fl, &res)) != 0) { | 1914 | if ((err = fib_lookup(&init_net, &fl, &res)) != 0) { |
1915 | if (!IN_DEV_FORWARD(in_dev)) | 1915 | if (!IN_DEV_FORWARD(in_dev)) |
1916 | goto e_hostunreach; | 1916 | goto e_hostunreach; |
1917 | goto no_route; | 1917 | goto no_route; |
@@ -2363,7 +2363,7 @@ static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp) | |||
2363 | goto make_route; | 2363 | goto make_route; |
2364 | } | 2364 | } |
2365 | 2365 | ||
2366 | if (fib_lookup(&fl, &res)) { | 2366 | if (fib_lookup(&init_net, &fl, &res)) { |
2367 | res.fi = NULL; | 2367 | res.fi = NULL; |
2368 | if (oldflp->oif) { | 2368 | if (oldflp->oif) { |
2369 | /* Apparently, routing tables are wrong. Assume, | 2369 | /* Apparently, routing tables are wrong. Assume, |