Fix NM byte switch for ipv6 nameserver (#2342)

* Fix NM byte switch for ipv6 nameserver

* remove not needed code
This commit is contained in:
Pascal Vizeli 2020-12-04 17:55:26 +01:00 committed by GitHub
parent 7a51c828c2
commit 792bc610a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -32,7 +32,9 @@ def interface_update_payload(
def ipv6_to_byte(ip_address: IPv6Address) -> str:
"""Convert an ipv6 to an byte array."""
return f'[byte {", ".join("0x{:02x}".format(val) for val in reversed(ip_address.packed))}]'
return (
f'[byte {", ".join("0x{:02x}".format(val) for val in ip_address.packed)}]'
)
# Init template
env.filters["ipv4_to_int"] = ipv4_to_int

View File

@ -115,6 +115,7 @@ async def test_interface_update_payload_ethernet_ipv6(coresys):
interface.ipv6.nameservers = [
ip_address("2606:4700:4700::64"),
ip_address("2606:4700:4700::6400"),
ip_address("2606:4700:4700::1111"),
]
interface.ipv6.gateway = ip_address("fe80::da58:d7ff:fe00:9c69")
@ -130,8 +131,9 @@ async def test_interface_update_payload_ethernet_ipv6(coresys):
)
assert DBus.parse_gvariant(data)["ipv6"]["address-data"][0]["prefix"] == 64
assert DBus.parse_gvariant(data)["ipv6"]["dns"] == [
[100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 71, 6, 38],
[0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 71, 6, 38],
[38, 6, 71, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100],
[38, 6, 71, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0],
[38, 6, 71, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17],
]
assert (
DBus.parse_gvariant(data)["connection"]["uuid"] == inet.settings.connection.uuid