aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/packet.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-03-15 08:29:22 +0000
committerEric Andersen <andersen@codepoet.org>2004-03-15 08:29:22 +0000
commitc7bda1ce659294d6e22c06e087f6f265983c7578 (patch)
tree4c6d2217f4d8306c59cf1096f8664e1cfd167213 /networking/udhcp/packet.c
parent8854004b41065b3d081af7f3df13a100b0c8bfbe (diff)
downloadbusybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.gz
busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.tar.bz2
busybox-w32-c7bda1ce659294d6e22c06e087f6f265983c7578.zip
Remove trailing whitespace. Update copyright to include 2004.
Diffstat (limited to 'networking/udhcp/packet.c')
-rw-r--r--networking/udhcp/packet.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index a3c7ae153..7cbd83a35 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -66,7 +66,7 @@ int get_packet(struct dhcpMessage *packet, int fd)
66 return -2; 66 return -2;
67 } 67 }
68 DEBUG(LOG_INFO, "Received a packet"); 68 DEBUG(LOG_INFO, "Received a packet");
69 69
70 if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) { 70 if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) {
71 for (i = 0; broken_vendors[i][0]; i++) { 71 for (i = 0; broken_vendors[i][0]; i++) {
72 if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) && 72 if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) &&
@@ -77,7 +77,7 @@ int get_packet(struct dhcpMessage *packet, int fd)
77 } 77 }
78 } 78 }
79 } 79 }
80 80
81 81
82 return bytes; 82 return bytes;
83} 83}
@@ -126,10 +126,10 @@ int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
126 DEBUG(LOG_ERR, "socket call failed: %m"); 126 DEBUG(LOG_ERR, "socket call failed: %m");
127 return -1; 127 return -1;
128 } 128 }
129 129
130 memset(&dest, 0, sizeof(dest)); 130 memset(&dest, 0, sizeof(dest));
131 memset(&packet, 0, sizeof(packet)); 131 memset(&packet, 0, sizeof(packet));
132 132
133 dest.sll_family = AF_PACKET; 133 dest.sll_family = AF_PACKET;
134 dest.sll_protocol = htons(ETH_P_IP); 134 dest.sll_protocol = htons(ETH_P_IP);
135 dest.sll_ifindex = ifindex; 135 dest.sll_ifindex = ifindex;
@@ -150,7 +150,7 @@ int raw_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_port,
150 packet.ip.tot_len = packet.udp.len; 150 packet.ip.tot_len = packet.udp.len;
151 memcpy(&(packet.data), payload, sizeof(struct dhcpMessage)); 151 memcpy(&(packet.data), payload, sizeof(struct dhcpMessage));
152 packet.udp.check = checksum(&packet, sizeof(struct udp_dhcp_packet)); 152 packet.udp.check = checksum(&packet, sizeof(struct udp_dhcp_packet));
153 153
154 packet.ip.tot_len = htons(sizeof(struct udp_dhcp_packet)); 154 packet.ip.tot_len = htons(sizeof(struct udp_dhcp_packet));
155 packet.ip.ihl = sizeof(packet.ip) >> 2; 155 packet.ip.ihl = sizeof(packet.ip) >> 2;
156 packet.ip.version = IPVERSION; 156 packet.ip.version = IPVERSION;
@@ -173,10 +173,10 @@ int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_po
173 int n = 1; 173 int n = 1;
174 int fd, result; 174 int fd, result;
175 struct sockaddr_in client; 175 struct sockaddr_in client;
176 176
177 if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) 177 if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
178 return -1; 178 return -1;
179 179
180 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof(n)) == -1) 180 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof(n)) == -1)
181 return -1; 181 return -1;
182 182
@@ -191,7 +191,7 @@ int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_po
191 memset(&client, 0, sizeof(client)); 191 memset(&client, 0, sizeof(client));
192 client.sin_family = AF_INET; 192 client.sin_family = AF_INET;
193 client.sin_port = htons(dest_port); 193 client.sin_port = htons(dest_port);
194 client.sin_addr.s_addr = dest_ip; 194 client.sin_addr.s_addr = dest_ip;
195 195
196 if (connect(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1) 196 if (connect(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1)
197 return -1; 197 return -1;
@@ -199,4 +199,4 @@ int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int source_po
199 result = write(fd, payload, sizeof(struct dhcpMessage)); 199 result = write(fd, payload, sizeof(struct dhcpMessage));
200 close(fd); 200 close(fd);
201 return result; 201 return result;
202} 202}