diff options
| author | Arnd Bergmann <[email protected]> | 2021-07-27 13:45:14 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2021-07-27 19:11:45 +0000 |
| commit | ad7eab2ab014748b062507b7ac69f8e856057717 (patch) | |
| tree | 8d9277dcfed3e929d2d66247cd0e9ab7ec8ef8df /net/core/dev_ioctl.c | |
| parent | dev_ioctl: split out ndo_eth_ioctl (diff) | |
| download | kernel-ad7eab2ab014748b062507b7ac69f8e856057717.tar.gz kernel-ad7eab2ab014748b062507b7ac69f8e856057717.zip | |
net: split out ndo_siowandev ioctl
In order to further reduce the scope of ndo_do_ioctl(), move
out the SIOCWANDEV handling into a new network device operation
function.
Adjust the prototype to only pass the if_settings sub-structure
in place of the ifreq, and remove the redundant 'cmd' argument
in the process.
Cc: Krzysztof Halasa <[email protected]>
Cc: "Jan \"Yenya\" Kasprzak" <[email protected]>
Cc: Kevin Curtis <[email protected]>
Cc: Zhao Qiang <[email protected]>
Cc: Martin Schiller <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: [email protected]
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/core/dev_ioctl.c')
| -rw-r--r-- | net/core/dev_ioctl.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 8e30fe8b5645..e0586bc4d6c6 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c @@ -291,6 +291,20 @@ static int dev_siocdevprivate(struct net_device *dev, struct ifreq *ifr, return dev_do_ioctl(dev, ifr, cmd); } +static int dev_siocwandev(struct net_device *dev, struct if_settings *ifs) +{ + const struct net_device_ops *ops = dev->netdev_ops; + + if (ops->ndo_siocwandev) { + if (netif_device_present(dev)) + return ops->ndo_siocwandev(dev, ifs); + else + return -ENODEV; + } + + return -EOPNOTSUPP; +} + /* * Perform the SIOCxIFxxx calls, inside rtnl_lock() */ @@ -359,6 +373,9 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data, ifr->ifr_newname[IFNAMSIZ-1] = '\0'; return dev_change_name(dev, ifr->ifr_newname); + case SIOCWANDEV: + return dev_siocwandev(dev, &ifr->ifr_settings); + case SIOCSHWTSTAMP: err = net_hwtstamp_validate(ifr); if (err) @@ -386,8 +403,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data, cmd == SIOCBONDINFOQUERY || cmd == SIOCBONDCHANGEACTIVE || cmd == SIOCBRADDIF || - cmd == SIOCBRDELIF || - cmd == SIOCWANDEV) { + cmd == SIOCBRDELIF) { err = dev_do_ioctl(dev, ifr, cmd); } else err = -EINVAL; |
