[PATCH net-next v2] vlan: remove MII ioctl forwarding
From: Hungyu Lin
Date: Sun Nov 15 2026 - 03:54:41 EST
VLAN devices forward SIOCGMIIPHY, SIOCGMIIREG and SIOCSMIIREG to the
lower device. This exposes the lower device's PHY through the VLAN
even when the two devices are in different network namespaces.
Bonding used MII ioctls as a fallback for link monitoring. Commit
23a6037ce76c ("bonding: Remove support for use_carrier") removed
that fallback.
Remove vlan_dev_ioctl() and its ndo_eth_ioctl hook so MII ioctls on
VLAN devices return -EOPNOTSUPP. Applications that need PHY access
can issue these ioctls on the lower device.
Suggested-by: Jakub Kicinski <kuba@xxxxxxxxxx>
Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>
---
v2:
- Remove MII ioctl forwarding entirely and target net-next.
v1: https://lore.kernel.org/netdev/20261106124639.12584-1-dennylin0707@xxxxxxxxx/
net/8021q/vlan_dev.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index bca0a3693636..cff36d3fc6c8 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -406,29 +406,6 @@ static int vlan_hwtstamp_set(struct net_device *dev,
return generic_hwtstamp_set_lower(real_dev, cfg, extack);
}
-static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
- struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
- struct ifreq ifrr;
- int err = -EOPNOTSUPP;
-
- strscpy_pad(ifrr.ifr_name, real_dev->name, IFNAMSIZ);
- ifrr.ifr_ifru = ifr->ifr_ifru;
-
- switch (cmd) {
- case SIOCGMIIPHY:
- case SIOCGMIIREG:
- case SIOCSMIIREG:
- err = dev_eth_ioctl(real_dev, &ifrr, cmd);
- break;
- }
-
- if (!err)
- ifr->ifr_ifru = ifrr.ifr_ifru;
-
- return err;
-}
-
static int vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa)
{
struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
@@ -1105,7 +1082,6 @@ static const struct net_device_ops vlan_netdev_ops = {
.ndo_set_rx_mode = vlan_dev_set_rx_mode,
.ndo_change_rx_flags = vlan_dev_change_rx_flags,
.ndo_work = vlan_dev_work,
- .ndo_eth_ioctl = vlan_dev_ioctl,
.ndo_neigh_setup = vlan_dev_neigh_setup,
.ndo_get_stats64 = vlan_dev_get_stats64,
#if IS_ENABLED(CONFIG_FCOE)
base-commit: d1f4b7c6b997c29de67ad7178ababac2328cb1b4