-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for networkd ConfigureWithoutCarrier option on interfaces #215
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:
|
doc/netplan.md
Outdated
@@ -277,6 +277,11 @@ Virtual devices | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my preference here is for the 'ignore-carrier' syntax, I think 'configure-without-carrier' is unnecessarily verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)?
doc/netplan.md
Outdated
@@ -277,6 +277,11 @@ Virtual devices | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``configure-without-carrier`` (bool) | |
``ignore-carrier`` (bool) – since **0.104* |
src/parse.c
Outdated
@@ -2235,6 +2235,7 @@ static const mapping_entry_handler dhcp6_overrides_handlers[] = { | |||
{"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{"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)}, \ |
src/parse.h
Outdated
@@ -401,6 +401,9 @@ struct net_definition { | |||
|
|||
/* netplan-feature: activation-mode */ | |||
char* activation_mode; | |||
|
|||
/* carrier */ | |||
gboolean configure_without_carrier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_HANDLERS
rather thanPHYSICAL_LINK_HANDLERS
as networkd does not differentiate between physical and virtual links WRT theConfigureWithoutCarrier
option, as far as I can tell. Better names are welcome.Checklist
make check
successfully.make check-coverage
) *(make check-coverage
reports the same coverage on master)