aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_semantics.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-01-10 06:26:13 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:01:29 -0500
commit4d1169c1e781e5853317c6b75620d678b2c4854e (patch)
tree69e7a7cf4c0f619d13eec7ff85ab1837f3abaf16 /net/ipv4/fib_semantics.c
parent6b175b26c1048d331508940ad3516ead1998084f (diff)
[NETNS]: Add netns to nl_info structure.
nl_info is used to track the end-user destination of routing change notification. This is a natural object to hold a namespace on. Place it there and utilize the context in the appropriate places. 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 'net/ipv4/fib_semantics.c')
-rw-r--r--net/ipv4/fib_semantics.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index c1263e23876b..0de6102020e2 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -320,11 +320,11 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
320 kfree_skb(skb); 320 kfree_skb(skb);
321 goto errout; 321 goto errout;
322 } 322 }
323 err = rtnl_notify(skb, &init_net, info->pid, RTNLGRP_IPV4_ROUTE, 323 err = rtnl_notify(skb, info->nl_net, info->pid, RTNLGRP_IPV4_ROUTE,
324 info->nlh, GFP_KERNEL); 324 info->nlh, GFP_KERNEL);
325errout: 325errout:
326 if (err < 0) 326 if (err < 0)
327 rtnl_set_sk_err(&init_net, RTNLGRP_IPV4_ROUTE, err); 327 rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err);
328} 328}
329 329
330/* Return the first fib alias matching TOS with 330/* Return the first fib alias matching TOS with
@@ -531,9 +531,11 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
531 531
532 if (cfg->fc_scope >= RT_SCOPE_LINK) 532 if (cfg->fc_scope >= RT_SCOPE_LINK)
533 return -EINVAL; 533 return -EINVAL;
534 if (inet_addr_type(&init_net, nh->nh_gw) != RTN_UNICAST) 534 if (inet_addr_type(cfg->fc_nlinfo.nl_net,
535 nh->nh_gw) != RTN_UNICAST)
535 return -EINVAL; 536 return -EINVAL;
536 if ((dev = __dev_get_by_index(&init_net, nh->nh_oif)) == NULL) 537 if ((dev = __dev_get_by_index(cfg->fc_nlinfo.nl_net,
538 nh->nh_oif)) == NULL)
537 return -ENODEV; 539 return -ENODEV;
538 if (!(dev->flags&IFF_UP)) 540 if (!(dev->flags&IFF_UP))
539 return -ENETDOWN; 541 return -ENETDOWN;
@@ -795,7 +797,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
795 if (nhs != 1 || nh->nh_gw) 797 if (nhs != 1 || nh->nh_gw)
796 goto err_inval; 798 goto err_inval;
797 nh->nh_scope = RT_SCOPE_NOWHERE; 799 nh->nh_scope = RT_SCOPE_NOWHERE;
798 nh->nh_dev = dev_get_by_index(&init_net, fi->fib_nh->nh_oif); 800 nh->nh_dev = dev_get_by_index(cfg->fc_nlinfo.nl_net,
801 fi->fib_nh->nh_oif);
799 err = -ENODEV; 802 err = -ENODEV;
800 if (nh->nh_dev == NULL) 803 if (nh->nh_dev == NULL)
801 goto failure; 804 goto failure;
@@ -809,7 +812,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
809 if (fi->fib_prefsrc) { 812 if (fi->fib_prefsrc) {
810 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst || 813 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
811 fi->fib_prefsrc != cfg->fc_dst) 814 fi->fib_prefsrc != cfg->fc_dst)
812 if (inet_addr_type(&init_net, fi->fib_prefsrc) != RTN_LOCAL) 815 if (inet_addr_type(cfg->fc_nlinfo.nl_net,
816 fi->fib_prefsrc) != RTN_LOCAL)
813 goto err_inval; 817 goto err_inval;
814 } 818 }
815 819