diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-17 11:57:09 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-17 11:57:09 +0200 |
commit | 31af3d5a1dbc750d8646f948ce642e6ae57ce880 (patch) | |
tree | 37d72b13f986b1da25def340771b49be4dd3028b /networking/udhcp/dhcpd.h | |
parent | ac906fa85e61b4e34161709de777616f858bc945 (diff) | |
download | busybox-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.h | 37 |
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 { | |||
79 | typedef uint32_t leasetime_t; | 79 | typedef uint32_t leasetime_t; |
80 | typedef int32_t signed_leasetime_t; | 80 | typedef int32_t signed_leasetime_t; |
81 | 81 | ||
82 | //TODO: (1) rename to dyn_lease (that's what it is. we also have static_lease). | 82 | struct 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. | ||
86 | struct 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 | ||
97 | extern struct dhcpOfferedAddr *leases; | 100 | extern struct dyn_lease *leases; |
98 | 101 | ||
99 | struct dhcpOfferedAddr *add_lease( | 102 | struct 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; |
103 | int lease_expired(struct dhcpOfferedAddr *lease) FAST_FUNC; | 106 | int lease_expired(struct dyn_lease *lease) FAST_FUNC; |
104 | struct dhcpOfferedAddr *find_lease_by_chaddr(const uint8_t *chaddr) FAST_FUNC; | 107 | struct dyn_lease *find_lease_by_chaddr(const uint8_t *chaddr) FAST_FUNC; |
105 | struct dhcpOfferedAddr *find_lease_by_yiaddr(uint32_t yiaddr) FAST_FUNC; | 108 | struct dyn_lease *find_lease_by_yiaddr(uint32_t yiaddr) FAST_FUNC; |
106 | uint32_t find_free_or_expired_address(const uint8_t *chaddr) FAST_FUNC; | 109 | uint32_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 | ||
124 | int send_offer(struct dhcpMessage *oldpacket) FAST_FUNC; | 127 | int send_offer(struct dhcp_packet *oldpacket) FAST_FUNC; |
125 | int send_NAK(struct dhcpMessage *oldpacket) FAST_FUNC; | 128 | int send_NAK(struct dhcp_packet *oldpacket) FAST_FUNC; |
126 | int send_ACK(struct dhcpMessage *oldpacket, uint32_t yiaddr) FAST_FUNC; | 129 | int send_ACK(struct dhcp_packet *oldpacket, uint32_t yiaddr) FAST_FUNC; |
127 | int send_inform(struct dhcpMessage *oldpacket) FAST_FUNC; | 130 | int send_inform(struct dhcp_packet *oldpacket) FAST_FUNC; |
128 | 131 | ||
129 | 132 | ||
130 | /*** files.h ***/ | 133 | /*** files.h ***/ |