Bug 15616

Summary: network.sh udev script not configuring hotplugged interfaces
Product: [Build System, Metadata & Runtime] Meta-yocto Reporter: Régis Dargent <regis.dargent>
Component: meta-yoctoAssignee: Régis Dargent <regis.dargent>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher, randy.macleod, regis.dargent, tim.orling
Version: unspecified   
Target Milestone: 5.2   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
Allow udev script to configure hotplugged ethernet interfaces none

Description Régis Dargent 2024-10-10 08:23:12 UTC
In the case of hotplug event of a "net" device (eg. USB Ethernet adapter), the /etc/udev/scripts/network.sh script is called.
This script should configure the ethernet interface by calling ifup/ifdown.
(the ifup/ifdown call is done at the end of the script)

Due to missing /etc/network/options file (and its content) and/or a service (udev_network_queue.sh ?) using /dev/udev_network_queue to initialize the network interfaces, the network.sh script exits early.

I commented out the spoofing part of the script, and everything seems to work as intended. I didn't try a cold boot with the USB adapter present, though (which seemed to be addressed by the extra code in the script long ago).

I could find traces of the arrival of the problem about 14 years ago, but it still seems present in the latest yocto (I personally found it in dunfell and petalinux 2023/langdale).
The recipe responsible for the network.sh script is udev-extraconf.
Comment 1 Tim Orling 2024-10-10 15:00:56 UTC
https://layers.openembedded.org/layerindex/recipe/629/

https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/udev/udev-extraconf_1.1.bb?h=master

Would you be able to send a patch? First it should be applied to master and then can be backported as needed.
Comment 2 Régis Dargent 2024-10-10 15:49:07 UTC
Created attachment 5074 [details]
Allow udev script to configure hotplugged ethernet interfaces

The script was doing nothing at all.
After the modification, it does the initialization of the ethernet interfaces, but the removed parts had warnings about security issue if the action was done too early (boot time).
My opinion is that the job is done anyway somewhere else, and it does not seem so dangerous vs the intended feature is not working.
Comment 3 Randy MacLeod 2024-10-17 15:13:46 UTC
Regis, Are you able to send the patch to the oe-core email list?
That's where it can be reviewed.