diff options
| author | David Härdeman | 2025-09-24 13:38:12 +0000 |
|---|---|---|
| committer | Álvaro Fernández Rojas | 2025-10-03 10:54:06 +0000 |
| commit | bdaffc2e76830c35733781ed7319b80b4d0a08a6 (patch) | |
| tree | 64c4720e4056b9b1596ea217eb0a77e6644c5ebd | |
| parent | 057e238b09343c507a74c4d4f3d0b55198cf8f35 (diff) | |
dhcpv4: move find_assignment_by_hwaddr()
Move find_assignment_by_hwaddr() down to just before the sole user
(dhcpv4_lease()).
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.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c index 2c6416b..a09c460 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -50,17 +50,6 @@ struct odhcpd_ref_ip { struct odhcpd_ipaddr addr; }; -static struct dhcp_assignment *find_assignment_by_hwaddr(struct interface *iface, const uint8_t *hwaddr) -{ - struct dhcp_assignment *a; - - list_for_each_entry(a, &iface->dhcpv4_assignments, head) - if (!memcmp(a->hwaddr, hwaddr, 6)) - return a; - - return NULL; -} - static void inc_ref_cnt_ip(struct odhcpd_ref_ip **ptr, struct odhcpd_ref_ip *ip) { *ptr = ip; @@ -400,6 +389,16 @@ static bool dhcpv4_assign(struct interface *iface, struct dhcp_assignment *a, return false; } +static struct dhcp_assignment *find_assignment_by_hwaddr(struct interface *iface, const uint8_t *hwaddr) +{ + struct dhcp_assignment *a; + + list_for_each_entry(a, &iface->dhcpv4_assignments, head) + if (!memcmp(a->hwaddr, hwaddr, 6)) + return a; + + return NULL; +} static struct dhcp_assignment* dhcpv4_lease(struct interface *iface, enum dhcpv4_msg msg, const uint8_t *mac, |