Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: bonding: move ioctl handling to private ndo operation

All other user triggered operations are gone from ndo_ioctl, so move
the SIOCBOND family into a custom operation as well.

The .ndo_ioctl() helper is no longer called by the dev_ioctl.c code now,
but there are still a few definitions in obsolete wireless drivers as well
as the appletalk and ieee802154 layers to call SIOCSIFADDR/SIOCGIFADDR
helpers from inside the kernel.

Cc: Jay Vosburgh <j.vosburgh@gmail.com>
Cc: Veaceslav Falico <vfalico@gmail.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnd Bergmann and committed by
David S. Miller
3d9d00bd ad2f99ae

+26 -8
+11
Documentation/networking/netdevices.rst
··· 222 222 Synchronization: rtnl_lock() semaphore. 223 223 Context: process 224 224 225 + This is only called by network subsystems internally, 226 + not by user space calling ioctl as it was in before 227 + linux-5.14. 228 + 229 + ndo_siocbond: 230 + Synchronization: rtnl_lock() semaphore. 231 + Context: process 232 + 233 + Used by the bonding driver for the SIOCBOND family of 234 + ioctl commands. 235 + 225 236 ndo_siocwandev: 226 237 Synchronization: rtnl_lock() semaphore. 227 238 Context: process
+1 -1
drivers/net/bonding/bond_main.c
··· 4988 4988 .ndo_select_queue = bond_select_queue, 4989 4989 .ndo_get_stats64 = bond_get_stats, 4990 4990 .ndo_eth_ioctl = bond_eth_ioctl, 4991 - .ndo_do_ioctl = bond_do_ioctl, 4991 + .ndo_siocbond = bond_do_ioctl, 4992 4992 .ndo_siocdevprivate = bond_siocdevprivate, 4993 4993 .ndo_change_rx_flags = bond_change_rx_flags, 4994 4994 .ndo_set_rx_mode = bond_set_rx_mode,
+10 -3
include/linux/netdevice.h
··· 1086 1086 * Test if Media Access Control address is valid for the device. 1087 1087 * 1088 1088 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); 1089 - * Called when a user requests an ioctl which can't be handled by 1090 - * the generic interface code. If not defined ioctls return 1091 - * not supported error code. 1089 + * Old-style ioctl entry point. This is used internally by the 1090 + * appletalk and ieee802154 subsystems but is no longer called by 1091 + * the device ioctl handler. 1092 + * 1093 + * int (*ndo_siocbond)(struct net_device *dev, struct ifreq *ifr, int cmd); 1094 + * Used by the bonding driver for its device specific ioctls: 1095 + * SIOCBONDENSLAVE, SIOCBONDRELEASE, SIOCBONDSETHWADDR, SIOCBONDCHANGEACTIVE, 1096 + * SIOCBONDSLAVEINFOQUERY, and SIOCBONDINFOQUERY 1092 1097 * 1093 1098 * * int (*ndo_eth_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); 1094 1099 * Called for ethernet specific ioctls: SIOCGMIIPHY, SIOCGMIIREG, ··· 1372 1367 struct ifreq *ifr, int cmd); 1373 1368 int (*ndo_eth_ioctl)(struct net_device *dev, 1374 1369 struct ifreq *ifr, int cmd); 1370 + int (*ndo_siocbond)(struct net_device *dev, 1371 + struct ifreq *ifr, int cmd); 1375 1372 int (*ndo_siocwandev)(struct net_device *dev, 1376 1373 struct if_settings *ifs); 1377 1374 int (*ndo_siocdevprivate)(struct net_device *dev,
+4 -4
net/core/dev_ioctl.c
··· 260 260 return err; 261 261 } 262 262 263 - static int dev_do_ioctl(struct net_device *dev, 263 + static int dev_siocbond(struct net_device *dev, 264 264 struct ifreq *ifr, unsigned int cmd) 265 265 { 266 266 const struct net_device_ops *ops = dev->netdev_ops; 267 267 268 - if (ops->ndo_do_ioctl) { 268 + if (ops->ndo_siocbond) { 269 269 if (netif_device_present(dev)) 270 - return ops->ndo_do_ioctl(dev, ifr, cmd); 270 + return ops->ndo_siocbond(dev, ifr, cmd); 271 271 else 272 272 return -ENODEV; 273 273 } ··· 407 407 cmd == SIOCBONDSLAVEINFOQUERY || 408 408 cmd == SIOCBONDINFOQUERY || 409 409 cmd == SIOCBONDCHANGEACTIVE) { 410 - err = dev_do_ioctl(dev, ifr, cmd); 410 + err = dev_siocbond(dev, ifr, cmd); 411 411 } else 412 412 err = -EINVAL; 413 413