summaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp')
-rw-r--r--networking/udhcp/Config.in11
-rw-r--r--networking/udhcp/dhcpc.c6
-rw-r--r--networking/udhcp/dhcpd.c7
3 files changed, 8 insertions, 16 deletions
diff --git a/networking/udhcp/Config.in b/networking/udhcp/Config.in
index 7a3eda9..76b0780 100644
--- a/networking/udhcp/Config.in
+++ b/networking/udhcp/Config.in
@@ -54,17 +54,6 @@ config APP_UDHCPC
See http://udhcp.busybox.net for further details.
-config FEATURE_UDHCP_SYSLOG
- bool "Log udhcp messages to syslog"
- default n
- depends on APP_UDHCPD || APP_UDHCPC
- select FEATURE_SYSLOG
- help
- If not daemonized, udhcpd prints its messages to stdout/stderr.
- If this option is selected, it will also log them to syslog.
-
- See http://udhcp.busybox.net for further details.
-
config FEATURE_UDHCP_DEBUG
bool "Compile udhcp with noisy debugging messages"
default n
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 0e89c3c..7cb1dfe 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -178,6 +178,7 @@ int udhcpc_main(int argc, char **argv)
OPT_T = 1 << 15,
OPT_t = 1 << 16,
OPT_v = 1 << 17,
+ OPT_S = 1 << 18,
};
#if ENABLE_GETOPT_LONG
static const char udhcpc_longopts[] ALIGN1 =
@@ -199,6 +200,7 @@ int udhcpc_main(int argc, char **argv)
"timeout\0" Required_argument "T"
"version\0" No_argument "v"
"retries\0" Required_argument "t"
+ "syslog\0" No_argument "S"
;
#endif
/* Default options. */
@@ -213,7 +215,7 @@ int udhcpc_main(int argc, char **argv)
#if ENABLE_GETOPT_LONG
applet_long_options = udhcpc_longopts;
#endif
- opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v",
+ opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:vS",
&str_c, &str_V, &str_h, &str_h, &str_F,
&client_config.interface, &client_config.pidfile, &str_r,
&client_config.script, &str_T, &str_t
@@ -262,7 +264,7 @@ int udhcpc_main(int argc, char **argv)
return 0;
}
- if (ENABLE_FEATURE_UDHCP_SYSLOG) {
+ if (opt & OPT_S) {
openlog(applet_name, LOG_PID, LOG_LOCAL0);
logmode |= LOGMODE_SYSLOG;
}
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 89f57bf..d8e80e3 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -32,17 +32,18 @@ int udhcpd_main(int argc, char **argv)
uint32_t server_id_align, requested_align, static_lease_ip;
unsigned timeout_end;
unsigned num_ips;
+ unsigned opt;
struct option_set *option;
struct dhcpOfferedAddr *lease, static_lease;
-//Huh, dhcpd don't have --foreground, --syslog options?? TODO
+ opt = getopt32(argc, argv, "fS");
- if (!ENABLE_FEATURE_UDHCP_DEBUG) {
+ if (!(opt & 1)) { /* no -f */
bb_daemonize_or_rexec(0, argv);
logmode &= ~LOGMODE_STDIO;
}
- if (ENABLE_FEATURE_UDHCP_SYSLOG) {
+ if (opt & 2) { /* -S */
openlog(applet_name, LOG_PID, LOG_LOCAL0);
logmode |= LOGMODE_SYSLOG;
}