aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 1b2f008db978..cb0df37950b7 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 5beff2e02751..97cc49412684 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