mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
[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>
This commit is contained in:
parent
73b3871165
commit
e5b13cb10d
4 changed files with 9 additions and 8 deletions
|
@ -129,7 +129,7 @@ extern int unregister_inetaddr_notifier(struct notifier_block *nb);
|
||||||
|
|
||||||
extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
|
extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
|
||||||
extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
|
extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
|
||||||
extern int devinet_ioctl(unsigned int cmd, void __user *);
|
extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
|
||||||
extern void devinet_init(void);
|
extern void devinet_init(void);
|
||||||
extern struct in_device *inetdev_by_index(struct net *, int);
|
extern struct in_device *inetdev_by_index(struct net *, int);
|
||||||
extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
|
extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
|
||||||
|
|
|
@ -784,6 +784,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
struct net *net = sk->sk_net;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SIOCGSTAMP:
|
case SIOCGSTAMP:
|
||||||
|
@ -795,12 +796,12 @@ 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(sk->sk_net, cmd, (void __user *)arg);
|
err = ip_rt_ioctl(net, cmd, (void __user *)arg);
|
||||||
break;
|
break;
|
||||||
case SIOCDARP:
|
case SIOCDARP:
|
||||||
case SIOCGARP:
|
case SIOCGARP:
|
||||||
case SIOCSARP:
|
case SIOCSARP:
|
||||||
err = arp_ioctl(sk->sk_net, cmd, (void __user *)arg);
|
err = arp_ioctl(net, cmd, (void __user *)arg);
|
||||||
break;
|
break;
|
||||||
case SIOCGIFADDR:
|
case SIOCGIFADDR:
|
||||||
case SIOCSIFADDR:
|
case SIOCSIFADDR:
|
||||||
|
@ -813,7 +814,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||||
case SIOCSIFPFLAGS:
|
case SIOCSIFPFLAGS:
|
||||||
case SIOCGIFPFLAGS:
|
case SIOCGIFPFLAGS:
|
||||||
case SIOCSIFFLAGS:
|
case SIOCSIFFLAGS:
|
||||||
err = devinet_ioctl(cmd, (void __user *)arg);
|
err = devinet_ioctl(net, cmd, (void __user *)arg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (sk->sk_prot->ioctl)
|
if (sk->sk_prot->ioctl)
|
||||||
|
|
|
@ -595,7 +595,7 @@ static __inline__ int inet_abc_len(__be32 addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int devinet_ioctl(unsigned int cmd, void __user *arg)
|
int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
|
||||||
{
|
{
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
struct sockaddr_in sin_orig;
|
struct sockaddr_in sin_orig;
|
||||||
|
@ -624,7 +624,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
|
||||||
*colon = 0;
|
*colon = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_KMOD
|
#ifdef CONFIG_KMOD
|
||||||
dev_load(&init_net, ifr.ifr_name);
|
dev_load(net, ifr.ifr_name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
@ -665,7 +665,7 @@ int devinet_ioctl(unsigned int cmd, void __user *arg)
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
|
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
if ((dev = __dev_get_by_name(&init_net, ifr.ifr_name)) == NULL)
|
if ((dev = __dev_get_by_name(net, ifr.ifr_name)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (colon)
|
if (colon)
|
||||||
|
|
|
@ -291,7 +291,7 @@ static int __init ic_dev_ioctl(unsigned int cmd, struct ifreq *arg)
|
||||||
|
|
||||||
mm_segment_t oldfs = get_fs();
|
mm_segment_t oldfs = get_fs();
|
||||||
set_fs(get_ds());
|
set_fs(get_ds());
|
||||||
res = devinet_ioctl(cmd, (struct ifreq __user *) arg);
|
res = devinet_ioctl(&init_net, cmd, (struct ifreq __user *) arg);
|
||||||
set_fs(oldfs);
|
set_fs(oldfs);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue