mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
net: bridge: move bridge ioctls out of .ndo_do_ioctl
Working towards obsoleting the .ndo_do_ioctl operation entirely, stop passing the SIOCBRADDIF/SIOCBRDELIF device ioctl commands into this callback. My first attempt was to add another ndo_siocbr() callback, but as there is only a single driver that takes these commands and there is already a hook mechanism to call directly into this driver, extend this hook instead, and use it for both the deviceless and the device specific ioctl commands. Cc: Roopa Prabhu <roopa@nvidia.com> Cc: Nikolay Aleksandrov <nikolay@nvidia.com> Cc: bridge@lists.linux-foundation.org Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
88fc023f7d
commit
ad2f99aedf
33
net/socket.c
33
net/socket.c
@@ -1064,9 +1064,13 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
||||
*/
|
||||
|
||||
static DEFINE_MUTEX(br_ioctl_mutex);
|
||||
static int (*br_ioctl_hook) (struct net *, unsigned int cmd, void __user *arg);
|
||||
static int (*br_ioctl_hook)(struct net *net, struct net_bridge *br,
|
||||
unsigned int cmd, struct ifreq *ifr,
|
||||
void __user *uarg);
|
||||
|
||||
void brioctl_set(int (*hook) (struct net *, unsigned int, void __user *))
|
||||
void brioctl_set(int (*hook)(struct net *net, struct net_bridge *br,
|
||||
unsigned int cmd, struct ifreq *ifr,
|
||||
void __user *uarg))
|
||||
{
|
||||
mutex_lock(&br_ioctl_mutex);
|
||||
br_ioctl_hook = hook;
|
||||
@@ -1074,6 +1078,22 @@ void brioctl_set(int (*hook) (struct net *, unsigned int, void __user *))
|
||||
}
|
||||
EXPORT_SYMBOL(brioctl_set);
|
||||
|
||||
int br_ioctl_call(struct net *net, struct net_bridge *br, unsigned int cmd,
|
||||
struct ifreq *ifr, void __user *uarg)
|
||||
{
|
||||
int err = -ENOPKG;
|
||||
|
||||
if (!br_ioctl_hook)
|
||||
request_module("bridge");
|
||||
|
||||
mutex_lock(&br_ioctl_mutex);
|
||||
if (br_ioctl_hook)
|
||||
err = br_ioctl_hook(net, br, cmd, ifr, uarg);
|
||||
mutex_unlock(&br_ioctl_mutex);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static DEFINE_MUTEX(vlan_ioctl_mutex);
|
||||
static int (*vlan_ioctl_hook) (struct net *, void __user *arg);
|
||||
|
||||
@@ -1162,14 +1182,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||
case SIOCSIFBR:
|
||||
case SIOCBRADDBR:
|
||||
case SIOCBRDELBR:
|
||||
err = -ENOPKG;
|
||||
if (!br_ioctl_hook)
|
||||
request_module("bridge");
|
||||
|
||||
mutex_lock(&br_ioctl_mutex);
|
||||
if (br_ioctl_hook)
|
||||
err = br_ioctl_hook(net, cmd, argp);
|
||||
mutex_unlock(&br_ioctl_mutex);
|
||||
err = br_ioctl_call(net, NULL, cmd, NULL, argp);
|
||||
break;
|
||||
case SIOCGIFVLAN:
|
||||
case SIOCSIFVLAN:
|
||||
|
Reference in New Issue
Block a user