-
Notifications
You must be signed in to change notification settings - Fork 206
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 DuplicateAddressDetection settings for systemd-networkd (LP: #1959190) #525
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -422,6 +422,12 @@ Match devices by MAC when setting options like: `wakeonlan` or `*-offload`. | |||||
> In addition to the addresses themselves one can specify configuration | ||||||
> parameters as mappings. Current supported options are: | ||||||
|
||||||
- **`duplicate-address-detection`** (scalar) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (non-blocking):
Suggested change
|
||||||
|
||||||
> Configure the duplicate address detection (DAD). Valid options | ||||||
> are `ipv4`, `ipv6`, `both` or `none`. Currently supported on the | ||||||
> networkd back end only. | ||||||
Comment on lines
+427
to
+429
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is currently a direct copy of the networkd settings. I'd rather like to represent this as a sequence/list of flags, though. Maybe on the global level instead of per-address. e.g. ethernets:
eth0:
addresses: [169.254.0.13/16]
dhcp6: true
duplicate-address-detection: [ipv4-ll, ipv6] The current default could be represented as On a per-IP level it does not alway make sense, or is there any use case for this? E.g: ethernets:
eth0:
addresses:
- 169.254.0.13/16:
duplicate-address-detection: "ipv6"
dhcp6: true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I don't think this it makes sense too to have this configuration But thinking of weird corner cases, I don't know why someone would do that, but it still is a valid configuration for networkd, that cannot be reproduced with nm afaik.
|
||||||
|
||||||
- **`lifetime`** (scalar) – since 0.100 | ||||||
|
||||||
> Default: `forever`. This can be `forever` or `0` and corresponds | ||||||
|
@@ -445,6 +451,8 @@ Match devices by MAC when setting options like: `wakeonlan` or `*-offload`. | |||||
- "10.0.0.15/24": | ||||||
lifetime: 0 | ||||||
label: "maas" | ||||||
- "169.254.10.1/24": | ||||||
duplicate-address-detection: "none" | ||||||
- "2001:1::1/64" | ||||||
``` | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1393,9 +1393,22 @@ handle_address_option_label(NetplanParser* npp, yaml_node_t* node, const void* d | |
return handle_generic_str(npp, node, npp->current.addr_options, data, error); | ||
} | ||
|
||
STATIC gboolean | ||
handle_address_option_duplicate_address_detection(NetplanParser* npp, yaml_node_t* node, const void* data, GError** error) | ||
{ | ||
if (g_ascii_strcasecmp(scalar(node), "ipv4") != 0 && | ||
g_ascii_strcasecmp(scalar(node), "ipv6") != 0 && | ||
g_ascii_strcasecmp(scalar(node), "both") != 0 && | ||
g_ascii_strcasecmp(scalar(node), "none") != 0) { | ||
return yaml_error(npp, node, error, "invalid duplicate-address-detection value '%s'", scalar(node)); | ||
} | ||
return handle_generic_str(npp, node, npp->current.addr_options, data, error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should rather store this in a typedef enum {
NETPLAN_DAD_UNSET = 0,
NETPLAN_DAD_BOTH = 1<<0,
NETPLAN_DAD_NONE = 1<<1,
NETPLAN_DAD_IPV4LL = 1<<2,
NETPLAN_DAD_IPV4 = 1<<3,
NETPLAN_DAD_IPV6 = 1<<4,
NETPLAN_DAD_MAX_,
} NetplanDadFlag; The current (networkd) default could then be reflected as More flags could be added as needed in the future and the backend renderers (networkd.c / nm.c) would be able to handle only the flags that they actually understand individually, writing out the corresponding per-address or per-connection settings. |
||
} | ||
|
||
const mapping_entry_handler address_option_handlers[] = { | ||
{"lifetime", YAML_SCALAR_NODE, {.generic=handle_address_option_lifetime}, addr_option_offset(lifetime)}, | ||
{"label", YAML_SCALAR_NODE, {.generic=handle_address_option_label}, addr_option_offset(label)}, | ||
{"duplicate-address-detection", YAML_SCALAR_NODE, {.generic=handle_address_option_duplicate_address_detection}, addr_option_offset(duplicate_address_detection)}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this setting should move to For network-manager, we can only control it on a per
Also, when defining it directly on a IPv4 address only |
||
{NULL} | ||
}; | ||
|
||
|
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.
I like the
duplicate-address-detection
naming. There's also the notion of "IPv4 Address Conflict Detection" (ACD) [RFC 5227], but I have the impression that "Duplicate Address Detection" (DAD) is used commonly across IPV4 & IPv6 these days.See