aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/udhcp/packet.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index c3890229f..22c18deaf 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -122,7 +122,7 @@ uint16_t udhcp_checksum(void *addr, int count)
122} 122}
123 123
124 124
125/* Construct a ip/udp header for a packet, and specify the source and dest hardware address */ 125/* Construct a ip/udp header for a packet, send packet */
126int udhcp_send_raw_packet(struct dhcpMessage *payload, 126int udhcp_send_raw_packet(struct dhcpMessage *payload,
127 uint32_t source_ip, int source_port, 127 uint32_t source_ip, int source_port,
128 uint32_t dest_ip, int dest_port, const uint8_t *dest_arp, int ifindex) 128 uint32_t dest_ip, int dest_port, const uint8_t *dest_arp, int ifindex)
@@ -175,6 +175,10 @@ int udhcp_send_raw_packet(struct dhcpMessage *payload,
175 packet.ip.ttl = IPDEFTTL; 175 packet.ip.ttl = IPDEFTTL;
176 packet.ip.check = udhcp_checksum(&packet.ip, sizeof(packet.ip)); 176 packet.ip.check = udhcp_checksum(&packet.ip, sizeof(packet.ip));
177 177
178 /* Currently we send full-sized DHCP packets (zero padded).
179 * If you need to change this: last byte of the packet is
180 * packet.data.options[end_option(packet.data.options)]
181 */
178 result = sendto(fd, &packet, IP_UPD_DHCP_SIZE, 0, (struct sockaddr *) &dest, sizeof(dest)); 182 result = sendto(fd, &packet, IP_UPD_DHCP_SIZE, 0, (struct sockaddr *) &dest, sizeof(dest));
179 if (result <= 0) { 183 if (result <= 0) {
180 bb_perror_msg("sendto"); 184 bb_perror_msg("sendto");
@@ -222,6 +226,7 @@ int udhcp_send_kernel_packet(struct dhcpMessage *payload,
222 return -1; 226 return -1;
223 } 227 }
224 228
229 /* Currently we send full-sized DHCP packets (see above) */
225 result = write(fd, payload, DHCP_SIZE); 230 result = write(fd, payload, DHCP_SIZE);
226 close(fd); 231 close(fd);
227 return result; 232 return result;