From d558ad2d76c1186b83b424f8170546290cc3b265 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 11 Nov 2020 18:23:04 +0100 Subject: [PATCH] Use technology neutral "auto" instead of "dhcp" for autoconfiguration (#2241) * Use technology neutral "auto" instead of "dhcp" for autoconfiguration IPv6 is often run with SLAAC which does not use a DHCP server but still does automatic address configuration. Follow wording of NetworkManager and use "auto" instead. * Use "auto" also in interface_update.tmpl * Update interface_update.tmpl * remove newline Co-authored-by: Pascal Vizeli Co-authored-by: Pascal Vizeli --- supervisor/api/network.py | 4 ++-- supervisor/dbus/payloads/interface_update.tmpl | 4 ++-- supervisor/host/const.py | 2 +- supervisor/host/network.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/supervisor/api/network.py b/supervisor/api/network.py index 345c5b09a..65553f358 100644 --- a/supervisor/api/network.py +++ b/supervisor/api/network.py @@ -234,7 +234,7 @@ class APINetwork(CoreSysAttributes): ipv4_config = None if ATTR_IPV4 in body: ipv4_config = IpConfig( - body[ATTR_IPV4].get(ATTR_METHOD, InterfaceMethod.DHCP), + body[ATTR_IPV4].get(ATTR_METHOD, InterfaceMethod.AUTO), body[ATTR_IPV4].get(ATTR_ADDRESS, []), body[ATTR_IPV4].get(ATTR_GATEWAY, None), body[ATTR_IPV4].get(ATTR_NAMESERVERS, []), @@ -243,7 +243,7 @@ class APINetwork(CoreSysAttributes): ipv6_config = None if ATTR_IPV6 in body: ipv6_config = IpConfig( - body[ATTR_IPV6].get(ATTR_METHOD, InterfaceMethod.DHCP), + body[ATTR_IPV6].get(ATTR_METHOD, InterfaceMethod.AUTO), body[ATTR_IPV6].get(ATTR_ADDRESS, []), body[ATTR_IPV6].get(ATTR_GATEWAY, None), body[ATTR_IPV6].get(ATTR_NAMESERVERS, []), diff --git a/supervisor/dbus/payloads/interface_update.tmpl b/supervisor/dbus/payloads/interface_update.tmpl index 539de2ea0..7b1758503 100644 --- a/supervisor/dbus/payloads/interface_update.tmpl +++ b/supervisor/dbus/payloads/interface_update.tmpl @@ -13,7 +13,7 @@ , 'ipv4': { -{% if interface.ipv4.method == "dhcp" %} +{% if interface.ipv4.method == "auto" %} 'method': <'auto'> {% elif interface.ipv4.method == "disable" %} 'method': <'disabled'> @@ -36,7 +36,7 @@ , 'ipv6': { -{% if interface.ipv6.method == "dhcp" %} +{% if interface.ipv6.method == "auto" %} 'method': <'auto'> {% elif interface.ipv6.method == "disable" %} 'method': <'disabled'> diff --git a/supervisor/host/const.py b/supervisor/host/const.py index 81eda44fb..d8762c380 100644 --- a/supervisor/host/const.py +++ b/supervisor/host/const.py @@ -7,7 +7,7 @@ class InterfaceMethod(str, Enum): DISABLED = "disabled" STATIC = "static" - DHCP = "dhcp" + AUTO = "auto" class InterfaceType(str, Enum): diff --git a/supervisor/host/network.py b/supervisor/host/network.py index a0313e5c2..c19ba608a 100644 --- a/supervisor/host/network.py +++ b/supervisor/host/network.py @@ -264,7 +264,7 @@ class Interface: def _map_nm_method(method: str) -> InterfaceMethod: """Map IP interface method.""" mapping = { - NMInterfaceMethod.AUTO: InterfaceMethod.DHCP, + NMInterfaceMethod.AUTO: InterfaceMethod.AUTO, NMInterfaceMethod.DISABLED: InterfaceMethod.DISABLED, NMInterfaceMethod.MANUAL: InterfaceMethod.STATIC, }