network-legacy: Change ip=any to mean dual stack DHCP - #2628
Open
chewi wants to merge 1 commit into
Open
Conversation
Member
Author
|
CC @dracut-ng/gentoo-maint @dracut-ng/opensuse-maint |
systemd-network-generator tries to support the same IP configuration syntax as Dracut. One difference is that Dracut supports multiple comma-separated autoconf values (e.g. `dhcp,dhcp6`) whereas systemd only permits one. Fixing this in systemd may not be straightforward. This matters because Afterburn can emit `dhcp,dhcp6` for KubeVirt, and it is now being adapted to support systemd-network-generator as well as Dracut's network-legacy module. Even if systemd-network-generator did support multiple values, the behaviour would not be the same. Both systemd-networkd and NetworkManager always try both IPv4 and IPv6, normally requiring just one of them to work, whereas network-legacy will not even try IPv6 if IPv4 works, or vice-versa depending on the order given. It is not currently possible to make network-legacy always try both. To workaround the lack of multi-value support in systemd and to mirror how systemd and NetworkManager behave, I am changing `ip=any` to always try both protocols, requiring just one to work. They are tried in parallel to avoid the cost of a double timeout. Despite the name, this is currently treated by network-legacy as IPv4-only. The history of ifup.sh reveals that `any` was supported before IPv6 was, and that IPv6 was initially added with "preliminary" support. Perhaps the author didn't want to change the behaviour of `any` until that support was better established and then forgot, or perhaps it was merely an oversight. systemd-network-generator also treats `ip=on` as dual stack, but that would be a more controversial change. Users may not expect IPv6 alone to be considered successful. NetworkManager even treats `ip=dhcp` as dual stack, but I feel that is wrong. With `ip=any`, the intent is clearer, and this at least gives us one option where the behaviour is consistent. Much of this change is adjusting the dhclient PID and lease paths to be protocol-specific so that IPv4 and IPv6 instances can be run simultaneously. There were no tests for explicit IP configuration at all, but I felt it was important to have this covered, so some have been added. To avoid unnecessary overhead, this spins up just one VM with several differently configured interfaces. The module changes were mostly written by me with a little help from AI. The tests were entirely written by AI. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
chewi
force-pushed
the
network-legacy-dual-stack
branch
from
August 20, 2026 16:32
e5cdf6b to
73830a0
Compare
Member
Author
|
I was a little slow to join the dots and realise that Fedora CoreOS now uses NetworkManager rather than network-legacy. With Flatcar migrating to systemd-network-generator, I could probably change this in Afterburn without impacting anybody. Still, I think the fix makes sense for those still using network-legacy in other contexts. |
Contributor
Same in openSUSE, the default is NetworkManager for some years now, and some people use systemd-networkd. The legacy network module is only still alive (for now) to facilitate maintenance, but I'd not add anything new to it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
systemd-network-generator tries to support the same IP configuration syntax as Dracut. One difference is that Dracut supports multiple comma-separated autoconf values (e.g.
dhcp,dhcp6) whereas systemd only permits one. Fixing this in systemd may not be straightforward.This matters because Afterburn can emit
dhcp,dhcp6for KubeVirt, and it is now being adapted to support systemd-network-generator as well as Dracut's network-legacy module.Even if systemd-network-generator did support multiple values, the behaviour would not be the same. Both systemd-networkd and NetworkManager always try both IPv4 and IPv6, normally requiring just one of them to work, whereas network-legacy will not even try IPv6 if IPv4 works, or vice-versa depending on the order given. It is not currently possible to make network-legacy always try both.
To workaround the lack of multi-value support in systemd and to mirror how systemd and NetworkManager behave, I am changing
ip=anyto always try both protocols, requiring just one to work. They are tried in parallel to avoid the cost of a double timeout. Despite the name, this is currently treated by network-legacy as IPv4-only. The history of ifup.sh reveals thatanywas supported before IPv6 was, and that IPv6 was initially added with "preliminary" support. Perhaps the author didn't want to change the behaviour ofanyuntil that support was better established and then forgot, or perhaps it was merely an oversight.systemd-network-generator also treats
ip=onas dual stack, but that would be a more controversial change. Users may not expect IPv6 alone to be considered successful. NetworkManager even treatsip=dhcpas dual stack, but I feel that is wrong. Withip=any, the intent is clearer, and this at least gives us one option where the behaviour is consistent.Much of this change is adjusting the dhclient PID and lease paths to be protocol-specific so that IPv4 and IPv6 instances can be run simultaneously.
There were no tests for explicit IP configuration at all, but I felt it was important to have this covered, so some have been added. To avoid unnecessary overhead, this spins up just one VM with several differently configured interfaces.
The module changes were mostly written by me with a little help from AI. The tests were entirely written by AI.
Checklist