aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-31 21:49:32 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-31 22:28:40 -0500
commit7462bd744e8882f9ebb9220d46fd4fec8b35b082 (patch)
tree25c5ba54034199e6a8e3d123c5e8e79f88f7c394
parent85326fa54b5516d8859617cc5fdfce8ae19c1480 (diff)
[NETNS]: Add a namespace mark to fib_info.
This is required to make fib_info lookups namespace aware. In the other case initial namespace devices are marked as dead in the local routing table during other namespace stop. 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.h1
-rw-r--r--net/ipv4/fib_semantics.c8
2 files changed, 5 insertions, 4 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 1b2f008db97..cb0df37950b 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -69,6 +69,7 @@ struct fib_nh {
69struct fib_info { 69struct fib_info {
70 struct hlist_node fib_hash; 70 struct hlist_node fib_hash;
71 struct hlist_node fib_lhash; 71 struct hlist_node fib_lhash;
72 struct net *fib_net;
72 int fib_treeref; 73 int fib_treeref;
73 atomic_t fib_clntref; 74 atomic_t fib_clntref;
74 int fib_dead; 75 int fib_dead;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 5beff2e0275..97cc4941268 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -687,6 +687,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
687 struct fib_info *fi = NULL; 687 struct fib_info *fi = NULL;
688 struct fib_info *ofi; 688 struct fib_info *ofi;
689 int nhs = 1; 689 int nhs = 1;
690 struct net *net = cfg->fc_nlinfo.nl_net;
690 691
691 /* Fast check to catch the most weird cases */ 692 /* Fast check to catch the most weird cases */
692 if (fib_props[cfg->fc_type].scope > cfg->fc_scope) 693 if (fib_props[cfg->fc_type].scope > cfg->fc_scope)
@@ -727,6 +728,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
727 goto failure; 728 goto failure;
728 fib_info_cnt++; 729 fib_info_cnt++;
729 730
731 fi->fib_net = net;
730 fi->fib_protocol = cfg->fc_protocol; 732 fi->fib_protocol = cfg->fc_protocol;
731 fi->fib_flags = cfg->fc_flags; 733 fi->fib_flags = cfg->fc_flags;
732 fi->fib_priority = cfg->fc_priority; 734 fi->fib_priority = cfg->fc_priority;
@@ -798,8 +800,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
798 if (nhs != 1 || nh->nh_gw) 800 if (nhs != 1 || nh->nh_gw)
799 goto err_inval; 801 goto err_inval;
800 nh->nh_scope = RT_SCOPE_NOWHERE; 802 nh->nh_scope = RT_SCOPE_NOWHERE;
801 nh->nh_dev = dev_get_by_index(cfg->fc_nlinfo.nl_net, 803 nh->nh_dev = dev_get_by_index(net, fi->fib_nh->nh_oif);
802 fi->fib_nh->nh_oif);
803 err = -ENODEV; 804 err = -ENODEV;
804 if (nh->nh_dev == NULL) 805 if (nh->nh_dev == NULL)
805 goto failure; 806 goto failure;
@@ -813,8 +814,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
813 if (fi->fib_prefsrc) { 814 if (fi->fib_prefsrc) {
814 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst || 815 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
815 fi->fib_prefsrc != cfg->fc_dst) 816 fi->fib_prefsrc != cfg->fc_dst)
816 if (inet_addr_type(cfg->fc_nlinfo.nl_net, 817 if (inet_addr_type(net, fi->fib_prefsrc) != RTN_LOCAL)
817 fi->fib_prefsrc) != RTN_LOCAL)
818 goto err_inval; 818 goto err_inval;
819 } 819 }
820 820