aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-03-26 10:09:34 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-03-26 10:09:34 +0100
commit385b4562e39e373761fd62b0990dce02ff96661f (patch)
tree5446c10cd8fbde102f59705a9c0419227707c520
parent968951fd0ced7d0d4b81c0ee4466eada93ae4128 (diff)
downloadbusybox-w32-385b4562e39e373761fd62b0990dce02ff96661f.tar.gz
busybox-w32-385b4562e39e373761fd62b0990dce02ff96661f.tar.bz2
busybox-w32-385b4562e39e373761fd62b0990dce02ff96661f.zip
udhcp: cosmetic cleanups; one case of s/full_read/xread/
function old new delta dumpleases_main 632 623 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/arpping.c2
-rw-r--r--networking/udhcp/common.h3
-rw-r--r--networking/udhcp/dhcpc.c2
-rw-r--r--networking/udhcp/dhcpc.h3
-rw-r--r--networking/udhcp/dhcpd.c3
-rw-r--r--networking/udhcp/dhcpd.h10
-rw-r--r--networking/udhcp/dhcprelay.c3
-rw-r--r--networking/udhcp/domain_codec.c7
-rw-r--r--networking/udhcp/dumpleases.c12
-rw-r--r--networking/udhcp/files.c42
-rw-r--r--networking/udhcp/leases.c12
-rw-r--r--networking/udhcp/packet.c13
-rw-r--r--networking/udhcp/signalpipe.c9
-rw-r--r--networking/udhcp/socket.c14
-rw-r--r--networking/udhcp/static_leases.c5
15 files changed, 55 insertions, 85 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index cf18153f7..7c8c24446 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -1,7 +1,5 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * arpping.c
4 *
5 * Mostly stolen from: dhcpcd - DHCP client daemon 3 * Mostly stolen from: dhcpcd - DHCP client daemon
6 * by Yoichi Hariguchi <yoichi@fore.com> 4 * by Yoichi Hariguchi <yoichi@fore.com>
7 * 5 *
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index bb7541f6e..b4e8b5d43 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -1,6 +1,5 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* common.h 2/*
3 *
4 * Russ Dill <Russ.Dill@asu.edu> September 2001 3 * Russ Dill <Russ.Dill@asu.edu> September 2001
5 * Rewritten by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003 4 * Rewritten by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
6 * 5 *
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 717c92c6b..478ca5c21 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * udhcp DHCP client 3 * udhcp client
4 * 4 *
5 * Russ Dill <Russ.Dill@asu.edu> July 2001 5 * Russ Dill <Russ.Dill@asu.edu> July 2001
6 * 6 *
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index fba747f0c..6bef562c7 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -1,4 +1,7 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/*
3 * Licensed under GPLv2, see file LICENSE in this tarball for details.
4 */
2#ifndef UDHCP_DHCPC_H 5#ifndef UDHCP_DHCPC_H
3#define UDHCP_DHCPC_H 1 6#define UDHCP_DHCPC_H 1
4 7
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 4ab32de90..9e726fbe5 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * udhcp Server 3 * udhcp server
4 * Copyright (C) 1999 Matthew Ramsay <matthewr@moreton.com.au> 4 * Copyright (C) 1999 Matthew Ramsay <matthewr@moreton.com.au>
5 * Chris Trew <ctrew@moreton.com.au> 5 * Chris Trew <ctrew@moreton.com.au>
6 * 6 *
@@ -20,7 +20,6 @@
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23
24#include <syslog.h> 23#include <syslog.h>
25#include "common.h" 24#include "common.h"
26#include "dhcpc.h" 25#include "dhcpc.h"
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index f6187679d..149300b87 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -1,5 +1,7 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* dhcpd.h */ 2/*
3 * Licensed under GPLv2, see file LICENSE in this tarball for details.
4 */
3#ifndef UDHCP_DHCPD_H 5#ifndef UDHCP_DHCPD_H
4#define UDHCP_DHCPD_H 1 6#define UDHCP_DHCPD_H 1
5 7
@@ -65,8 +67,6 @@ struct server_config_t {
65#endif 67#endif
66 68
67 69
68/*** leases.h ***/
69
70typedef uint32_t leasetime_t; 70typedef uint32_t leasetime_t;
71typedef int32_t signed_leasetime_t; 71typedef int32_t signed_leasetime_t;
72 72
@@ -101,8 +101,6 @@ struct dyn_lease *find_lease_by_nip(uint32_t nip) FAST_FUNC;
101uint32_t find_free_or_expired_nip(const uint8_t *safe_mac) FAST_FUNC; 101uint32_t find_free_or_expired_nip(const uint8_t *safe_mac) FAST_FUNC;
102 102
103 103
104/*** static_leases.h ***/
105
106/* Config file parser will pass static lease info to this function 104/* Config file parser will pass static lease info to this function
107 * which will add it to a data structure that can be searched later */ 105 * which will add it to a data structure that can be searched later */
108void add_static_lease(struct static_lease **st_lease_pp, uint8_t *mac, uint32_t nip) FAST_FUNC; 106void add_static_lease(struct static_lease **st_lease_pp, uint8_t *mac, uint32_t nip) FAST_FUNC;
@@ -118,8 +116,6 @@ void log_static_leases(struct static_lease **st_lease_pp) FAST_FUNC;
118#endif 116#endif
119 117
120 118
121/*** files.h ***/
122
123void read_config(const char *file) FAST_FUNC; 119void read_config(const char *file) FAST_FUNC;
124void write_leases(void) FAST_FUNC; 120void write_leases(void) FAST_FUNC;
125void read_leases(const char *file) FAST_FUNC; 121void read_leases(const char *file) FAST_FUNC;
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index 9f6ac699a..e14325dca 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -9,7 +9,6 @@
9 * Netbeat AG 9 * Netbeat AG
10 * Upstream has GPL v2 or later 10 * Upstream has GPL v2 or later
11 */ 11 */
12
13#include "common.h" 12#include "common.h"
14 13
15#define SERVER_PORT 67 14#define SERVER_PORT 67
@@ -146,7 +145,6 @@ static char **get_client_devices(char *dev_list, int *client_number)
146 return client_dev; 145 return client_dev;
147} 146}
148 147
149
150/* Creates listen sockets (in fds) bound to client and server ifaces, 148/* Creates listen sockets (in fds) bound to client and server ifaces,
151 * and returns numerically max fd. 149 * and returns numerically max fd.
152 */ 150 */
@@ -168,7 +166,6 @@ static int init_sockets(char **client_ifaces, int num_clients,
168 return n; 166 return n;
169} 167}
170 168
171
172/** 169/**
173 * pass_to_server() - forwards dhcp packets from client to server 170 * pass_to_server() - forwards dhcp packets from client to server
174 * p - packet to send 171 * p - packet to send
diff --git a/networking/udhcp/domain_codec.c b/networking/udhcp/domain_codec.c
index f116964b7..2dd5347ae 100644
--- a/networking/udhcp/domain_codec.c
+++ b/networking/udhcp/domain_codec.c
@@ -24,7 +24,7 @@
24#define NS_CMPRSFLGS 0xc0 /* name compression pointer flag */ 24#define NS_CMPRSFLGS 0xc0 /* name compression pointer flag */
25 25
26 26
27/* expand a RFC1035-compressed list of domain names "cstr", of length "clen"; 27/* Expand a RFC1035-compressed list of domain names "cstr", of length "clen";
28 * returns a newly allocated string containing the space-separated domains, 28 * returns a newly allocated string containing the space-separated domains,
29 * prefixed with the contents of string pre, or NULL if an error occurs. 29 * prefixed with the contents of string pre, or NULL if an error occurs.
30 */ 30 */
@@ -149,8 +149,7 @@ static uint8_t *convert_dname(const char *src)
149 return res; 149 return res;
150} 150}
151 151
152/* returns the offset within cstr at which dname can be found, or -1 152/* Returns the offset within cstr at which dname can be found, or -1 */
153 */
154static int find_offset(const uint8_t *cstr, int clen, const uint8_t *dname) 153static int find_offset(const uint8_t *cstr, int clen, const uint8_t *dname)
155{ 154{
156 const uint8_t *c, *d; 155 const uint8_t *c, *d;
@@ -188,7 +187,7 @@ static int find_offset(const uint8_t *cstr, int clen, const uint8_t *dname)
188 return -1; 187 return -1;
189} 188}
190 189
191/* computes string to be appended to cstr so that src would be added to 190/* Computes string to be appended to cstr so that src would be added to
192 * the compression (best case, it's a 2-byte pointer to some offset within 191 * the compression (best case, it's a 2-byte pointer to some offset within
193 * cstr; worst case, it's all of src, converted to <4>host<3>com<0> format). 192 * cstr; worst case, it's all of src, converted to <4>host<3>com<0> format).
194 * The computed string is returned directly; its length is returned via retlen; 193 * The computed string is returned directly; its length is returned via retlen;
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index eab9713f4..6ebda94b6 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -2,7 +2,6 @@
2/* 2/*
3 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 3 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
4 */ 4 */
5
6#include "common.h" 5#include "common.h"
7#include "dhcpd.h" 6#include "dhcpd.h"
8#include "unicode.h" 7#include "unicode.h"
@@ -54,8 +53,7 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
54 /* "00:00:00:00:00:00 255.255.255.255 ABCDEFGHIJKLMNOPQRS Wed Jun 30 21:49:08 1993" */ 53 /* "00:00:00:00:00:00 255.255.255.255 ABCDEFGHIJKLMNOPQRS Wed Jun 30 21:49:08 1993" */
55 /* "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */ 54 /* "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */
56 55
57 if (full_read(fd, &written_at, sizeof(written_at)) != sizeof(written_at)) 56 xread(fd, &written_at, sizeof(written_at));
58 return 0;
59 written_at = ntoh64(written_at); 57 written_at = ntoh64(written_at);
60 curr = time(NULL); 58 curr = time(NULL);
61 if (curr < written_at) 59 if (curr < written_at)
@@ -68,15 +66,15 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
68 fmt = ":%02x"; 66 fmt = ":%02x";
69 } 67 }
70 addr.s_addr = lease.lease_nip; 68 addr.s_addr = lease.lease_nip;
71 /* actually, 15+1 and 19+1, +1 is a space between columns */
72 /* lease.hostname is char[20] and is always NUL terminated */
73#if ENABLE_FEATURE_ASSUME_UNICODE 69#if ENABLE_FEATURE_ASSUME_UNICODE
74 { 70 {
75 char *uni_name = unicode_conv_to_printable_fixedwidth(NULL, lease.hostname, 20); 71 char *uni_name = unicode_conv_to_printable_fixedwidth(NULL, lease.hostname, 19);
76 printf(" %-16s%s", inet_ntoa(addr), uni_name); 72 printf(" %-16s%s ", inet_ntoa(addr), uni_name);
77 free(uni_name); 73 free(uni_name);
78 } 74 }
79#else 75#else
76 /* actually, 15+1 and 19+1, +1 is a space between columns */
77 /* lease.hostname is char[20] and is always NUL terminated */
80 printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname); 78 printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname);
81#endif 79#endif
82 expires_abs = ntohl(lease.expires) + written_at; 80 expires_abs = ntohl(lease.expires) + written_at;
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index cf55a6b5c..ff63111c9 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -1,11 +1,11 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * files.c -- DHCP server file manipulation * 3 * DHCP server config and lease file manipulation
4 *
4 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001 5 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001
5 * 6 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this tarball for details.
7 */ 8 */
8
9#include <netinet/ether.h> 9#include <netinet/ether.h>
10 10
11#include "common.h" 11#include "common.h"
@@ -72,28 +72,28 @@ struct config_keyword {
72}; 72};
73 73
74static const struct config_keyword keywords[] = { 74static const struct config_keyword keywords[] = {
75 /* keyword handler variable address default */ 75 /* keyword handler variable address default */
76 {"start", udhcp_str2nip, &(server_config.start_ip), "192.168.0.20"}, 76 {"start" , udhcp_str2nip , &server_config.start_ip , "192.168.0.20"},
77 {"end", udhcp_str2nip, &(server_config.end_ip), "192.168.0.254"}, 77 {"end" , udhcp_str2nip , &server_config.end_ip , "192.168.0.254"},
78 {"interface", read_str, &(server_config.interface), "eth0"}, 78 {"interface" , read_str , &server_config.interface , "eth0"},
79 /* Avoid "max_leases value not sane" warning by setting default 79 /* Avoid "max_leases value not sane" warning by setting default
80 * to default_end_ip - default_start_ip + 1: */ 80 * to default_end_ip - default_start_ip + 1: */
81 {"max_leases", read_u32, &(server_config.max_leases), "235"}, 81 {"max_leases" , read_u32 , &server_config.max_leases , "235"},
82 {"auto_time", read_u32, &(server_config.auto_time), "7200"}, 82 {"auto_time" , read_u32 , &server_config.auto_time , "7200"},
83 {"decline_time", read_u32, &(server_config.decline_time), "3600"}, 83 {"decline_time" , read_u32 , &server_config.decline_time , "3600"},
84 {"conflict_time",read_u32, &(server_config.conflict_time),"3600"}, 84 {"conflict_time", read_u32 , &server_config.conflict_time, "3600"},
85 {"offer_time", read_u32, &(server_config.offer_time), "60"}, 85 {"offer_time" , read_u32 , &server_config.offer_time , "60"},
86 {"min_lease", read_u32, &(server_config.min_lease_sec),"60"}, 86 {"min_lease" , read_u32 , &server_config.min_lease_sec, "60"},
87 {"lease_file", read_str, &(server_config.lease_file), LEASES_FILE}, 87 {"lease_file" , read_str , &server_config.lease_file , LEASES_FILE},
88 {"pidfile", read_str, &(server_config.pidfile), "/var/run/udhcpd.pid"}, 88 {"pidfile" , read_str , &server_config.pidfile , "/var/run/udhcpd.pid"},
89 {"siaddr", udhcp_str2nip, &(server_config.siaddr_nip), "0.0.0.0"}, 89 {"siaddr" , udhcp_str2nip , &server_config.siaddr_nip , "0.0.0.0"},
90 /* keywords with no defaults must be last! */ 90 /* keywords with no defaults must be last! */
91 {"option", udhcp_str2optset, &(server_config.options), ""}, 91 {"option" , udhcp_str2optset, &server_config.options , ""},
92 {"opt", udhcp_str2optset, &(server_config.options), ""}, 92 {"opt" , udhcp_str2optset, &server_config.options , ""},
93 {"notify_file", read_str, &(server_config.notify_file), ""}, 93 {"notify_file" , read_str , &server_config.notify_file , ""},
94 {"sname", read_str, &(server_config.sname), ""}, 94 {"sname" , read_str , &server_config.sname , ""},
95 {"boot_file", read_str, &(server_config.boot_file), ""}, 95 {"boot_file" , read_str , &server_config.boot_file , ""},
96 {"static_lease", read_staticlease, &(server_config.static_leases), ""}, 96 {"static_lease" , read_staticlease, &server_config.static_leases, ""},
97}; 97};
98enum { KWS_WITH_DEFAULTS = ARRAY_SIZE(keywords) - 6 }; 98enum { KWS_WITH_DEFAULTS = ARRAY_SIZE(keywords) - 6 };
99 99
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index 81acb9910..4999d8079 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -1,15 +1,12 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * leases.c -- tools to manage DHCP leases
4 * Russ Dill <Russ.Dill@asu.edu> July 2001 3 * Russ Dill <Russ.Dill@asu.edu> July 2001
5 * 4 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this tarball for details.
7 */ 6 */
8
9#include "common.h" 7#include "common.h"
10#include "dhcpd.h" 8#include "dhcpd.h"
11 9
12
13/* Find the oldest expired lease, NULL if there are no expired leases */ 10/* Find the oldest expired lease, NULL if there are no expired leases */
14static struct dyn_lease *oldest_expired_lease(void) 11static struct dyn_lease *oldest_expired_lease(void)
15{ 12{
@@ -28,7 +25,6 @@ static struct dyn_lease *oldest_expired_lease(void)
28 return oldest_lease; 25 return oldest_lease;
29} 26}
30 27
31
32/* Clear out all leases with matching nonzero chaddr OR yiaddr. 28/* Clear out all leases with matching nonzero chaddr OR yiaddr.
33 * If chaddr == NULL, this is a conflict lease. 29 * If chaddr == NULL, this is a conflict lease.
34 */ 30 */
@@ -45,8 +41,7 @@ static void clear_leases(const uint8_t *chaddr, uint32_t yiaddr)
45 } 41 }
46} 42}
47 43
48 44/* Add a lease into the table, clearing out any old ones.
49/* Add a lease into the table, clearing out any old ones
50 * If chaddr == NULL, this is a conflict lease. 45 * If chaddr == NULL, this is a conflict lease.
51 */ 46 */
52struct dyn_lease* FAST_FUNC add_lease( 47struct dyn_lease* FAST_FUNC add_lease(
@@ -84,14 +79,12 @@ struct dyn_lease* FAST_FUNC add_lease(
84 return oldest; 79 return oldest;
85} 80}
86 81
87
88/* True if a lease has expired */ 82/* True if a lease has expired */
89int FAST_FUNC is_expired_lease(struct dyn_lease *lease) 83int FAST_FUNC is_expired_lease(struct dyn_lease *lease)
90{ 84{
91 return (lease->expires < (leasetime_t) time(NULL)); 85 return (lease->expires < (leasetime_t) time(NULL));
92} 86}
93 87
94
95/* Find the first lease that matches MAC, NULL if no match */ 88/* Find the first lease that matches MAC, NULL if no match */
96struct dyn_lease* FAST_FUNC find_lease_by_mac(const uint8_t *mac) 89struct dyn_lease* FAST_FUNC find_lease_by_mac(const uint8_t *mac)
97{ 90{
@@ -104,7 +97,6 @@ struct dyn_lease* FAST_FUNC find_lease_by_mac(const uint8_t *mac)
104 return NULL; 97 return NULL;
105} 98}
106 99
107
108/* Find the first lease that matches IP, NULL is no match */ 100/* Find the first lease that matches IP, NULL is no match */
109struct dyn_lease* FAST_FUNC find_lease_by_nip(uint32_t nip) 101struct dyn_lease* FAST_FUNC find_lease_by_nip(uint32_t nip)
110{ 102{
@@ -117,7 +109,6 @@ struct dyn_lease* FAST_FUNC find_lease_by_nip(uint32_t nip)
117 return NULL; 109 return NULL;
118} 110}
119 111
120
121/* Check if the IP is taken; if it is, add it to the lease table */ 112/* Check if the IP is taken; if it is, add it to the lease table */
122static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac) 113static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac)
123{ 114{
@@ -138,7 +129,6 @@ static int nobody_responds_to_arp(uint32_t nip, const uint8_t *safe_mac)
138 return 0; 129 return 0;
139} 130}
140 131
141
142/* Find a new usable (we think) address */ 132/* Find a new usable (we think) address */
143uint32_t FAST_FUNC find_free_or_expired_nip(const uint8_t *safe_mac) 133uint32_t FAST_FUNC find_free_or_expired_nip(const uint8_t *safe_mac)
144{ 134{
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index ecdbec7f3..1bfe12041 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -1,18 +1,19 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * packet.c -- packet ops 3 * Packet ops
4 *
4 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001 5 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001
5 * 6 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this tarball for details.
7 */ 8 */
8#include <netinet/in.h> 9#include <netinet/in.h>
9#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION 10#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
10#include <netpacket/packet.h> 11# include <netpacket/packet.h>
11#include <net/ethernet.h> 12# include <net/ethernet.h>
12#else 13#else
13#include <asm/types.h> 14# include <asm/types.h>
14#include <linux/if_packet.h> 15# include <linux/if_packet.h>
15#include <linux/if_ether.h> 16# include <linux/if_ether.h>
16#endif 17#endif
17 18
18#include "common.h" 19#include "common.h"
diff --git a/networking/udhcp/signalpipe.c b/networking/udhcp/signalpipe.c
index c181e0e06..6355c5e90 100644
--- a/networking/udhcp/signalpipe.c
+++ b/networking/udhcp/signalpipe.c
@@ -1,6 +1,5 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* signalpipe.c 2/*
3 *
4 * Signal pipe infrastructure. A reliable way of delivering signals. 3 * Signal pipe infrastructure. A reliable way of delivering signals.
5 * 4 *
6 * Russ Dill <Russ.Dill@asu.edu> December 2003 5 * Russ Dill <Russ.Dill@asu.edu> December 2003
@@ -19,10 +18,9 @@
19 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 20 */
22
23#include "common.h" 21#include "common.h"
24 22
25 23/* Global variable: we access it from signal handler */
26static struct fd_pair signal_pipe; 24static struct fd_pair signal_pipe;
27 25
28static void signal_handler(int sig) 26static void signal_handler(int sig)
@@ -32,7 +30,6 @@ static void signal_handler(int sig)
32 bb_perror_msg("can't send signal"); 30 bb_perror_msg("can't send signal");
33} 31}
34 32
35
36/* Call this before doing anything else. Sets up the socket pair 33/* Call this before doing anything else. Sets up the socket pair
37 * and installs the signal handler */ 34 * and installs the signal handler */
38void FAST_FUNC udhcp_sp_setup(void) 35void FAST_FUNC udhcp_sp_setup(void)
@@ -49,7 +46,6 @@ void FAST_FUNC udhcp_sp_setup(void)
49 , signal_handler); 46 , signal_handler);
50} 47}
51 48
52
53/* Quick little function to setup the rfds. Will return the 49/* Quick little function to setup the rfds. Will return the
54 * max_fd for use with select. Limited in that you can only pass 50 * max_fd for use with select. Limited in that you can only pass
55 * one extra fd */ 51 * one extra fd */
@@ -64,7 +60,6 @@ int FAST_FUNC udhcp_sp_fd_set(fd_set *rfds, int extra_fd)
64 return signal_pipe.rd > extra_fd ? signal_pipe.rd : extra_fd; 60 return signal_pipe.rd > extra_fd ? signal_pipe.rd : extra_fd;
65} 61}
66 62
67
68/* Read a signal from the signal pipe. Returns 0 if there is 63/* Read a signal from the signal pipe. Returns 0 if there is
69 * no signal, -1 on error (and sets errno appropriately), and 64 * no signal, -1 on error (and sets errno appropriately), and
70 * your signal on success */ 65 * your signal on success */
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 469b36202..0ed7ad1c6 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * socket.c -- DHCP server client/server socket creation 3 * DHCP server client/server socket creation
4 * 4 *
5 * udhcp client/server 5 * udhcp client/server
6 * Copyright (C) 1999 Matthew Ramsay <matthewr@moreton.com.au> 6 * Copyright (C) 1999 Matthew Ramsay <matthewr@moreton.com.au>
@@ -22,20 +22,18 @@
22 * along with this program; if not, write to the Free Software 22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */ 24 */
25
26#include <net/if.h> 25#include <net/if.h>
27#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION 26#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
28#include <netpacket/packet.h> 27# include <netpacket/packet.h>
29#include <net/ethernet.h> 28# include <net/ethernet.h>
30#else 29#else
31#include <asm/types.h> 30# include <asm/types.h>
32#include <linux/if_packet.h> 31# include <linux/if_packet.h>
33#include <linux/if_ether.h> 32# include <linux/if_ether.h>
34#endif 33#endif
35 34
36#include "common.h" 35#include "common.h"
37 36
38
39int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac) 37int FAST_FUNC udhcp_read_interface(const char *interface, int *ifindex, uint32_t *nip, uint8_t *mac)
40{ 38{
41 int fd; 39 int fd;
diff --git a/networking/udhcp/static_leases.c b/networking/udhcp/static_leases.c
index 1887a8afd..b334a5888 100644
--- a/networking/udhcp/static_leases.c
+++ b/networking/udhcp/static_leases.c
@@ -1,17 +1,14 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * static_leases.c -- Couple of functions to assist with storing and 3 * Storing and retrieving data for static leases
4 * retrieving data for static leases
5 * 4 *
6 * Wade Berrier <wberrier@myrealbox.com> September 2004 5 * Wade Berrier <wberrier@myrealbox.com> September 2004
7 * 6 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this tarball for details.
9 */ 8 */
10
11#include "common.h" 9#include "common.h"
12#include "dhcpd.h" 10#include "dhcpd.h"
13 11
14
15/* Takes the address of the pointer to the static_leases linked list, 12/* Takes the address of the pointer to the static_leases linked list,
16 * address to a 6 byte mac address, 13 * address to a 6 byte mac address,
17 * 4 byte IP address */ 14 * 4 byte IP address */