dhcpd: remember and record hostnames; optimize get_option
dumpleases: show hostnames
function old new delta
add_lease 230 292 +62
send_offer 403 421 +18
send_ACK 232 249 +17
read_leases 249 258 +9
dumpleases_main 604 609 +5
nobody_responds_to_arp 84 86 +2
udhcp_end_option 32 30 -2
udhcp_get_option 222 171 -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/2 up/down: 113/-53) Total: 60 bytes
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index 02e392a..b4e1808 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -74,8 +74,6 @@
#define SERVER_PORT 67
#endif
-extern struct dhcpOfferedAddr *leases;
-
/*** leases.h ***/
@@ -92,9 +90,15 @@
* and optionally adjusted (current time subtracted)
* if server_config.remaining = 1 */
leasetime_t expires;
+ uint8_t hostname[20]; /* (size is a multiply of 4) */
};
-struct dhcpOfferedAddr *add_lease(const uint8_t *chaddr, uint32_t yiaddr, leasetime_t leasetime) FAST_FUNC;
+extern struct dhcpOfferedAddr *leases;
+
+struct dhcpOfferedAddr *add_lease(
+ const uint8_t *chaddr, uint32_t yiaddr,
+ leasetime_t leasetime, uint8_t *hostname
+ ) FAST_FUNC;
int lease_expired(struct dhcpOfferedAddr *lease) FAST_FUNC;
struct dhcpOfferedAddr *find_lease_by_chaddr(const uint8_t *chaddr) FAST_FUNC;
struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr) FAST_FUNC;