dhcpv4: move dhcpv4_fr_stop() up
authorDavid Härdeman <[email protected]>
Wed, 24 Sep 2025 13:20:26 +0000 (15:20 +0200)
committerÁlvaro Fernández Rojas <[email protected]>
Fri, 3 Oct 2025 10:53:50 +0000 (12:53 +0200)
Thus avoiding another forward declaration.

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

index 01da373805f985f9372b88d3dc839174e3d1710d..f7d93c4931d7e051bb0261a492fb89c0e53cb320 100644 (file)
@@ -42,7 +42,6 @@
 
 static bool addr_is_fr_ip(struct interface *iface, struct in_addr *addr);
 static void dhcpv4_fr_rand_delay(struct dhcp_assignment *a);
-static void dhcpv4_fr_stop(struct dhcp_assignment *a);
 static struct dhcp_assignment* dhcpv4_lease(struct interface *iface,
                enum dhcpv4_msg msg, const uint8_t *mac, const uint32_t reqaddr,
                uint32_t *leasetime, const char *hostname, const size_t hostname_len,
@@ -259,6 +258,14 @@ static void dhcpv4_fr_send(struct dhcp_assignment *a)
                        odhcpd_print_mac(a->hwaddr, sizeof(a->hwaddr)), inet_ntoa(dest.sin_addr));
 }
 
+static void dhcpv4_fr_stop(struct dhcp_assignment *a)
+{
+       uloop_timeout_cancel(&a->fr_timer);
+       decr_ref_cnt_ip(&a->fr_ip, a->iface);
+       a->fr_cnt = 0;
+       a->fr_timer.cb = NULL;
+}
+
 static void dhcpv4_fr_timer(struct uloop_timeout *event)
 {
        struct dhcp_assignment *a = container_of(event, struct dhcp_assignment, fr_timer);
@@ -302,14 +309,6 @@ static void dhcpv4_fr_rand_delay(struct dhcp_assignment *a)
        a->fr_timer.cb = dhcpv4_fr_delay_timer;
 }
 
-static void dhcpv4_fr_stop(struct dhcp_assignment *a)
-{
-       uloop_timeout_cancel(&a->fr_timer);
-       decr_ref_cnt_ip(&a->fr_ip, a->iface);
-       a->fr_cnt = 0;
-       a->fr_timer.cb = NULL;
-}
-
 static int dhcpv4_send_reply(const void *buf, size_t len,
                             const struct sockaddr *dest, socklen_t dest_len,
                             void *opaque)