提交 1bad118a 编写于 作者: D Denis V. Lunev 提交者: David S. Miller

[NETNS]: Pass namespace through ip_rt_ioctl.

... up to rtentry_to_fib_config
Acked-by: NBenjamin Thery <benjamin.thery@bull.net>
Acked-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: NDenis V. Lunev <den@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4b5d47d4
...@@ -120,7 +120,7 @@ extern void ip_rt_send_redirect(struct sk_buff *skb); ...@@ -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_addr_type(struct net *net, __be32 addr);
extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __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 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 void ip_rt_get_source(u8 *src, struct rtable *rt);
extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
......
...@@ -795,7 +795,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -795,7 +795,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
case SIOCADDRT: case SIOCADDRT:
case SIOCDELRT: case SIOCDELRT:
case SIOCRTMSG: case SIOCRTMSG:
err = ip_rt_ioctl(cmd, (void __user *)arg); err = ip_rt_ioctl(sk->sk_net, cmd, (void __user *)arg);
break; break;
case SIOCDARP: case SIOCDARP:
case SIOCGARP: case SIOCGARP:
......
...@@ -437,7 +437,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt, ...@@ -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 * 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 fib_config cfg;
struct rtentry rt; struct rtentry rt;
...@@ -453,18 +453,18 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg) ...@@ -453,18 +453,18 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg)
return -EFAULT; return -EFAULT;
rtnl_lock(); rtnl_lock();
err = rtentry_to_fib_config(&init_net, cmd, &rt, &cfg); err = rtentry_to_fib_config(net, cmd, &rt, &cfg);
if (err == 0) { if (err == 0) {
struct fib_table *tb; struct fib_table *tb;
if (cmd == SIOCDELRT) { if (cmd == SIOCDELRT) {
tb = fib_get_table(&init_net, cfg.fc_table); tb = fib_get_table(net, cfg.fc_table);
if (tb) if (tb)
err = tb->tb_delete(tb, &cfg); err = tb->tb_delete(tb, &cfg);
else else
err = -ESRCH; err = -ESRCH;
} else { } else {
tb = fib_new_table(&init_net, cfg.fc_table); tb = fib_new_table(net, cfg.fc_table);
if (tb) if (tb)
err = tb->tb_insert(tb, &cfg); err = tb->tb_insert(tb, &cfg);
else else
......
...@@ -302,7 +302,7 @@ static int __init ic_route_ioctl(unsigned int cmd, struct rtentry *arg) ...@@ -302,7 +302,7 @@ static int __init ic_route_ioctl(unsigned int cmd, struct rtentry *arg)
mm_segment_t oldfs = get_fs(); mm_segment_t oldfs = get_fs();
set_fs(get_ds()); 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); set_fs(oldfs);
return res; return res;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册