Repository navigation
Conversation
Proxmox VE (configdrive2) writes the IPv6 settings of an interface as a
separate stanza after the IPv4 one:
iface eth0 inet static
address 192.0.2.10
...
iface eth0 inet6 static
address 2001:db8:10::10
...
_get_iface_blocks() starts a new block on every iface line, so this
yields two NetworkDetails named eth0. Both resolve to the same MAC and
NetworkConfigPlugin keeps only the last one per MAC, so the IPv4
address, netmask and gateway are never configured.
When an inet6 stanza has the same name as the current static inet
stanza, feed its lines into the v6 half of that block, where V6_PROXY
already maps address, netmask and gateway to their v6 fields. inet6
stanzas of other interfaces (or after a non static inet stanza) still
start their own block, as before.
Signed-off-by: luxend <luxend@instantnode.eu>
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.
Problem
Proxmox VE configdrive2 writes the IPv6 settings of an interface as a separate stanza after the IPv4 one (configdrive2_network):
With both
ip=andip6=set on a VM, Windows guests only get the IPv6 address. IPv4 is never configured.Cause
debiface.py#L80-L87: everyifaceline starts a new block.crt_lines = lines6is overwritten bycrt_lines = linesa few lines later, so the inet6 stanza becomes a secondNetworkDetailsnamedeth0with the IPv6 data in the IPv4 fields.networkconfig.py#L131-L134: both entries resolve to the same MAC andmacnics[nic.mac]keeps only the last one, so the IPv4 settings are dropped.Fix
When an inet6 stanza has the same name as the current static inet stanza, its lines go into the v6 half of that block.
V6_PROXYalready mapsaddress,netmaskandgatewaytoaddress6,netmask6andgateway6.Everything else works as before. That covers inet6 stanzas of other interfaces (the existing
eth2fixture) and inet6 stanzas that follow a non-static inet stanza (ip=dhcp,ip6=...). Merging those would make_preprocess_nicsderive a truncated IPv4 address from the IPv6 one.Tests
test_parse_inet6_stanza_same_ifaceincloudbaseinit/tests/utils/test_debiface.py, using a sample in the exact shape of the Proxmox generator:lowithdns_nameservers/dns_search,eth0inet + inet6 static,eth1inet dhcp + inet6 static. It fails on master (twoeth0entries) and passes with this change.test_debiface,test_networkconfig,test_baseopenstackserviceandtest_nocloudserviceall pass, and flake8 with hacking 6.1.0 is clean.NetworkConfigPluginwith mocked osutils on the sample: master callsset_static_network_configfor eth0 only with the IPv6 address. With this change it is called with the IPv4 address and then with the IPv6 address.