Commit 7a50a240 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

net/compat_ioctl: support SIOCWANDEV

This adds compat_ioctl support for SIOCWANDEV, which has
always been missing.

The definition of struct compat_ifreq was missing an
ifru_settings fields that is needed to support SIOCWANDEV,
so add that and clean up the whitespace damage in the
struct definition.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fab2532b
...@@ -165,25 +165,32 @@ struct compat_ifmap { ...@@ -165,25 +165,32 @@ struct compat_ifmap {
unsigned char port; unsigned char port;
}; };
struct compat_if_settings
{
unsigned int type; /* Type of physical device or protocol */
unsigned int size; /* Size of the data allocated by the caller */
compat_uptr_t ifs_ifsu; /* union of pointers */
};
struct compat_ifreq { struct compat_ifreq {
union { union {
char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
} ifr_ifrn; } ifr_ifrn;
union { union {
struct sockaddr ifru_addr; struct sockaddr ifru_addr;
struct sockaddr ifru_dstaddr; struct sockaddr ifru_dstaddr;
struct sockaddr ifru_broadaddr; struct sockaddr ifru_broadaddr;
struct sockaddr ifru_netmask; struct sockaddr ifru_netmask;
struct sockaddr ifru_hwaddr; struct sockaddr ifru_hwaddr;
short ifru_flags; short ifru_flags;
compat_int_t ifru_ivalue; compat_int_t ifru_ivalue;
compat_int_t ifru_mtu; compat_int_t ifru_mtu;
struct compat_ifmap ifru_map; struct compat_ifmap ifru_map;
char ifru_slave[IFNAMSIZ]; /* Just fits the size */ char ifru_slave[IFNAMSIZ]; /* Just fits the size */
char ifru_newname[IFNAMSIZ]; char ifru_newname[IFNAMSIZ];
compat_caddr_t ifru_data; compat_caddr_t ifru_data;
/* XXXX? ifru_settings should be here */ struct compat_if_settings ifru_settings;
} ifr_ifru; } ifr_ifru;
}; };
struct compat_ifconf { struct compat_ifconf {
......
...@@ -2627,6 +2627,27 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32) ...@@ -2627,6 +2627,27 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
return dev_ioctl(net, SIOCETHTOOL, ifr); return dev_ioctl(net, SIOCETHTOOL, ifr);
} }
static int compat_siocwandev(struct net *net, struct compat_ifreq __user *uifr32)
{
void __user *uptr;
compat_uptr_t uptr32;
struct ifreq __user *uifr;
uifr = compat_alloc_user_space(sizeof (*uifr));
if (copy_in_user(uifr, uifr32, sizeof(struct compat_ifreq)))
return -EFAULT;
if (get_user(uptr32, &uifr32->ifr_settings.ifs_ifsu))
return -EFAULT;
uptr = compat_ptr(uptr32);
if (put_user(uptr, &uifr->ifr_settings.ifs_ifsu.raw_hdlc))
return -EFAULT;
return dev_ioctl(net, SIOCWANDEV, uifr);
}
static int bond_ioctl(struct net *net, unsigned int cmd, static int bond_ioctl(struct net *net, unsigned int cmd,
struct compat_ifreq __user *ifr32) struct compat_ifreq __user *ifr32)
{ {
...@@ -3058,6 +3079,8 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, ...@@ -3058,6 +3079,8 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
return dev_ifconf(net, argp); return dev_ifconf(net, argp);
case SIOCETHTOOL: case SIOCETHTOOL:
return ethtool_ioctl(net, argp); return ethtool_ioctl(net, argp);
case SIOCWANDEV:
return compat_siocwandev(net, argp);
case SIOCBONDENSLAVE: case SIOCBONDENSLAVE:
case SIOCBONDRELEASE: case SIOCBONDRELEASE:
case SIOCBONDSETHWADDR: case SIOCBONDSETHWADDR:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment