diff options
Diffstat (limited to 'networking/udhcp/clientpacket.c')
-rw-r--r-- | networking/udhcp/clientpacket.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index e7eeb58b1..4a5c627f4 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c | |||
@@ -171,7 +171,7 @@ int get_raw_packet(struct dhcpMessage *payload, int fd) | |||
171 | bytes = read(fd, &packet, sizeof(struct udp_dhcp_packet)); | 171 | bytes = read(fd, &packet, sizeof(struct udp_dhcp_packet)); |
172 | if (bytes < 0) { | 172 | if (bytes < 0) { |
173 | DEBUG("Cannot read on raw listening socket - ignoring"); | 173 | DEBUG("Cannot read on raw listening socket - ignoring"); |
174 | usleep(500000); /* possible down interface, looping condition */ | 174 | sleep(1); /* possible down interface, looping condition */ |
175 | return -1; | 175 | return -1; |
176 | } | 176 | } |
177 | 177 | ||
@@ -190,7 +190,7 @@ int get_raw_packet(struct dhcpMessage *payload, int fd) | |||
190 | 190 | ||
191 | /* Make sure its the right packet for us, and that it passes sanity checks */ | 191 | /* Make sure its the right packet for us, and that it passes sanity checks */ |
192 | if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION | 192 | if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION |
193 | || packet.ip.ihl != sizeof(packet.ip) >> 2 | 193 | || packet.ip.ihl != (sizeof(packet.ip) >> 2) |
194 | || packet.udp.dest != htons(CLIENT_PORT) | 194 | || packet.udp.dest != htons(CLIENT_PORT) |
195 | || bytes > (int) sizeof(struct udp_dhcp_packet) | 195 | || bytes > (int) sizeof(struct udp_dhcp_packet) |
196 | || ntohs(packet.udp.len) != (uint16_t)(bytes - sizeof(packet.ip)) | 196 | || ntohs(packet.udp.len) != (uint16_t)(bytes - sizeof(packet.ip)) |
@@ -207,7 +207,7 @@ int get_raw_packet(struct dhcpMessage *payload, int fd) | |||
207 | return -1; | 207 | return -1; |
208 | } | 208 | } |
209 | 209 | ||
210 | /* verify the UDP checksum by replacing the header with a psuedo header */ | 210 | /* verify the UDP checksum by replacing the header with a pseudo header */ |
211 | source = packet.ip.saddr; | 211 | source = packet.ip.saddr; |
212 | dest = packet.ip.daddr; | 212 | dest = packet.ip.daddr; |
213 | check = packet.udp.check; | 213 | check = packet.udp.check; |
@@ -225,7 +225,7 @@ int get_raw_packet(struct dhcpMessage *payload, int fd) | |||
225 | 225 | ||
226 | memcpy(payload, &(packet.data), bytes - (sizeof(packet.ip) + sizeof(packet.udp))); | 226 | memcpy(payload, &(packet.data), bytes - (sizeof(packet.ip) + sizeof(packet.udp))); |
227 | 227 | ||
228 | if (ntohl(payload->cookie) != DHCP_MAGIC) { | 228 | if (payload->cookie != htonl(DHCP_MAGIC)) { |
229 | bb_error_msg("received bogus message (bad magic) - ignoring"); | 229 | bb_error_msg("received bogus message (bad magic) - ignoring"); |
230 | return -2; | 230 | return -2; |
231 | } | 231 | } |