diff options
author | Rob Landley <rob@landley.net> | 2006-05-28 01:06:36 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-05-28 01:06:36 +0000 |
commit | 3f78561d63290c53ca8bb3cd6314ca7357a617ee (patch) | |
tree | 03b3973eeaee9635c77c21028133374d66f2aa18 /networking/udhcp/dhcpd.c | |
parent | 8fba99f35e46d234b47d652225bb80846cae369c (diff) | |
download | busybox-w32-3f78561d63290c53ca8bb3cd6314ca7357a617ee.tar.gz busybox-w32-3f78561d63290c53ca8bb3cd6314ca7357a617ee.tar.bz2 busybox-w32-3f78561d63290c53ca8bb3cd6314ca7357a617ee.zip |
My first bout of untangling udhcp. Make lots of gratuitous #defines go
away, substitutie BB_VER for an external VERSION, use busybox CONFIG symbols
rather than checking for them then defining others, etc. Lots more cleanup
to do...
Diffstat (limited to 'networking/udhcp/dhcpd.c')
-rw-r--r-- | networking/udhcp/dhcpd.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 6c5a753eb..29ca06a68 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c | |||
@@ -6,19 +6,7 @@ | |||
6 | * | 6 | * |
7 | * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001 | 7 | * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001 |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | 10 | */ |
23 | 11 | ||
24 | #include <fcntl.h> | 12 | #include <fcntl.h> |
@@ -66,7 +54,7 @@ int udhcpd_main(int argc, char *argv[]) | |||
66 | read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]); | 54 | read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]); |
67 | 55 | ||
68 | /* Start the log, sanitize fd's, and write a pid file */ | 56 | /* Start the log, sanitize fd's, and write a pid file */ |
69 | start_log_and_pid("udhcpd", server_config.pidfile); | 57 | udhcp_start_log_and_pid("udhcpd", server_config.pidfile); |
70 | 58 | ||
71 | if ((option = find_option(server_config.options, DHCP_LEASE_TIME))) { | 59 | if ((option = find_option(server_config.options, DHCP_LEASE_TIME))) { |
72 | memcpy(&server_config.lease, option->data + 2, 4); | 60 | memcpy(&server_config.lease, option->data + 2, 4); |
@@ -90,9 +78,8 @@ int udhcpd_main(int argc, char *argv[]) | |||
90 | &server_config.server, server_config.arp) < 0) | 78 | &server_config.server, server_config.arp) < 0) |
91 | return 1; | 79 | return 1; |
92 | 80 | ||
93 | #ifndef UDHCP_DEBUG | 81 | if (!ENABLE_FEATURE_UDHCP_DEBUG) |
94 | background(server_config.pidfile); /* hold lock during fork. */ | 82 | udhcp_background(server_config.pidfile); /* hold lock during fork. */ |
95 | #endif | ||
96 | 83 | ||
97 | /* Setup the signal pipe */ | 84 | /* Setup the signal pipe */ |
98 | udhcp_sp_setup(); | 85 | udhcp_sp_setup(); |
@@ -139,7 +126,7 @@ int udhcpd_main(int argc, char *argv[]) | |||
139 | default: continue; /* signal or error (probably EINTR) */ | 126 | default: continue; /* signal or error (probably EINTR) */ |
140 | } | 127 | } |
141 | 128 | ||
142 | if ((bytes = get_packet(&packet, server_socket)) < 0) { /* this waits for a packet - idle */ | 129 | if ((bytes = udhcp_get_packet(&packet, server_socket)) < 0) { /* this waits for a packet - idle */ |
143 | if (bytes == -1 && errno != EINTR) { | 130 | if (bytes == -1 && errno != EINTR) { |
144 | DEBUG(LOG_INFO, "error on read, %m, reopening socket"); | 131 | DEBUG(LOG_INFO, "error on read, %m, reopening socket"); |
145 | close(server_socket); | 132 | close(server_socket); |