You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RFE: better management of dynamic network interfaces #8
It's possible that at the time when netlabel-config is started at boot, some network interfaces aren't yet available. The reason for that could be that the corresponding kernel module isn't (fully) loaded yet, or the hardware is simply inserted later (like USB network adapters or putting a laptop in a docking station). With netlabelctl however it's not possible to manage interfaces which are not (yet) present.
I suppose this could be fixed by changing netlabelctl and kernel so that rules could be stored also for nonexistent interfaces. But a more dynamic way could be to utilize udevd so that when new network hardware is found, netlabelctl would be launched (for example via something like [email protected]) to configure the new interface. This would not require changes to kernel.
Sure. I have this problem even with fixed devices: netlabel-config starts before one of the drivers is loaded or at least the interface is not usable at that time.
I think the udev rule should look like something like this:
In case of udev-action:add, netlabel-config-netif should apply rules matching the device in /etc/netlabel.rules.
In case of udev-action:remove, netlabel-config-netif should remove kernel rules matching the device.
Instead of new command netlabel-config-netif, it may make sense to just extend netlabel-config with new verbs, for example netlabel-config udev-action:....
If the udev rules are called for all interfaces including lo (not sure), it would make netlabel-config somewhat redundant except for global rules like unlbl accept off. These could be applied on the first invocation and deleted when the last interface is removed (though I guess that never happens for lo).
If 100% compatibility with previous setups is needed, new dynamic actions could be opted in with a new global rule in /etc/netlabel.rules like udev-rules on/off or the dynamic rules could be located in a new file /etc/netlabel.udev-rules or /etc/netlabel.rules.d/*.rules with one file per interface.
Activity
[-]Management of network interface insertion[/-][+]RFE: better management of dynamic network interfaces[/+]pcmoore commentedon May 29, 2020
I'm not sure this is a practical problem for most people using network labeling today, but that doesn't mean we can't try to solve it anyway ;)
It sounds like the udev based approach would be the easiest, would you care to work on that @topimiettinen?
topimiettinen commentedon May 30, 2020
Sure. I have this problem even with fixed devices:
netlabel-configstarts before one of the drivers is loaded or at least the interface is not usable at that time.I think the udev rule should look like something like this:
In case of
udev-action:add,netlabel-config-netifshould apply rules matching the device in/etc/netlabel.rules.In case of
udev-action:remove,netlabel-config-netifshould remove kernel rules matching the device.Instead of new command
netlabel-config-netif, it may make sense to just extendnetlabel-configwith new verbs, for examplenetlabel-config udev-action:....If the udev rules are called for all interfaces including
lo(not sure), it would makenetlabel-configsomewhat redundant except for global rules likeunlbl accept off. These could be applied on the first invocation and deleted when the last interface is removed (though I guess that never happens forlo).If 100% compatibility with previous setups is needed, new dynamic actions could be opted in with a new global rule in
/etc/netlabel.ruleslikeudev-rules on/offor the dynamic rules could be located in a new file/etc/netlabel.udev-rulesor/etc/netlabel.rules.d/*.ruleswith one file per interface.topimiettinen commentedon May 31, 2020
Added PR #9.