aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpd.h
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-06-17 11:57:09 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-06-17 11:57:09 +0200
commit31af3d5a1dbc750d8646f948ce642e6ae57ce880 (patch)
tree37d72b13f986b1da25def340771b49be4dd3028b /networking/udhcp/dhcpd.h
parentac906fa85e61b4e34161709de777616f858bc945 (diff)
downloadbusybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.tar.gz
busybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.tar.bz2
busybox-w32-31af3d5a1dbc750d8646f948ce642e6ae57ce880.zip
udhcp: shorten mac len from 16 to 6 in lease file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/dhcpd.h')
-rw-r--r--networking/udhcp/dhcpd.h37
1 files changed, 20 insertions, 17 deletions
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index 53cfad41f..7776708cf 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -79,30 +79,33 @@ struct server_config_t {
79typedef uint32_t leasetime_t; 79typedef uint32_t leasetime_t;
80typedef int32_t signed_leasetime_t; 80typedef int32_t signed_leasetime_t;
81 81
82//TODO: (1) rename to dyn_lease (that's what it is. we also have static_lease). 82struct dyn_lease {
83//(2) lease_mac16 may be shortened to lease_mac[6], since e.g. ARP probing uses
84//only 6 first bytes anyway. We can check received dhcp packets
85//that their "chaddr"s have only 6 first bytes != 0, and complain otherwise.
86struct dhcpOfferedAddr {
87 uint8_t lease_mac16[16];
88 /* "nip": IP in network order */ 83 /* "nip": IP in network order */
89 uint32_t lease_nip;
90 /* Unix time when lease expires. Kept in memory in host order. 84 /* Unix time when lease expires. Kept in memory in host order.
91 * When written to file, converted to network order 85 * When written to file, converted to network order
92 * and adjusted (current time subtracted) */ 86 * and adjusted (current time subtracted) */
93 leasetime_t expires; 87 leasetime_t expires;
94 uint8_t hostname[20]; /* (size is a multiply of 4) */ 88 uint32_t lease_nip;
89 /* We use lease_mac[6], since e.g. ARP probing uses
90 * only 6 first bytes anyway. We check received dhcp packets
91 * that their hlen == 6 and thus chaddr has only 6 significant bytes
92 * (dhcp packet has chaddr[16])
93 */
94 uint8_t lease_mac[6];
95 uint8_t hostname[20];
96 uint8_t pad[2];
97 /* total size is a multiply of 4 */
95}; 98};
96 99
97extern struct dhcpOfferedAddr *leases; 100extern struct dyn_lease *leases;
98 101
99struct dhcpOfferedAddr *add_lease( 102struct dyn_lease *add_lease(
100 const uint8_t *chaddr, uint32_t yiaddr, 103 const uint8_t *chaddr, uint32_t yiaddr,
101 leasetime_t leasetime, uint8_t *hostname 104 leasetime_t leasetime, uint8_t *hostname
102 ) FAST_FUNC; 105 ) FAST_FUNC;
103int lease_expired(struct dhcpOfferedAddr *lease) FAST_FUNC; 106int lease_expired(struct dyn_lease *lease) FAST_FUNC;
104struct dhcpOfferedAddr *find_lease_by_chaddr(const uint8_t *chaddr) FAST_FUNC; 107struct dyn_lease *find_lease_by_chaddr(const uint8_t *chaddr) FAST_FUNC;
105struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr) FAST_FUNC; 108struct dyn_lease *find_lease_by_yiaddr(uint32_t yiaddr) FAST_FUNC;
106uint32_t find_free_or_expired_address(const uint8_t *chaddr) FAST_FUNC; 109uint32_t find_free_or_expired_address(const uint8_t *chaddr) FAST_FUNC;
107 110
108 111
@@ -121,10 +124,10 @@ void print_static_leases(struct static_lease **st_lease_pp) FAST_FUNC;
121 124
122/*** serverpacket.h ***/ 125/*** serverpacket.h ***/
123 126
124int send_offer(struct dhcpMessage *oldpacket) FAST_FUNC; 127int send_offer(struct dhcp_packet *oldpacket) FAST_FUNC;
125int send_NAK(struct dhcpMessage *oldpacket) FAST_FUNC; 128int send_NAK(struct dhcp_packet *oldpacket) FAST_FUNC;
126int send_ACK(struct dhcpMessage *oldpacket, uint32_t yiaddr) FAST_FUNC; 129int send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr) FAST_FUNC;
127int send_inform(struct dhcpMessage *oldpacket) FAST_FUNC; 130int send_inform(struct dhcp_packet *oldpacket) FAST_FUNC;
128 131
129 132
130/*** files.h ***/ 133/*** files.h ***/