aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-02-28 23:51:43 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-28 23:51:43 -0500
commite5b13cb10de209f924fdf9478214bcf7e4008d6d (patch)
tree212d723fe14e2dd49ab044f8ca969303f316645c
parent73b3871165e45ea6d57775c6bfb1a1760ad6e36b (diff)
[NETNS]: Process devinet ioctl in the correct namespace.
Add namespace parameter to devinet_ioctl and locate device inside it for state changes. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/inetdevice.h2
-rw-r--r--net/ipv4/af_inet.c7
-rw-r--r--net/ipv4/devinet.c6
-rw-r--r--net/ipv4/ipconfig.c2
4 files changed, 9 insertions, 8 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index fc4e3db649e8..da05ab47ff2f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -129,7 +129,7 @@ extern int unregister_inetaddr_notifier(struct notifier_block *nb);
129 129
130extern struct net_device *ip_dev_find(struct net *net, __be32 addr); 130extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
132extern int devinet_ioctl(unsigned int cmd, void __user *); 132extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
133extern void devinet_init(void); 133extern void devinet_init(void);
134extern struct in_device *inetdev_by_index(struct net *, int); 134extern struct in_device *inetdev_by_index(struct net *, int);
135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 09ca5293d08f..c270080f370e 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -784,6 +784,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
784{ 784{
785 struct sock *sk = sock->sk; 785 struct sock *sk = sock->sk;
786 int err = 0; 786 int err = 0;
787 struct net *net = sk->sk_net;
787 788
788 switch (cmd) { 789 switch (cmd) {
789 case SIOCGSTAMP: 790 case SIOCGSTAMP:
@@ -795,12 +796,12 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
795 case SIOCADDRT: 796 case SIOCADDRT:
796 case SIOCDELRT: 797 case SIOCDELRT:
797 case SIOCRTMSG: 798 case SIOCRTMSG:
798 err = ip_rt_ioctl(sk->sk_net, cmd, (void __user *)arg); 799 err = ip_rt_ioctl(net, cmd, (void __user *)arg);
799 break; 800 break;
800 case SIOCDARP: 801 case SIOCDARP:
801 case SIOCGARP: 802 case SIOCGARP:
802 case SIOCSARP: 803 case SIOCSARP:
803 err = arp_ioctl(sk->sk_net, cmd, (void __user *)arg); 804 err = arp_ioctl(net, cmd, (void __user *)arg);
804 break; 805 break;
805 case SIOCGIFADDR: 806 case SIOCGIFADDR:
806 case SIOCSIFADDR: 807 case SIOCSIFADDR:
@@ -813,7 +814,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
813 case SIOCSIFPFLAGS: 814 case SIOCSIFPFLAGS:
814 case SIOCGIFPFLAGS: 815 case SIOCGIFPFLAGS:
815 case SIOCSIFFLAGS: 816 case SIOCSIFFLAGS:
816 err = devinet_ioctl(cmd, (void __user *)arg); 817 err = devinet_ioctl(net, cmd, (void __user *)arg);
817 break; 818 break;
818 default: 819 default:
819 if (sk->sk_prot->ioctl) 820 if (sk->sk_prot->ioctl)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 90210a74d638..af752fc5d0ab 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -595,7 +595,7 @@ static __inline__ int inet_abc_len(__be32 addr)
595} 595}
596 596
597 597
598int devinet_ioctl(unsigned int cmd, void __user *arg) 598int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
599{ 599{
600 struct ifreq ifr; 600 struct ifreq ifr;
601 struct sockaddr_in sin_orig; 601 struct sockaddr_in sin_orig;
@@ -624,7 +624,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
624 *colon = 0; 624 *colon = 0;
625 625
626#ifdef CONFIG_KMOD 626#ifdef CONFIG_KMOD
627 dev_load(&init_net, ifr.ifr_name); 627 dev_load(net, ifr.ifr_name);
628#endif 628#endif
629 629
630 switch (cmd) { 630 switch (cmd) {
@@ -665,7 +665,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
665 rtnl_lock(); 665 rtnl_lock();
666 666
667 ret = -ENODEV; 667 ret = -ENODEV;
668 if ((dev = __dev_get_by_name(&init_net, ifr.ifr_name)) == NULL) 668 if ((dev = __dev_get_by_name(net, ifr.ifr_name)) == NULL)
669 goto done; 669 goto done;
670 670
671 if (colon) 671 if (colon)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 10013ccee8dd..c90e75a66e81 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -291,7 +291,7 @@ static int __init ic_dev_ioctl(unsigned int cmd, struct ifreq *arg)
291 291
292 mm_segment_t oldfs = get_fs(); 292 mm_segment_t oldfs = get_fs();
293 set_fs(get_ds()); 293 set_fs(get_ds());
294 res = devinet_ioctl(cmd, (struct ifreq __user *) arg); 294 res = devinet_ioctl(&init_net, cmd, (struct ifreq __user *) arg);
295 set_fs(oldfs); 295 set_fs(oldfs);
296 return res; 296 return res;
297} 297}