Thread (13 messages) flat view 13 messages, 4 authors, 17d ago

Re: [PATCH net] net: do not bond/team netdevices which use ml_priv

From: Hangbin Liu <hidden>
Date: 2026-08-20 03:24:16

On Wed, Aug 19, 2026 at 08:15:42PM +0200, Oliver Hartkopp wrote:
Hi Hangbin, all,

thanks for your feedback!

In fact checking for dev->ml_priv != NULL seems to be too hard and would
likely create some breaking setups.

I have sent a patch on the Linux-CAN ML that makes the CAN subsystem robust
against alien ARPHRD_CAN interfaces that might be created by TUN/TAP via
TUNSETLINK ioctl:

https://lore.kernel.org/linux-can/20260819160822.8256-1-socketcan@hartkopp.net/ (local)

The other question remains how to make bonding/team keep the fingers away
from incompatible net devices.

The current black listing approach from Jiale Yao (using a unified helper as
suggested by Jiri Pirko) seems to be the best way to go now:

https://lore.kernel.org/netdev/20260728151240.89434-1-yaojiale02@163.com/ (local)

+		if (port_dev->type == ARPHRD_CAN ||
+		    port_dev->type == ARPHRD_IEEE802154 ||
+		    port_dev->type == ARPHRD_IEEE802154_MONITOR) {
+			NL_SET_ERR_MSG(extack,
+				       "CAN and IEEE 802.15.4 devices can't be added as a team port");
+			netdev_err(dev, "Device %s is CAN or IEEE 802.15.4. These device types
can't be added as a team port\n",
+				   portname);
+			return -EINVAL;
+		}
+	}
+
This looks good to me to avoid making the checking to wide.
There might be other dev->types (e.g. ARPHRD_ARCNET) or a future white list
approach this unified helper could support. For either team and bonding!

@Jiale Yao: What would be a good name for such helper in
include/linux/if_arp.h ?

dev_is_not_ether_compatible(const struct net_device *dev)
dev_is_ether_compatible(const struct net_device *dev)
dev_has_special_l2_proto(const struct net_device *dev)
dev_has_l2_proto(const struct net_device *dev)
dev_is_pure_packet_bus(const struct net_device *dev)

or something like this?
I'm not good at naming. Leave it to you.

Thanks for your works!

Hangbin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help