aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-02-28 23:52:04 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-28 23:52:04 -0500
commit1937504dd156573a1883f10a5a167f3f78c6cb4a (patch)
tree9c1c61190885f8c32d9fcf826a6d2a541e8f540a /net/ipv4/route.c
parente5b13cb10de209f924fdf9478214bcf7e4008d6d (diff)
[NETNS]: Enable all routing manipulation via netlink inside namespace.
Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index b1a311eb18e5..8c3e165f0034 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2701,9 +2701,6 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2701 int err; 2701 int err;
2702 struct sk_buff *skb; 2702 struct sk_buff *skb;
2703 2703
2704 if (net != &init_net)
2705 return -EINVAL;
2706
2707 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy); 2704 err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv4_policy);
2708 if (err < 0) 2705 if (err < 0)
2709 goto errout; 2706 goto errout;
@@ -2733,7 +2730,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2733 if (iif) { 2730 if (iif) {
2734 struct net_device *dev; 2731 struct net_device *dev;
2735 2732
2736 dev = __dev_get_by_index(&init_net, iif); 2733 dev = __dev_get_by_index(net, iif);
2737 if (dev == NULL) { 2734 if (dev == NULL) {
2738 err = -ENODEV; 2735 err = -ENODEV;
2739 goto errout_free; 2736 goto errout_free;
@@ -2759,7 +2756,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2759 }, 2756 },
2760 .oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0, 2757 .oif = tb[RTA_OIF] ? nla_get_u32(tb[RTA_OIF]) : 0,
2761 }; 2758 };
2762 err = ip_route_output_key(&init_net, &rt, &fl); 2759 err = ip_route_output_key(net, &rt, &fl);
2763 } 2760 }
2764 2761
2765 if (err) 2762 if (err)
@@ -2770,11 +2767,11 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2770 rt->rt_flags |= RTCF_NOTIFY; 2767 rt->rt_flags |= RTCF_NOTIFY;
2771 2768
2772 err = rt_fill_info(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, 2769 err = rt_fill_info(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
2773 RTM_NEWROUTE, 0, 0); 2770 RTM_NEWROUTE, 0, 0);
2774 if (err <= 0) 2771 if (err <= 0)
2775 goto errout_free; 2772 goto errout_free;
2776 2773
2777 err = rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).pid); 2774 err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).pid);
2778errout: 2775errout:
2779 return err; 2776 return err;
2780 2777
@@ -2788,6 +2785,9 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
2788 struct rtable *rt; 2785 struct rtable *rt;
2789 int h, s_h; 2786 int h, s_h;
2790 int idx, s_idx; 2787 int idx, s_idx;
2788 struct net *net;
2789
2790 net = skb->sk->sk_net;
2791 2791
2792 s_h = cb->args[0]; 2792 s_h = cb->args[0];
2793 if (s_h < 0) 2793 if (s_h < 0)
@@ -2797,7 +2797,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
2797 rcu_read_lock_bh(); 2797 rcu_read_lock_bh();
2798 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; 2798 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
2799 rt = rcu_dereference(rt->u.dst.rt_next), idx++) { 2799 rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
2800 if (idx < s_idx) 2800 if (rt->u.dst.dev->nd_net != net || idx < s_idx)
2801 continue; 2801 continue;
2802 if (rt->rt_genid != atomic_read(&rt_genid)) 2802 if (rt->rt_genid != atomic_read(&rt_genid))
2803 continue; 2803 continue;