aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar "Vladimir N. Oleynik" <dzo@simtreas.ru>2005-09-23 11:25:29 +0000
committerGravatar "Vladimir N. Oleynik" <dzo@simtreas.ru>2005-09-23 11:25:29 +0000
commitb628409b1e18aa6cdcf485077a3a64276e817db9 (patch)
tree70ecbe991cb076b240d290633cb5e44ef1879cb5
parent53ad366fe73b3598af6cfd133357a9ceb643c167 (diff)
downloadbusybox-b628409b1e18aa6cdcf485077a3a64276e817db9.tar.gz
busybox-b628409b1e18aa6cdcf485077a3a64276e817db9.tar.bz2
more make safe the exported namespace for udhcp. Move to bb-specific file for reduce change into udhcp-CVS
-rw-r--r--networking/udhcp/common.h3
-rw-r--r--networking/udhcp/dhcpc.c2
-rw-r--r--networking/udhcp/dhcpc.h5
-rw-r--r--networking/udhcp/libbb_udhcp.h29
-rw-r--r--networking/udhcp/options.c2
-rw-r--r--networking/udhcp/packet.h6
-rw-r--r--networking/udhcp/pidfile.h3
-rw-r--r--networking/udhcp/script.c2
-rw-r--r--networking/udhcp/script.h1
-rw-r--r--networking/udhcp/serverpacket.c2
10 files changed, 35 insertions, 20 deletions
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index e474f5e97..efa8fd419 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -39,9 +39,6 @@ enum syslog_levels {
#include <syslog.h>
#endif
-#define background udhcp_background
-#define start_log_and_pid udhcp_start_log_and_pid
-
long uptime(void);
void background(const char *pidfile);
void start_log_and_pid(const char *client_server, const char *pidfile);
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 48923f697..d5c69db42 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -34,6 +34,7 @@
#include <net/if.h>
#include <errno.h>
+#include "common.h"
#include "dhcpd.h"
#include "dhcpc.h"
#include "options.h"
@@ -41,7 +42,6 @@
#include "clientsocket.h"
#include "script.h"
#include "socket.h"
-#include "common.h"
#include "signalpipe.h"
static int state;
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index 4cc1c4cc1..e2e14feba 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -2,10 +2,9 @@
#ifndef _DHCPC_H
#define _DHCPC_H
+#ifndef DEFAULT_SCRIPT
#define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script"
-
-/* allow libbb_udhcp.h to redefine DEFAULT_SCRIPT */
-#include "libbb_udhcp.h"
+#endif
#define INIT_SELECTING 0
#define REQUESTING 1
diff --git a/networking/udhcp/libbb_udhcp.h b/networking/udhcp/libbb_udhcp.h
index 51e157142..0dae40172 100644
--- a/networking/udhcp/libbb_udhcp.h
+++ b/networking/udhcp/libbb_udhcp.h
@@ -27,6 +27,35 @@
#define xfopen bb_xfopen
+/* make safe the exported namespace */
+/* from common.h */
+#define background udhcp_background
+#define start_log_and_pid udhcp_start_log_and_pid
+/* from script.h */
+#define run_script udhcp_run_script
+/* from packet.h */
+#define init_header udhcp_init_header
+#define get_packet udhcp_get_packet
+#define checksum udhcp_checksum
+#define raw_packet udhcp_raw_packet
+#define kernel_packet udhcp_kernel_packet
+/* from pidfile.h */
+#define pidfile_acquire udhcp_pidfile_acquire
+#define pidfile_write_release udhcp_pidfile_write_release
+/* from options.h */
+#define get_option udhcp_get_option
+#define end_option udhcp_end_option
+#define add_option_string udhcp_add_option_string
+#define add_simple_option udhcp_add_simple_option
+#define option_lengths udhcp_option_lengths
+/* from socket.h */
+#define listen_socket udhcp_listen_socket
+#define read_interface udhcp_read_interface
+/* from dhcpc.h */
+#define client_config udhcp_client_config
+/* from dhcpd.h */
+#define server_config udhcp_server_config
+
#else /* ! BB_VER */
#include <stdlib.h>
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c
index e81d0a757..144345134 100644
--- a/networking/udhcp/options.c
+++ b/networking/udhcp/options.c
@@ -6,10 +6,10 @@
#include <stdlib.h>
#include <string.h>
+#include "common.h"
#include "dhcpd.h"
#include "options.h"
#include "files.h"
-#include "common.h"
/* supported options are easily added here */
diff --git a/networking/udhcp/packet.h b/networking/udhcp/packet.h
index b2be5d7f7..f5859e824 100644
--- a/networking/udhcp/packet.h
+++ b/networking/udhcp/packet.h
@@ -29,12 +29,6 @@ struct udp_dhcp_packet {
struct dhcpMessage data;
};
-#define init_header udhcp_init_header
-#define get_packet udhcp_get_packet
-#define checksum udhcp_checksum
-#define raw_packet udhcp_raw_packet
-#define kernel_packet udhcp_kernel_packet
-
void init_header(struct dhcpMessage *packet, char type);
int get_packet(struct dhcpMessage *packet, int fd);
uint16_t checksum(void *addr, int count);
diff --git a/networking/udhcp/pidfile.h b/networking/udhcp/pidfile.h
index b1292a816..ea97d1de5 100644
--- a/networking/udhcp/pidfile.h
+++ b/networking/udhcp/pidfile.h
@@ -20,9 +20,6 @@
*/
-#define pidfile_acquire udhcp_pidfile_acquire
-#define pidfile_write_release udhcp_pidfile_write_release
-
int pidfile_acquire(const char *pidfile);
void pidfile_write_release(int pid_fd);
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index e08d765bb..c04c69f7e 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -29,10 +29,10 @@
#include <sys/types.h>
#include <sys/wait.h>
+#include "common.h"
#include "options.h"
#include "dhcpd.h"
#include "dhcpc.h"
-#include "common.h"
#include "script.h"
/* get a rough idea of how long an option will be (rounding up...) */
diff --git a/networking/udhcp/script.h b/networking/udhcp/script.h
index ab2c9fba6..71003311c 100644
--- a/networking/udhcp/script.h
+++ b/networking/udhcp/script.h
@@ -1,7 +1,6 @@
#ifndef _SCRIPT_H
#define _SCRIPT_H
-#define run_script udhcp_run_script
extern void run_script(struct dhcpMessage *packet, const char *name);
#endif
diff --git a/networking/udhcp/serverpacket.c b/networking/udhcp/serverpacket.c
index 75d55bd92..c6a820909 100644
--- a/networking/udhcp/serverpacket.c
+++ b/networking/udhcp/serverpacket.c
@@ -25,10 +25,10 @@
#include <string.h>
#include <time.h>
+#include "common.h"
#include "serverpacket.h"
#include "dhcpd.h"
#include "options.h"
-#include "common.h"
#include "static_leases.h"
/* send a packet to giaddr using the kernel ip stack */