aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpd.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-18 19:51:32 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-18 19:51:32 +0000
commit5a3395bc01cd4b11309595a6ecdaf32f8279f378 (patch)
tree1e63aa591a05e9ec75aefdcd639ca4188e583648 /networking/udhcp/dhcpd.c
parentabfc4cf6d8b9c59724aceb70df5081a1368fdb62 (diff)
downloadbusybox-w32-5a3395bc01cd4b11309595a6ecdaf32f8279f378.tar.gz
busybox-w32-5a3395bc01cd4b11309595a6ecdaf32f8279f378.tar.bz2
busybox-w32-5a3395bc01cd4b11309595a6ecdaf32f8279f378.zip
udhcp: fix indentation and style.
Eliminate (group) a lot of smallish *.h files Remove lots of unneeded #includes
Diffstat (limited to 'networking/udhcp/dhcpd.c')
-rw-r--r--networking/udhcp/dhcpd.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 62057bed8..0935a9453 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -10,29 +10,9 @@
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
11 */ 11 */
12 12
13#include <fcntl.h> 13#include "common.h"
14#include <string.h>
15#include <stdlib.h>
16#include <sys/wait.h>
17#include <arpa/inet.h>
18#include <netdb.h>
19#include <netinet/in.h>
20#include <sys/socket.h>
21#include <unistd.h>
22#include <signal.h>
23#include <errno.h>
24#include <sys/ioctl.h>
25#include <time.h>
26
27#include "dhcpd.h" 14#include "dhcpd.h"
28#include "arpping.h"
29#include "socket.h"
30#include "options.h" 15#include "options.h"
31#include "files.h"
32#include "serverpacket.h"
33#include "common.h"
34#include "signalpipe.h"
35#include "static_leases.h"
36 16
37 17
38/* globals */ 18/* globals */
@@ -86,7 +66,7 @@ int udhcpd_main(int argc, char *argv[])
86 udhcp_sp_setup(); 66 udhcp_sp_setup();
87 67
88 timeout_end = time(0) + server_config.auto_time; 68 timeout_end = time(0) + server_config.auto_time;
89 while(1) { /* loop until universe collapses */ 69 while (1) { /* loop until universe collapses */
90 70
91 if (server_socket < 0) 71 if (server_socket < 0)
92 if ((server_socket = listen_socket(INADDR_ANY, SERVER_PORT, server_config.interface)) < 0) { 72 if ((server_socket = listen_socket(INADDR_ANY, SERVER_PORT, server_config.interface)) < 0) {
@@ -144,8 +124,7 @@ int udhcpd_main(int argc, char *argv[])
144 /* Look for a static lease */ 124 /* Look for a static lease */
145 static_lease_ip = getIpByMac(server_config.static_leases, &packet.chaddr); 125 static_lease_ip = getIpByMac(server_config.static_leases, &packet.chaddr);
146 126
147 if(static_lease_ip) 127 if (static_lease_ip) {
148 {
149 bb_info_msg("Found static lease: %x", static_lease_ip); 128 bb_info_msg("Found static lease: %x", static_lease_ip);
150 129
151 memcpy(&static_lease.chaddr, &packet.chaddr, 16); 130 memcpy(&static_lease.chaddr, &packet.chaddr, 16);
@@ -154,10 +133,8 @@ int udhcpd_main(int argc, char *argv[])
154 133
155 lease = &static_lease; 134 lease = &static_lease;
156 135
157 } 136 } else {
158 else 137 lease = find_lease_by_chaddr(packet.chaddr);
159 {
160 lease = find_lease_by_chaddr(packet.chaddr);
161 } 138 }
162 139
163 switch (state[0]) { 140 switch (state[0]) {
@@ -245,4 +222,3 @@ int udhcpd_main(int argc, char *argv[])
245 222
246 return 0; 223 return 0;
247} 224}
248