From 918353dcc77b5e9a8333153d3d79ecfc2fc45944 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 2 Nov 2025 14:07:26 +0100 Subject: [PATCH] confd: drop 'enabled' node from IPv4 autoconf container Neither the IPv6 autonconf container, nor the recently moved DHCP client container have an 'enabled' flag. Signed-off-by: Joachim Wiberg --- doc/ChangeLog.md | 2 ++ doc/networking.md | 17 ++++++------ src/confd/bin/gen-interfaces | 14 +++++++--- .../migrate/1.6/20-autoconf-to-presence.sh | 26 +++++++++++++++++++ src/confd/share/migrate/1.6/Makefile.am | 3 ++- src/confd/src/ietf-ip.c | 7 +++-- src/confd/yang/confd.inc | 2 +- src/confd/yang/confd/infix-ip.yang | 10 +++---- ...24-09-16.yang => infix-ip@2025-11-02.yang} | 0 .../ietf_interfaces/ipv4_autoconf/test.py | 7 ++--- test/case/use_case/ospf_container/test.py | 1 - 11 files changed, 60 insertions(+), 29 deletions(-) create mode 100755 src/confd/share/migrate/1.6/20-autoconf-to-presence.sh rename src/confd/yang/confd/{infix-ip@2024-09-16.yang => infix-ip@2025-11-02.yang} (100%) diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index 3c92e573..9a006a10 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -12,6 +12,8 @@ All notable changes to the project are documented in this file. to `/interfaces/interface[name]/ipv4/infix-dhcp-client:dhcp`, issue #1109. The configuration is automatically migrated on upgrade. The DHCP client is now enabled using a presence container instead of a separate `enabled` leaf +- The `enabled` nore for IPv4 autoconf (ZeroConf) has been dropped, `autoconf` + is now a presence container. Configuration automatically migrated on upgrade - Improvements to `sdcard.img` generation, useful for developers mostly: - The NanoPi R2S bootloader is now automatically built and uploaded to the [`latest-boot` release][lastest-boot] tag diff --git a/doc/networking.md b/doc/networking.md index ec7e4ad6..64e0d7d5 100644 --- a/doc/networking.md +++ b/doc/networking.md @@ -996,7 +996,7 @@ default. admin@example:/> configure admin@example:/config/> edit interface eth0 ipv4 admin@example:/config/interface/eth0/ipv4/> set address 10.0.1.1 prefix-length 24 - admin@example:/config/interface/eth0/ipv4/> set autoconf enabled true + admin@example:/config/interface/eth0/ipv4/> set autoconf admin@example:/config/interface/eth0/ipv4/> diff +interfaces { + interface eth0 { @@ -1004,9 +1004,7 @@ default. + address 10.0.1.1 { + prefix-length 24; + } - + autoconf { - + enabled true; - + } + + autoconf; + } + } +} @@ -1022,15 +1020,18 @@ default. ipv6 ::1/128 (static) admin@example:/> -As shown, the link-local IPv4 address is configured with `set autconf -enabled true`. The resulting address (169.254.1.3/16) is of type -*random* ([ietf-ip.yang][2]). +As shown, the link-local IPv4 address is configured with `set autoconf`. +The presence of the `autoconf` container enables IPv4 link-local address +assignment. The resulting address (169.254.1.3/16) is of type *random* +([ietf-ip.yang][2]). The IPv4LL client also supports a `request-address` setting which can be used to "seed" the client's starting address. If the address is free it will be used, otherwise it falls back to the default algorithm. - admin@example:/config/interface/eth0/ipv4/> set autoconf request-address 169.254.1.2 + admin@example:/config/interface/eth0/ipv4/> edit autoconf + admin@example:/config/interface/eth0/ipv4/autoconf/> set request-address 169.254.1.2 + admin@example:/config/interface/eth0/ipv4/autoconf/> leave #### Use of DHCP for IPv4 address assignment diff --git a/src/confd/bin/gen-interfaces b/src/confd/bin/gen-interfaces index e84feeae..19d34385 100755 --- a/src/confd/bin/gen-interfaces +++ b/src/confd/bin/gen-interfaces @@ -169,14 +169,20 @@ if [ -n "$bridge" ]; then "name": "$bridge", "type": "infix-if-type:bridge", "ietf-ip:ipv4": { - "infix-ip:autoconf": { - "enabled": $ipv4 - } EOF - if [ "$dhcp" = "true" ]; then + if [ "$ipv4" = "true" ]; then cat < "$temp" && mv "$temp" "$file" diff --git a/src/confd/share/migrate/1.6/Makefile.am b/src/confd/share/migrate/1.6/Makefile.am index 87a472ed..c3a250a5 100644 --- a/src/confd/share/migrate/1.6/Makefile.am +++ b/src/confd/share/migrate/1.6/Makefile.am @@ -1,2 +1,3 @@ migratedir = $(pkgdatadir)/migrate/1.6 -dist_migrate_DATA = 10-dhcp-client-to-ipv4.sh +dist_migrate_DATA = 10-dhcp-client-to-ipv4.sh \ + 20-autoconf-to-presence.sh diff --git a/src/confd/src/ietf-ip.c b/src/confd/src/ietf-ip.c index a428967b..adcf9cb8 100644 --- a/src/confd/src/ietf-ip.c +++ b/src/confd/src/ietf-ip.c @@ -94,7 +94,7 @@ int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif, * for various reasons: was bridge port, ipv4 was disabled... */ zcip = lydx_get_child(ipconf, "autoconf"); - if (zcip && lydx_is_enabled(zcip, "enabled")) { + if (zcip) { struct lyd_node *node; const char *addr; int diff = 0; @@ -105,9 +105,8 @@ int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif, if (node) { const struct lyd_node *tmp; - tmp = lydx_get_child(node, "enabled"); - if (tmp) - diff++; + /* presence container created or deleted */ + diff++; tmp = lydx_get_child(node, "request-address"); if (tmp) diff++; diff --git a/src/confd/yang/confd.inc b/src/confd/yang/confd.inc index 9685fade..cb005656 100644 --- a/src/confd/yang/confd.inc +++ b/src/confd/yang/confd.inc @@ -20,7 +20,7 @@ MODULES=( "ietf-hardware@2018-03-13.yang -e hardware-state -e hardware-sensor" "infix-hardware@2025-10-30.yang" "ieee802-dot1q-types@2022-10-29.yang" - "infix-ip@2024-09-16.yang" + "infix-ip@2025-11-02.yang" "infix-if-type@2025-02-12.yang" "infix-routing@2024-11-27.yang" "ieee802-dot1ab-lldp@2022-03-15.yang" diff --git a/src/confd/yang/confd/infix-ip.yang b/src/confd/yang/confd/infix-ip.yang index 88a1c93f..094a972a 100644 --- a/src/confd/yang/confd/infix-ip.yang +++ b/src/confd/yang/confd/infix-ip.yang @@ -18,6 +18,10 @@ module infix-ip { description "This module augments ietf-ip with Infix extensions and deviations."; + revision 2025-11-02 { + description "Change autoconf to presence container, removing enabled leaf."; + reference "Internal, issue #1109."; + } revision 2024-09-16 { description "Add support for IPv4LL request-address."; reference "Internal."; @@ -36,14 +40,10 @@ module infix-ip { */ augment "/if:interfaces/if:interface/ip:ipv4" { container autoconf { + presence "Enable IPv4 link-local address autoconfiguration for this interface."; description "Parameters to control the autoconfiguration of IPv4 address."; reference "RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses"; - leaf enabled { - description "Use a ZeroConf/IPv4LL agent to retrieve an 169.254/16 address."; - type boolean; - } - leaf request-address { description "Try to acquire the specified IP address, if available. diff --git a/src/confd/yang/confd/infix-ip@2024-09-16.yang b/src/confd/yang/confd/infix-ip@2025-11-02.yang similarity index 100% rename from src/confd/yang/confd/infix-ip@2024-09-16.yang rename to src/confd/yang/confd/infix-ip@2025-11-02.yang diff --git a/test/case/ietf_interfaces/ipv4_autoconf/test.py b/test/case/ietf_interfaces/ipv4_autoconf/test.py index a1e59f70..5555758a 100755 --- a/test/case/ietf_interfaces/ipv4_autoconf/test.py +++ b/test/case/ietf_interfaces/ipv4_autoconf/test.py @@ -57,9 +57,7 @@ with infamy.Test() as test: "name": tport, "enabled": True, "ipv4": { - "autoconf": { - "enabled": True - } + "infix-ip:autoconf": {} } } ] @@ -79,8 +77,7 @@ with infamy.Test() as test: "name": tport, "enabled": True, "ipv4": { - "autoconf": { - "enabled": True, + "infix-ip:autoconf": { "request-address": "169.254.42.42" } } diff --git a/test/case/use_case/ospf_container/test.py b/test/case/use_case/ospf_container/test.py index 1568f8d9..1ae865e9 100755 --- a/test/case/use_case/ospf_container/test.py +++ b/test/case/use_case/ospf_container/test.py @@ -212,7 +212,6 @@ table ip nat { "enabled": True, "forwarding": True, "infix-ip:autoconf": { - "enabled": True, "request-address": "169.254.1.1" } },