summaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-10-20 13:28:22 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-10-20 13:28:22 +0000
commite1a0d486e4804eae098571f1a6788394c2ee51ae (patch)
treec6f3435738900c8d53832eb919b1b2c3d524f2e5 /networking/udhcp
parentdd2982882bb192ea757f32514bc2ea0bc96f5ba0 (diff)
downloadbusybox-w32-e1a0d486e4804eae098571f1a6788394c2ee51ae.tar.gz
busybox-w32-e1a0d486e4804eae098571f1a6788394c2ee51ae.tar.bz2
busybox-w32-e1a0d486e4804eae098571f1a6788394c2ee51ae.zip
message string changes, mostly for consistency, also -32 bytes in .rodata
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/arpping.c2
-rw-r--r--networking/udhcp/clientpacket.c4
-rw-r--r--networking/udhcp/common.c2
-rw-r--r--networking/udhcp/files.c10
-rw-r--r--networking/udhcp/options.c8
-rw-r--r--networking/udhcp/packet.c4
-rw-r--r--networking/udhcp/pidfile.c9
-rw-r--r--networking/udhcp/serverpacket.c4
8 files changed, 20 insertions, 23 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index 086692082..2716a28c6 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -81,7 +81,7 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
81 FD_SET(s, &fdset); 81 FD_SET(s, &fdset);
82 tm.tv_sec = timeout; 82 tm.tv_sec = timeout;
83 if (select(s + 1, &fdset, (fd_set *) NULL, (fd_set *) NULL, &tm) < 0) { 83 if (select(s + 1, &fdset, (fd_set *) NULL, (fd_set *) NULL, &tm) < 0) {
84 bb_perror_msg("Error on ARPING request"); 84 bb_perror_msg("error on ARPING request");
85 if (errno != EINTR) rv = 0; 85 if (errno != EINTR) rv = 0;
86 } else if (FD_ISSET(s, &fdset)) { 86 } else if (FD_ISSET(s, &fdset)) {
87 if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0; 87 if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0;
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c
index 439aa0250..58b26c171 100644
--- a/networking/udhcp/clientpacket.c
+++ b/networking/udhcp/clientpacket.c
@@ -216,14 +216,14 @@ int get_raw_packet(struct dhcpMessage *payload, int fd)
216 packet.ip.daddr = dest; 216 packet.ip.daddr = dest;
217 packet.ip.tot_len = packet.udp.len; /* cheat on the psuedo-header */ 217 packet.ip.tot_len = packet.udp.len; /* cheat on the psuedo-header */
218 if (check && check != udhcp_checksum(&packet, bytes)) { 218 if (check && check != udhcp_checksum(&packet, bytes)) {
219 bb_error_msg("Packet with bad UDP checksum received, ignoring"); 219 bb_error_msg("packet with bad UDP checksum received, ignoring");
220 return -2; 220 return -2;
221 } 221 }
222 222
223 memcpy(payload, &(packet.data), bytes - (sizeof(packet.ip) + sizeof(packet.udp))); 223 memcpy(payload, &(packet.data), bytes - (sizeof(packet.ip) + sizeof(packet.udp)));
224 224
225 if (ntohl(payload->cookie) != DHCP_MAGIC) { 225 if (ntohl(payload->cookie) != DHCP_MAGIC) {
226 bb_error_msg("Received bogus message (bad magic) - ignoring"); 226 bb_error_msg("received bogus message (bad magic) - ignoring");
227 return -2; 227 return -2;
228 } 228 }
229 DEBUG("oooooh!!! got some!"); 229 DEBUG("oooooh!!! got some!");
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index ca0c79b95..a0a21fdce 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -53,7 +53,7 @@ static inline void sanitize_fds(void)
53void udhcp_background(const char *pidfile) 53void udhcp_background(const char *pidfile)
54{ 54{
55#ifdef __uClinux__ 55#ifdef __uClinux__
56 bb_error_msg("Cannot background in uclinux (yet)"); 56 bb_error_msg("cannot background in uclinux (yet)");
57#else /* __uClinux__ */ 57#else /* __uClinux__ */
58 int pid_fd; 58 int pid_fd;
59 59
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 52d383869..36bcc31d9 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -284,7 +284,7 @@ int read_config(const char *file)
284 keywords[i].handler(keywords[i].def, keywords[i].var); 284 keywords[i].handler(keywords[i].def, keywords[i].var);
285 285
286 if (!(in = fopen(file, "r"))) { 286 if (!(in = fopen(file, "r"))) {
287 bb_error_msg("Unable to open config file: %s", file); 287 bb_error_msg("unable to open config file: %s", file);
288 return 0; 288 return 0;
289 } 289 }
290 290
@@ -308,7 +308,7 @@ int read_config(const char *file)
308 for (i = 0; keywords[i].keyword[0]; i++) 308 for (i = 0; keywords[i].keyword[0]; i++)
309 if (!strcasecmp(token, keywords[i].keyword)) 309 if (!strcasecmp(token, keywords[i].keyword))
310 if (!keywords[i].handler(line, keywords[i].var)) { 310 if (!keywords[i].handler(line, keywords[i].var)) {
311 bb_error_msg("Failure parsing line %d of %s", lm, file); 311 bb_error_msg("failure parsing line %d of %s", lm, file);
312 if (ENABLE_FEATURE_UDHCP_DEBUG) 312 if (ENABLE_FEATURE_UDHCP_DEBUG)
313 bb_error_msg("unable to parse '%s'", debug_orig); 313 bb_error_msg("unable to parse '%s'", debug_orig);
314 /* reset back to the default value */ 314 /* reset back to the default value */
@@ -329,7 +329,7 @@ void write_leases(void)
329 unsigned long tmp_time; 329 unsigned long tmp_time;
330 330
331 if (!(fp = fopen(server_config.lease_file, "w"))) { 331 if (!(fp = fopen(server_config.lease_file, "w"))) {
332 bb_error_msg("Unable to open %s for writing", server_config.lease_file); 332 bb_error_msg("unable to open %s for writing", server_config.lease_file);
333 return; 333 return;
334 } 334 }
335 335
@@ -367,7 +367,7 @@ void read_leases(const char *file)
367 struct dhcpOfferedAddr lease; 367 struct dhcpOfferedAddr lease;
368 368
369 if (!(fp = fopen(file, "r"))) { 369 if (!(fp = fopen(file, "r"))) {
370 bb_error_msg("Unable to open %s for reading", file); 370 bb_error_msg("unable to open %s for reading", file);
371 return; 371 return;
372 } 372 }
373 373
@@ -377,7 +377,7 @@ void read_leases(const char *file)
377 lease.expires = ntohl(lease.expires); 377 lease.expires = ntohl(lease.expires);
378 if (!server_config.remaining) lease.expires -= time(0); 378 if (!server_config.remaining) lease.expires -= time(0);
379 if (!(add_lease(lease.chaddr, lease.yiaddr, lease.expires))) { 379 if (!(add_lease(lease.chaddr, lease.yiaddr, lease.expires))) {
380 bb_error_msg("Too many leases while loading %s", file); 380 bb_error_msg("too many leases while loading %s", file);
381 break; 381 break;
382 } 382 }
383 i++; 383 i++;
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index 8dba2ef69..5cc08cca0 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -76,12 +76,12 @@ uint8_t *get_option(struct dhcpMessage *packet, int code)
76 length = 308; 76 length = 308;
77 while (!done) { 77 while (!done) {
78 if (i >= length) { 78 if (i >= length) {
79 bb_error_msg("Bogus packet, option fields too long"); 79 bb_error_msg("bogus packet, option fields too long");
80 return NULL; 80 return NULL;
81 } 81 }
82 if (optionptr[i + OPT_CODE] == code) { 82 if (optionptr[i + OPT_CODE] == code) {
83 if (i + 1 + optionptr[i + OPT_LEN] >= length) { 83 if (i + 1 + optionptr[i + OPT_LEN] >= length) {
84 bb_error_msg("Bogus packet, option fields too long"); 84 bb_error_msg("bogus packet, option fields too long");
85 return NULL; 85 return NULL;
86 } 86 }
87 return optionptr + i + 2; 87 return optionptr + i + 2;
@@ -92,7 +92,7 @@ uint8_t *get_option(struct dhcpMessage *packet, int code)
92 break; 92 break;
93 case DHCP_OPTION_OVER: 93 case DHCP_OPTION_OVER:
94 if (i + 1 + optionptr[i + OPT_LEN] >= length) { 94 if (i + 1 + optionptr[i + OPT_LEN] >= length) {
95 bb_error_msg("Bogus packet, option fields too long"); 95 bb_error_msg("bogus packet, option fields too long");
96 return NULL; 96 return NULL;
97 } 97 }
98 over = optionptr[i + 3]; 98 over = optionptr[i + 3];
@@ -140,7 +140,7 @@ int add_option_string(uint8_t *optionptr, uint8_t *string)
140 140
141 /* end position + string length + option code/length + end option */ 141 /* end position + string length + option code/length + end option */
142 if (end + string[OPT_LEN] + 2 + 1 >= 308) { 142 if (end + string[OPT_LEN] + 2 + 1 >= 308) {
143 bb_error_msg("Option 0x%02x did not fit into the packet", 143 bb_error_msg("option 0x%02x did not fit into the packet",
144 string[OPT_CODE]); 144 string[OPT_CODE]);
145 return 0; 145 return 0;
146 } 146 }
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 30675eaab..f12ecd6ec 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -58,12 +58,12 @@ int udhcp_get_packet(struct dhcpMessage *packet, int fd)
58 memset(packet, 0, sizeof(struct dhcpMessage)); 58 memset(packet, 0, sizeof(struct dhcpMessage));
59 bytes = read(fd, packet, sizeof(struct dhcpMessage)); 59 bytes = read(fd, packet, sizeof(struct dhcpMessage));
60 if (bytes < 0) { 60 if (bytes < 0) {
61 DEBUG("couldn't read on listening socket, ignoring"); 61 DEBUG("cannot read on listening socket, ignoring");
62 return -1; 62 return -1;
63 } 63 }
64 64
65 if (ntohl(packet->cookie) != DHCP_MAGIC) { 65 if (ntohl(packet->cookie) != DHCP_MAGIC) {
66 bb_error_msg("Received bogus message, ignoring"); 66 bb_error_msg("received bogus message, ignoring");
67 return -2; 67 return -2;
68 } 68 }
69 DEBUG("Received a packet"); 69 DEBUG("Received a packet");
diff --git a/networking/udhcp/pidfile.c b/networking/udhcp/pidfile.c
index 148b07b34..6673c9502 100644
--- a/networking/udhcp/pidfile.c
+++ b/networking/udhcp/pidfile.c
@@ -45,7 +45,7 @@ int pidfile_acquire(const char *pidfile)
45 45
46 pid_fd = open(pidfile, O_CREAT | O_WRONLY, 0644); 46 pid_fd = open(pidfile, O_CREAT | O_WRONLY, 0644);
47 if (pid_fd < 0) { 47 if (pid_fd < 0) {
48 bb_perror_msg("Unable to open pidfile %s", pidfile); 48 bb_perror_msg("unable to open pidfile %s", pidfile);
49 } else { 49 } else {
50 lockf(pid_fd, F_LOCK, 0); 50 lockf(pid_fd, F_LOCK, 0);
51 if (!saved_pidfile) 51 if (!saved_pidfile)
@@ -63,14 +63,11 @@ void pidfile_write_release(int pid_fd)
63 63
64 if (pid_fd < 0) return; 64 if (pid_fd < 0) return;
65 65
66 if ((out = fdopen(pid_fd, "w")) != NULL) { 66 out = fdopen(pid_fd, "w");
67 if (out) {
67 fprintf(out, "%d\n", getpid()); 68 fprintf(out, "%d\n", getpid());
68 fclose(out); 69 fclose(out);
69 } 70 }
70 lockf(pid_fd, F_UNLCK, 0); 71 lockf(pid_fd, F_UNLCK, 0);
71 close(pid_fd); 72 close(pid_fd);
72} 73}
73
74
75
76
diff --git a/networking/udhcp/serverpacket.c b/networking/udhcp/serverpacket.c
index cfead413c..b5cfcf405 100644
--- a/networking/udhcp/serverpacket.c
+++ b/networking/udhcp/serverpacket.c
@@ -158,12 +158,12 @@ int sendOffer(struct dhcpMessage *oldpacket)
158 } 158 }
159 159
160 if(!packet.yiaddr) { 160 if(!packet.yiaddr) {
161 bb_error_msg("No IP addresses to give - OFFER abandoned"); 161 bb_error_msg("no IP addresses to give - OFFER abandoned");
162 return -1; 162 return -1;
163 } 163 }
164 164
165 if (!add_lease(packet.chaddr, packet.yiaddr, server_config.offer_time)) { 165 if (!add_lease(packet.chaddr, packet.yiaddr, server_config.offer_time)) {
166 bb_error_msg("Lease pool is full - OFFER abandoned"); 166 bb_error_msg("lease pool is full - OFFER abandoned");
167 return -1; 167 return -1;
168 } 168 }
169 169