diff options
Diffstat (limited to 'networking/udhcp/packet.c')
-rw-r--r-- | networking/udhcp/packet.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index 9e1b46d2f..fc2bb5416 100644 --- a/networking/udhcp/packet.c +++ b/networking/udhcp/packet.c | |||
@@ -41,7 +41,7 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet) | |||
41 | return; | 41 | return; |
42 | 42 | ||
43 | bb_error_msg( | 43 | bb_error_msg( |
44 | //"op %x" | 44 | //" op %x" |
45 | //" htype %x" | 45 | //" htype %x" |
46 | " hlen %x" | 46 | " hlen %x" |
47 | //" hops %x" | 47 | //" hops %x" |
@@ -52,7 +52,6 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet) | |||
52 | " yiaddr %x" | 52 | " yiaddr %x" |
53 | " siaddr %x" | 53 | " siaddr %x" |
54 | " giaddr %x" | 54 | " giaddr %x" |
55 | //" chaddr %s" | ||
56 | //" sname %s" | 55 | //" sname %s" |
57 | //" file %s" | 56 | //" file %s" |
58 | //" cookie %x" | 57 | //" cookie %x" |
@@ -68,14 +67,13 @@ void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet) | |||
68 | , packet->yiaddr | 67 | , packet->yiaddr |
69 | , packet->siaddr_nip | 68 | , packet->siaddr_nip |
70 | , packet->gateway_nip | 69 | , packet->gateway_nip |
71 | //, packet->chaddr[16] | ||
72 | //, packet->sname[64] | 70 | //, packet->sname[64] |
73 | //, packet->file[128] | 71 | //, packet->file[128] |
74 | //, packet->cookie | 72 | //, packet->cookie |
75 | //, packet->options[] | 73 | //, packet->options[] |
76 | ); | 74 | ); |
77 | *bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0'; | 75 | *bin2hex(buf, (void *) packet->chaddr, sizeof(packet->chaddr)) = '\0'; |
78 | bb_error_msg("chaddr %s", buf); | 76 | bb_error_msg(" chaddr %s", buf); |
79 | } | 77 | } |
80 | #endif | 78 | #endif |
81 | 79 | ||
@@ -129,6 +127,8 @@ int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt, | |||
129 | dest_sll.sll_family = AF_PACKET; | 127 | dest_sll.sll_family = AF_PACKET; |
130 | dest_sll.sll_protocol = htons(ETH_P_IP); | 128 | dest_sll.sll_protocol = htons(ETH_P_IP); |
131 | dest_sll.sll_ifindex = ifindex; | 129 | dest_sll.sll_ifindex = ifindex; |
130 | /*dest_sll.sll_hatype = ARPHRD_???;*/ | ||
131 | /*dest_sll.sll_pkttype = PACKET_???;*/ | ||
132 | dest_sll.sll_halen = 6; | 132 | dest_sll.sll_halen = 6; |
133 | memcpy(dest_sll.sll_addr, dest_arp, 6); | 133 | memcpy(dest_sll.sll_addr, dest_arp, 6); |
134 | 134 | ||
@@ -189,7 +189,8 @@ int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt, | |||
189 | /* Let the kernel do all the work for packet generation */ | 189 | /* Let the kernel do all the work for packet generation */ |
190 | int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, | 190 | int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, |
191 | uint32_t source_nip, int source_port, | 191 | uint32_t source_nip, int source_port, |
192 | uint32_t dest_nip, int dest_port) | 192 | uint32_t dest_nip, int dest_port, |
193 | int send_flags) | ||
193 | { | 194 | { |
194 | struct sockaddr_in sa; | 195 | struct sockaddr_in sa; |
195 | unsigned padding; | 196 | unsigned padding; |
@@ -226,8 +227,8 @@ int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, | |||
226 | padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); | 227 | padding = DHCP_OPTIONS_BUFSIZE - 1 - udhcp_end_option(dhcp_pkt->options); |
227 | if (padding > DHCP_SIZE - 300) | 228 | if (padding > DHCP_SIZE - 300) |
228 | padding = DHCP_SIZE - 300; | 229 | padding = DHCP_SIZE - 300; |
229 | result = safe_write(fd, dhcp_pkt, DHCP_SIZE - padding); | 230 | result = send(fd, dhcp_pkt, DHCP_SIZE - padding, send_flags); |
230 | msg = "write"; | 231 | msg = "send"; |
231 | ret_close: | 232 | ret_close: |
232 | close(fd); | 233 | close(fd); |
233 | if (result < 0) { | 234 | if (result < 0) { |