Re: [PATCH 2/2] leds: trigger: netdev: refactor netdev_event_requires_handling()
From: Lee Jones <lee@kernel.org>
Date: 2025-06-19 11:37:47
Also in:
linux-leds
On Thu, 12 Jun 2025, Andrew Lunn wrote:
On Tue, Jun 10, 2025 at 01:40:20PM +0200, Tobias Junghans wrote:quoted
If there are network devices with the same name in different namespaces, ledtrig-netdev gets confused easily and switches between these devices whenever there are NETDEV_CHANGENAME/NETDEV_REGISTER notifications. This happens since ledtrig-netdev only checks for device name equality regardless of previous associations with another network device with the same name. Real world example: eth0 is the primary physical network interface and ledltrig-netdev is associated with that interface. If now Docker creates a virtual Ethernet interface (vethXXXX), moves it to the container's net namespace and renames it to eth0, ledtrig-netdev switches to this device and the LED no longer blinks for the original (physical) network device. Fix this by refactoring the conditions under which to handle netdev events: - For processing NETDEV_REGISTER events, the device name has to match and no association with a net_dev must exist.Sorry for taking a while to review this. It took me a while to think it through and produce a list of use cases. And might still be missing some. Given the complexity here, i actually think we need verbose comments in the code.
Thanks Andrew - I'll leave it with you. =:-) [...] -- Lee Jones [李琼斯]