[OpenWrt-Devel] [PATCH] lldpd: fix init script for multiple interfaces

Alexandru Ardelean ardeleanalex at gmail.com
Fri Feb 27 11:23:16 EST 2015


The lldpd daemon requires only 1 -I parameter with all interfaces
joined with commas.

So, it needs:
  /usr/sbin/lldpd -I lan1,lan2,...,lanX
versus
  /usr/sbin/lldpd -I lan1 -I lan2 ... -I lanX

The latter seems to take into consideration only lanX,
while other devices are ignored by lldpd.

Signed-off-by: Alexandru Ardelean <ardeleanalex at gmail.com>
---
 package/network/services/lldpd/files/lldpd.init | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
index b2eea70..d29980e 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -37,13 +37,18 @@ start() {
 	local ifaces
 	config_get ifaces 'config' 'interface'
 
+	local ifnames_joined=""
 	local iface
 	for iface in $ifaces; do
 		local ifname=""
 		if network_get_device ifname "$iface" || [ -e "/sys/class/net/$iface" ]; then
-			append args "-I ${ifname:-$iface}"
+			append ifnames_joined "${ifname:-$iface}"
 		fi
 	done
+	if [ -n "$ifnames_joined" ]; then
+		ifnames_joined=`echo $ifnames_joined | tr " " ","`
+		append args "-I $ifnames_joined"
+	fi
 
 	[ $enable_cdp -gt 0 ] && append args '-c'
 	[ $enable_fdp -gt 0 ] && append args '-f'
-- 
2.1.2
_______________________________________________
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