config: fix erroneous clamp message if clamp value == max
authorPaul Donald <[email protected]>
Tue, 21 Oct 2025 13:46:29 +0000 (15:46 +0200)
committerÁlvaro Fernández Rojas <[email protected]>
Tue, 21 Oct 2025 17:20:47 +0000 (19:20 +0200)
If the clamp value is equal to and only equal to PD_MIN_LEN_MAX then the warn
is emitted, when it shouldn't be since PD_MIN_LEN_MAX is a valid max value.

Signed-off-by: Paul Donald <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/283
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/config.c

index d6573e2dc932e64fd20b7b1a08bb31c3022e86d4..ddc4537000a1ef541351194268dedb3555855754 100644 (file)
@@ -1304,7 +1304,7 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
                if (pd_min_len > PD_MIN_LEN_MAX)
                        iface->dhcpv6_pd_min_len = PD_MIN_LEN_MAX;
                iface->dhcpv6_pd_min_len = pd_min_len;
-               if (pd_min_len >= PD_MIN_LEN_MAX)
+               if (pd_min_len > PD_MIN_LEN_MAX)
                        warn("Clamped invalid %s value configured for interface '%s' to %d",
                             iface_attrs[IFACE_ATTR_DHCPV6_PD_MIN_LEN].name, iface->name, iface->dhcpv6_pd_min_len);
        }