[NETNS]: Pass namespace through ip_rt_ioctl.
authorDenis V. Lunev <den@openvz.org>
Thu, 10 Jan 2008 11:29:53 +0000 (03:29 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:01:34 +0000 (15:01 -0800)
... up to rtentry_to_fib_config

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>
include/net/route.h
net/ipv4/af_inet.c
net/ipv4/fib_frontend.c
net/ipv4/ipconfig.c

index b77700059252fb3c5ed28008fa299d7b5335ba59..5847e6fabe8e1632dde6963ee093809ccd040a49 100644 (file)
@@ -120,7 +120,7 @@ extern void         ip_rt_send_redirect(struct sk_buff *skb);
 extern unsigned                inet_addr_type(struct net *net, __be32 addr);
 extern unsigned                inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr);
 extern void            ip_rt_multicast_event(struct in_device *);
-extern int             ip_rt_ioctl(unsigned int cmd, void __user *arg);
+extern int             ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
 extern void            ip_rt_get_source(u8 *src, struct rtable *rt);
 extern int             ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb);
 
index d76f8d8d5ebaedac7c1b01dc9bd62cadad5b0c08..bcf8c8a4a3ad0574c900b8a43151810e7ad3198b 100644 (file)
@@ -795,7 +795,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                case SIOCADDRT:
                case SIOCDELRT:
                case SIOCRTMSG:
-                       err = ip_rt_ioctl(cmd, (void __user *)arg);
+                       err = ip_rt_ioctl(sk->sk_net, cmd, (void __user *)arg);
                        break;
                case SIOCDARP:
                case SIOCGARP:
index 8b44e319524264446a07de6bb1abfad94f1dceb5..15909a9fa9b2f855a0c95729f1119002dd6e7b9b 100644 (file)
@@ -437,7 +437,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt,
  *     Handle IP routing ioctl calls. These are used to manipulate the routing tables
  */
 
-int ip_rt_ioctl(unsigned int cmd, void __user *arg)
+int ip_rt_ioctl(struct net *net, unsigned int cmd, void __user *arg)
 {
        struct fib_config cfg;
        struct rtentry rt;
@@ -453,18 +453,18 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg)
                        return -EFAULT;
 
                rtnl_lock();
-               err = rtentry_to_fib_config(&init_net, cmd, &rt, &cfg);
+               err = rtentry_to_fib_config(net, cmd, &rt, &cfg);
                if (err == 0) {
                        struct fib_table *tb;
 
                        if (cmd == SIOCDELRT) {
-                               tb = fib_get_table(&init_net, cfg.fc_table);
+                               tb = fib_get_table(net, cfg.fc_table);
                                if (tb)
                                        err = tb->tb_delete(tb, &cfg);
                                else
                                        err = -ESRCH;
                        } else {
-                               tb = fib_new_table(&init_net, cfg.fc_table);
+                               tb = fib_new_table(net, cfg.fc_table);
                                if (tb)
                                        err = tb->tb_insert(tb, &cfg);
                                else
index 4bc3a57c183d131b75852cae190c0c3ad91c9aa1..a52b5853aaa846a407d89e6ba281f6d619aa585b 100644 (file)
@@ -302,7 +302,7 @@ static int __init ic_route_ioctl(unsigned int cmd, struct rtentry *arg)
 
        mm_segment_t oldfs = get_fs();
        set_fs(get_ds());
-       res = ip_rt_ioctl(cmd, (void __user *) arg);
+       res = ip_rt_ioctl(&init_net, cmd, (void __user *) arg);
        set_fs(oldfs);
        return res;
 }