summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Härdeman2025-09-24 13:00:57 +0000
committerÁlvaro Fernández Rojas2025-10-03 10:53:36 +0000
commit0cf95c471d779cd3d4da661d31d53ec215e66d44 (patch)
tree20bcff1f72416c6cc94c19471683d0ef61151cd8
parent14a480dc9d26b917078c50af2bca87fbb843c29f (diff)
dhcpv4: move and rename handle_dhcpv4()
Move handle_dhcpv4() below the function it calls (dhcpv4_handle_msg()) and rename it to dhcpv4_handle_dgram() for consistency with other function names. Signed-off-by: David Härdeman <david@hardeman.nu> Link: https://github.com/openwrt/odhcpd/pull/264 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-rw-r--r--src/dhcpv4.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index b63104c..f52d815 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -325,15 +325,6 @@ static int dhcpv4_send_reply(const void *buf, size_t len,
return sendto(*sock, buf, len, MSG_DONTWAIT, dest, dest_len);
}
-/* Handler for DHCPv4 messages */
-static void handle_dhcpv4(void *addr, void *data, size_t len,
- struct interface *iface, _unused void *dest_addr)
-{
- int sock = iface->dhcpv4_event.uloop.fd;
-
- dhcpv4_handle_msg(addr, data, len, iface, dest_addr, dhcpv4_send_reply, &sock);
-}
-
/* DNR */
struct dhcpv4_dnr {
uint16_t len;
@@ -726,6 +717,15 @@ void dhcpv4_handle_msg(void *addr, void *data, size_t len,
#endif
}
+/* Handler for DHCPv4 messages */
+static void dhcpv4_handle_dgram(void *addr, void *data, size_t len,
+ struct interface *iface, _unused void *dest_addr)
+{
+ int sock = iface->dhcpv4_event.uloop.fd;
+
+ dhcpv4_handle_msg(addr, data, len, iface, dest_addr, dhcpv4_send_reply, &sock);
+}
+
static bool dhcpv4_insert_assignment(struct list_head *list, struct dhcp_assignment *a,
uint32_t addr)
{
@@ -1138,7 +1138,7 @@ int dhcpv4_setup_interface(struct interface *iface, bool enable)
goto out;
}
- iface->dhcpv4_event.handle_dgram = handle_dhcpv4;
+ iface->dhcpv4_event.handle_dgram = dhcpv4_handle_dgram;
odhcpd_register(&iface->dhcpv4_event);
} else {
while (!list_empty(&iface->dhcpv4_assignments))