aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-31 21:50:07 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-31 22:28:41 -0500
commit4814bdbd590e835ecec2d5e505165ec1c19796b2 (patch)
treeb53996e694125012b202ea35a46fdf3cb39ae1df
parent7462bd744e8882f9ebb9220d46fd4fec8b35b082 (diff)
[NETNS]: Lookup in FIB semantic hashes taking into account the namespace.
The namespace is not available in the fib_sync_down_addr, add it as a parameter. Looking up a device by the pointer to it is OK. Looking up using a result from fib_trie/fib_hash table lookup is also safe. No need to fix that at all. So, just fix lookup by address and insertion to the hash table path. 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.h2
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/fib_semantics.c6
3 files changed, 7 insertions, 3 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index cb0df37950b7..90d1175f63de 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -220,7 +220,7 @@ extern void fib_select_default(struct net *net, const struct flowi *flp,
220/* Exported by fib_semantics.c */ 220/* Exported by fib_semantics.c */
221extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 221extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
222extern int fib_sync_down_dev(struct net_device *dev, int force); 222extern int fib_sync_down_dev(struct net_device *dev, int force);
223extern int fib_sync_down_addr(__be32 local); 223extern int fib_sync_down_addr(struct net *net, __be32 local);
224extern int fib_sync_up(struct net_device *dev); 224extern int fib_sync_up(struct net_device *dev);
225extern __be32 __fib_res_prefsrc(struct fib_result *res); 225extern __be32 __fib_res_prefsrc(struct fib_result *res);
226extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 226extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index d69ffa2a2e98..86ff2711fc95 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -808,7 +808,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
808 First of all, we scan fib_info list searching 808 First of all, we scan fib_info list searching
809 for stray nexthop entries, then ignite fib_flush. 809 for stray nexthop entries, then ignite fib_flush.
810 */ 810 */
811 if (fib_sync_down_addr(ifa->ifa_local)) 811 if (fib_sync_down_addr(dev->nd_net, ifa->ifa_local))
812 fib_flush(dev->nd_net); 812 fib_flush(dev->nd_net);
813 } 813 }
814 } 814 }
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 97cc49412684..a13c84763d4c 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -229,6 +229,8 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi)
229 head = &fib_info_hash[hash]; 229 head = &fib_info_hash[hash];
230 230
231 hlist_for_each_entry(fi, node, head, fib_hash) { 231 hlist_for_each_entry(fi, node, head, fib_hash) {
232 if (fi->fib_net != nfi->fib_net)
233 continue;
232 if (fi->fib_nhs != nfi->fib_nhs) 234 if (fi->fib_nhs != nfi->fib_nhs)
233 continue; 235 continue;
234 if (nfi->fib_protocol == fi->fib_protocol && 236 if (nfi->fib_protocol == fi->fib_protocol &&
@@ -1031,7 +1033,7 @@ nla_put_failure:
1031 referring to it. 1033 referring to it.
1032 - device went down -> we must shutdown all nexthops going via it. 1034 - device went down -> we must shutdown all nexthops going via it.
1033 */ 1035 */
1034int fib_sync_down_addr(__be32 local) 1036int fib_sync_down_addr(struct net *net, __be32 local)
1035{ 1037{
1036 int ret = 0; 1038 int ret = 0;
1037 unsigned int hash = fib_laddr_hashfn(local); 1039 unsigned int hash = fib_laddr_hashfn(local);
@@ -1043,6 +1045,8 @@ int fib_sync_down_addr(__be32 local)
1043 return 0; 1045 return 0;
1044 1046
1045 hlist_for_each_entry(fi, node, head, fib_lhash) { 1047 hlist_for_each_entry(fi, node, head, fib_lhash) {
1048 if (fi->fib_net != net)
1049 continue;
1046 if (fi->fib_prefsrc == local) { 1050 if (fi->fib_prefsrc == local) {
1047 fi->fib_flags |= RTNH_F_DEAD; 1051 fi->fib_flags |= RTNH_F_DEAD;
1048 ret++; 1052 ret++;