dhcpv4: define val where it is used in dhcpv4_setup_interface()
authorDavid Härdeman <[email protected]>
Fri, 17 Oct 2025 11:59:37 +0000 (13:59 +0200)
committerÁlvaro Fernández Rojas <[email protected]>
Sun, 23 Nov 2025 19:05:03 +0000 (20:05 +0100)
This makes it a tiny bit easier to see immediately what "val" is.

Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/318
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/dhcpv4.c

index 5d49b76a9a3852a0be68dfd2f397aa73659769bc..43ee21c0eb700b7132cca23593fb2329ed15bceb 100644 (file)
@@ -1442,7 +1442,7 @@ bool dhcpv4_setup_interface(struct interface *iface, bool enable)
                .sin_port = htons(DHCPV4_SERVER_PORT),
                .sin_addr = { INADDR_ANY },
        };
-       int val = 1;
+       int val;
        int fd;
 
        if (iface->dhcpv4_event.uloop.fd >= 0) {
@@ -1465,7 +1465,7 @@ bool dhcpv4_setup_interface(struct interface *iface, bool enable)
                goto error;
        }
 
-       /* Basic IPv4 configuration */
+       val = 1;
        if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
                error("setsockopt(SO_REUSEADDR): %m");
                goto error;