Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/networking/udhcp/packet.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/networking/udhcp/packet.c
r3232 r3621 39 39 return; 40 40 41 bb_ info_msg(42 //" 41 bb_error_msg( 42 //"op %x" 43 43 //" htype %x" 44 44 " hlen %x" … … 74 74 ); 75 75 *bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0'; 76 bb_ info_msg("chaddr %s", buf);76 bb_error_msg("chaddr %s", buf); 77 77 } 78 78 #endif … … 86 86 bytes = safe_read(fd, packet, sizeof(*packet)); 87 87 if (bytes < 0) { 88 log1(" Packet read error, ignoring");88 log1("packet read error, ignoring"); 89 89 return bytes; /* returns -1 */ 90 90 } … … 93 93 || packet->cookie != htonl(DHCP_MAGIC) 94 94 ) { 95 bb_ info_msg("Packet with bad magic, ignoring");95 bb_error_msg("packet with bad magic, ignoring"); 96 96 return -2; 97 97 } 98 log1(" Receiveda packet");98 log1("received %s", "a packet"); 99 99 udhcp_dump_packet(packet); 100 100 … … 144 144 * In order to work with those buggy servers, 145 145 * we truncate packets after end option byte. 146 * 147 * However, RFC 1542 says "The IP Total Length and UDP Length 148 * must be large enough to contain the minimal BOOTP header of 300 octets". 149 * Thus, we retain enough padding to not go below 300 BOOTP bytes. 150 * Some devices have filters which drop DHCP packets shorter than that. 146 151 */ 147 152 padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(packet.data.options); 153 if (padding > DHCP_SIZE - 300) 154 padding = DHCP_SIZE - 300; 148 155 149 156 packet.ip.protocol = IPPROTO_UDP; … … 216 223 udhcp_dump_packet(dhcp_pkt); 217 224 padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); 225 if (padding > DHCP_SIZE - 300) 226 padding = DHCP_SIZE - 300; 218 227 result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding); 219 228 msg = "write";
Note:
See TracChangeset
for help on using the changeset viewer.