Add support for networkd ConfigureWithoutCarrier option on interfaces#215
Add support for networkd ConfigureWithoutCarrier option on interfaces#215slyon merged 7 commits intocanonical:mainfrom
Conversation
…e documentation phrasing; add test coverage
Codecov Report
@@ Coverage Diff @@
## main #215 +/- ##
=======================================
Coverage 99.02% 99.02%
=======================================
Files 56 56
Lines 9343 9347 +4
=======================================
+ Hits 9252 9256 +4
Misses 91 91
Continue to review full report at Codecov.
|
|
Thank you very much for this PR! I didn't do a full review yet, but overall it is looking good from a code POV. Though, as this contains a change of the YAML schema ("passthrough" of networkd's ConfigureWithoutCarrier= setting), I'd like to get an opinion from @vorlonofportland about if and how we want to support this use case before proceeding. @n-cc Do you know if a similar feature is available and/or needed to support this with netplan's NetworkManager backend as well? |
I don't have much experience with NetworkManager, but However, it doesn't seem that netplan's NetworkManager renderer currently templates the Looking at some of the common tests, it seems like there are situations where NetworkManager is used as the "main" renderer and networkd used for just specific ethernet interfaces; in these situations, my changes are sufficient to allow an interface to be assigned an IP without a physical link, so this feature can at least coexist with NetworkManager: |
| Example to enable all link-local addresses: ``link-local: [ ipv4, ipv6 ]`` | ||
| Example to disable all link-local addresses: ``link-local: [ ]`` | ||
|
|
||
| ``configure-without-carrier`` (bool) |
There was a problem hiding this comment.
my preference here is for the 'ignore-carrier' syntax, I think 'configure-without-carrier' is unnecessarily verbose.
There was a problem hiding this comment.
Thank you Steve for your opinion on the ignore-carrier wording. Let's go with that.
So I think this PR is fine, as soon as the setting is renamed to "ignore-carrier".
Additionally, we should consider adopting it to the NetworkManager backend as well. Thanks for your investigation on this @n-cc ! We should be able to generated drop-in configs for NetworkManager in /run/NetworkManager/conf.d/XX-netplan-NETDEF.conf to contain the [device] section you mentioned. Would you be willing to look into this (as part of an additional PR)?
| Example to enable all link-local addresses: ``link-local: [ ipv4, ipv6 ]`` | ||
| Example to disable all link-local addresses: ``link-local: [ ]`` | ||
|
|
||
| ``configure-without-carrier`` (bool) |
There was a problem hiding this comment.
| ``configure-without-carrier`` (bool) | |
| ``ignore-carrier`` (bool) – since **0.104* |
| {"activation-mode", YAML_SCALAR_NODE, handle_activation_mode, NULL, netdef_offset(activation_mode)}, \ | ||
| {"addresses", YAML_SEQUENCE_NODE, handle_addresses}, \ | ||
| {"critical", YAML_SCALAR_NODE, handle_netdef_bool, NULL, netdef_offset(critical)}, \ | ||
| {"configure-without-carrier", YAML_SCALAR_NODE, handle_netdef_bool, NULL, netdef_offset(configure_without_carrier)}, \ |
There was a problem hiding this comment.
| {"configure-without-carrier", YAML_SCALAR_NODE, handle_netdef_bool, NULL, netdef_offset(configure_without_carrier)}, \ | |
| {"ignore-carrier", YAML_SCALAR_NODE, handle_netdef_bool, NULL, netdef_offset(ignore_carrier)}, \ |
| char* activation_mode; | ||
|
|
||
| /* carrier */ | ||
| gboolean configure_without_carrier; |
There was a problem hiding this comment.
| gboolean configure_without_carrier; | |
| gboolean ignore_carrier; |
|
Thanks for the help getting this merged! This will hopefully benefit a lot of use-cases that require IP addresses set on inactive links.
I can give it a shot at some point, but if I recall correctly, the change to get it implemented was a bit more involved, as the |
Description
The ConfigureWithoutCarrier networkd option allows networkd to configure a specific link even if it has no carrier. This is useful for services such as isc-dhcp-server, which requires that all managed interfaces are up and assigned IP addresses regardless of their physical status.
I chose to put this key under
COMMON_LINK_HANDLERSrather thanPHYSICAL_LINK_HANDLERSas networkd does not differentiate between physical and virtual links WRT theConfigureWithoutCarrieroption, as far as I can tell. Better names are welcome.Checklist
make checksuccessfully.make check-coverage) *(make check-coveragereports the same coverage on master)