aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/packet.c')
-rw-r--r--networking/udhcp/packet.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 2cd5f6176..911bd3b37 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -19,9 +19,9 @@
19#include "dhcpd.h" 19#include "dhcpd.h"
20#include "options.h" 20#include "options.h"
21 21
22void FAST_FUNC udhcp_init_header(struct dhcpMessage *packet, char type) 22void FAST_FUNC udhcp_init_header(struct dhcp_packet *packet, char type)
23{ 23{
24 memset(packet, 0, sizeof(struct dhcpMessage)); 24 memset(packet, 0, sizeof(struct dhcp_packet));
25 packet->op = BOOTREQUEST; /* if client to a server */ 25 packet->op = BOOTREQUEST; /* if client to a server */
26 switch (type) { 26 switch (type) {
27 case DHCPOFFER: 27 case DHCPOFFER:
@@ -37,7 +37,7 @@ void FAST_FUNC udhcp_init_header(struct dhcpMessage *packet, char type)
37} 37}
38 38
39#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1 39#if defined CONFIG_UDHCP_DEBUG && CONFIG_UDHCP_DEBUG >= 1
40void FAST_FUNC udhcp_dump_packet(struct dhcpMessage *packet) 40void FAST_FUNC udhcp_dump_packet(struct dhcp_packet *packet)
41{ 41{
42 char buf[sizeof(packet->chaddr)*2 + 1]; 42 char buf[sizeof(packet->chaddr)*2 + 1];
43 43
@@ -84,7 +84,7 @@ void FAST_FUNC udhcp_dump_packet(struct dhcpMessage *packet)
84#endif 84#endif
85 85
86/* Read a packet from socket fd, return -1 on read error, -2 on packet error */ 86/* Read a packet from socket fd, return -1 on read error, -2 on packet error */
87int FAST_FUNC udhcp_recv_kernel_packet(struct dhcpMessage *packet, int fd) 87int FAST_FUNC udhcp_recv_kernel_packet(struct dhcp_packet *packet, int fd)
88{ 88{
89 int bytes; 89 int bytes;
90 unsigned char *vendor; 90 unsigned char *vendor;
@@ -165,20 +165,20 @@ uint16_t FAST_FUNC udhcp_checksum(void *addr, int count)
165} 165}
166 166
167/* Construct a ip/udp header for a packet, send packet */ 167/* Construct a ip/udp header for a packet, send packet */
168int FAST_FUNC udhcp_send_raw_packet(struct dhcpMessage *dhcp_pkt, 168int FAST_FUNC udhcp_send_raw_packet(struct dhcp_packet *dhcp_pkt,
169 uint32_t source_ip, int source_port, 169 uint32_t source_ip, int source_port,
170 uint32_t dest_ip, int dest_port, const uint8_t *dest_arp, 170 uint32_t dest_ip, int dest_port, const uint8_t *dest_arp,
171 int ifindex) 171 int ifindex)
172{ 172{
173 struct sockaddr_ll dest; 173 struct sockaddr_ll dest;
174 struct udp_dhcp_packet packet; 174 struct ip_udp_dhcp_packet packet;
175 int fd; 175 int fd;
176 int result = -1; 176 int result = -1;
177 const char *msg; 177 const char *msg;
178 178
179 enum { 179 enum {
180 IP_UPD_DHCP_SIZE = sizeof(struct udp_dhcp_packet) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS, 180 IP_UPD_DHCP_SIZE = sizeof(struct ip_udp_dhcp_packet) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS,
181 UPD_DHCP_SIZE = IP_UPD_DHCP_SIZE - offsetof(struct udp_dhcp_packet, udp), 181 UPD_DHCP_SIZE = IP_UPD_DHCP_SIZE - offsetof(struct ip_udp_dhcp_packet, udp),
182 }; 182 };
183 183
184 fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP)); 184 fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP));
@@ -236,7 +236,7 @@ int FAST_FUNC udhcp_send_raw_packet(struct dhcpMessage *dhcp_pkt,
236} 236}
237 237
238/* Let the kernel do all the work for packet generation */ 238/* Let the kernel do all the work for packet generation */
239int FAST_FUNC udhcp_send_kernel_packet(struct dhcpMessage *dhcp_pkt, 239int FAST_FUNC udhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt,
240 uint32_t source_ip, int source_port, 240 uint32_t source_ip, int source_port,
241 uint32_t dest_ip, int dest_port) 241 uint32_t dest_ip, int dest_port)
242{ 242{
@@ -246,7 +246,7 @@ int FAST_FUNC udhcp_send_kernel_packet(struct dhcpMessage *dhcp_pkt,
246 const char *msg; 246 const char *msg;
247 247
248 enum { 248 enum {
249 DHCP_SIZE = sizeof(struct dhcpMessage) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS, 249 DHCP_SIZE = sizeof(struct dhcp_packet) - CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS,
250 }; 250 };
251 251
252 fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); 252 fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);