[OpenWrt-Devel] [PATCH 3/3 v2] busybox/netifd: make zcip log to syslog (always)

Michel Stam m.stam at fugro.nl
Mon Oct 6 11:29:59 EDT 2014


zcip is not the most talkative beast at the best of times. It
would be nice to see -something- in syslog when an IP address
is acquired.

Signed-off-by: Michel Stam <m.stam at fugro.nl>
---
 .../netifd/files/lib/netifd/proto/zeroconf.sh      |  2 +-
 .../busybox/patches/460-zcip-always-syslog.patch   | 44 ++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 package/utils/busybox/patches/460-zcip-always-syslog.patch

diff --git a/package/network/config/netifd/files/lib/netifd/proto/zeroconf.sh b/package/network/config/netifd/files/lib/netifd/proto/zeroconf.sh
index f7a6f76..998d2c6 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/zeroconf.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/zeroconf.sh
@@ -21,7 +21,7 @@ proto_zeroconf_setup() {
 	proto_run_command "$config" zcip \
 		${ipaddr:+-r $ipaddr} \
 		${range:+-l $range} \
-		-f "$iface" \
+		-f -s -v "$iface" \
 		/lib/netifd/zeroconf.script
 }
 
diff --git a/package/utils/busybox/patches/460-zcip-always-syslog.patch b/package/utils/busybox/patches/460-zcip-always-syslog.patch
new file mode 100644
index 0000000..7519aa0
--- /dev/null
+++ b/package/utils/busybox/patches/460-zcip-always-syslog.patch
@@ -0,0 +1,44 @@
+From 297563d4d859643de249d180f3bf308f9536de18 Mon Sep 17 00:00:00 2001
+From: Michel Stam <m.stam at fugro.nl>
+Date: Thu, 25 Sep 2014 14:06:39 +0200
+Subject: [PATCH] zcip: add an option to force logging to syslog even if
+ running -f
+
+Signed-off-by: Michel Stam <m.stam at fugro.nl>
+---
+ networking/zcip.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/networking/zcip.c b/networking/zcip.c
+index 2a57543..2997503 100644
+--- a/networking/zcip.c
++++ b/networking/zcip.c
+@@ -32,6 +32,7 @@
+ //usage:     "\n	-r 169.254.x.x	Request this address first"
+ //usage:     "\n	-l w.x.0.0	Use this class B range instead of 169.254"
+ //usage:     "\n	-v		Verbose"
++//usage:     "\n	-s		Log to syslog (even in foreground)"
+ //usage:     "\n"
+ //usage:     "\nWith no -q, runs continuously monitoring for ARP conflicts,"
+ //usage:     "\nexits only on I/O errors (link down etc)"
+@@ -238,7 +239,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
+ 	// parse commandline: prog [options] ifname script
+ 	// exactly 2 args; -v accumulates and implies -f
+ 	opt_complementary = "=2:vv:vf";
+-	opts = getopt32(argv, "fqr:l:v", &r_opt, &l_opt, &verbose);
++	opts = getopt32(argv, "fqr:l:vs", &r_opt, &l_opt, &verbose);
+ #if !BB_MMU
+ 	// on NOMMU reexec early (or else we will rerun things twice)
+ 	if (!FOREGROUND)
+@@ -248,7 +249,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv)
+ 	// (need to do it before openlog to prevent openlog from taking
+ 	// fd 3 (sock_fd==3))
+ 	xmove_fd(xsocket(AF_PACKET, SOCK_PACKET, htons(ETH_P_ARP)), sock_fd);
+-	if (!FOREGROUND) {
++	if (!FOREGROUND || (opts & 16)) {
+ 		// do it before all bb_xx_msg calls
+ 		openlog(applet_name, 0, LOG_DAEMON);
+ 		logmode |= LOGMODE_SYSLOG;
+-- 
+1.7.12.1
+
-- 
1.7.12.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list