summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-01-02 14:35:43 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-01-02 14:35:43 +0000
commitc8a8f8fd55b39a2cf0e84321415f3c8e7333e53b (patch)
tree36c26b8be23ae2f5191a1ca896e828a93b8e8bf8 /package
parent569bbe49700b2cf0b6c3b1e6a6ecf70aad3d6b81 (diff)
downloadmtk-20170518-c8a8f8fd55b39a2cf0e84321415f3c8e7333e53b.zip
mtk-20170518-c8a8f8fd55b39a2cf0e84321415f3c8e7333e53b.tar.gz
mtk-20170518-c8a8f8fd55b39a2cf0e84321415f3c8e7333e53b.tar.bz2
lldpd: various enhancements
- introduce "list interface" options to specify the ifaces to listen on, takes uci- or network device name - set the default system description to distrib @ hostname, e.g. "OpenWrt Barrier Breaker r34744 @ vbox" - introduce "option lldp_description" to override the automatically generated description SVN-Revision: 34970
Diffstat (limited to 'package')
-rw-r--r--package/network/services/lldpd/Makefile2
-rw-r--r--package/network/services/lldpd/files/lldpd.config7
-rw-r--r--package/network/services/lldpd/files/lldpd.init27
3 files changed, 34 insertions, 2 deletions
diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile
index 2a9954c..f0983f7 100644
--- a/package/network/services/lldpd/Makefile
+++ b/package/network/services/lldpd/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=lldpd
PKG_VERSION:=0.6.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://media.luffy.cx/files/lldpd
diff --git a/package/network/services/lldpd/files/lldpd.config b/package/network/services/lldpd/files/lldpd.config
index 14ba02f..48728e0 100644
--- a/package/network/services/lldpd/files/lldpd.config
+++ b/package/network/services/lldpd/files/lldpd.config
@@ -6,3 +6,10 @@ config lldpd config
option lldp_class 4
option lldp_location "2:FR:6:Commercial Rd:3:Roseville:19:4"
+
+ # if empty, the distribution description is sent
+ #option lldp_description "OpenWrt System"
+
+ # interfaces to listen on
+ list interface "loopback"
+ list interface "lan"
diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
index 22cb9db..3599950 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -5,13 +5,25 @@ START=90
SERVICE_USE_PID=1
+find_release_info()
+{
+ [ -s /etc/openwrt_release ] && . /etc/openwrt_release
+ [ -z "$DISTRIB_DESCRIPTION" ] && [ -s /etc/openwrt_version ] && \
+ DISTRIB_DESCRIPTION="$(cat /etc/openwrt_version)"
+
+ echo "${DISTRIB_DESCRIPTION:-Unknown OpenWrt release} @ $(cat /proc/sys/kernel/hostname)"
+}
+
start() {
+ . /lib/functions/network.sh
+
local enable_cdp
local enable_fdp
local enable_sonmp
local enable_edp
local lldp_class
local lldp_location
+ local lldp_description
config_load 'lldpd'
config_get_bool enable_cdp 'config' 'enable_cdp' 0
@@ -20,6 +32,18 @@ start() {
config_get_bool enable_edp 'config' 'enable_edp' 0
config_get lldp_class 'config' 'lldp_class'
config_get lldp_location 'config' 'lldp_location'
+ config_get lldp_description 'config' 'lldp_description' "$(find_release_info)"
+
+ local ifaces
+ config_get ifaces 'config' 'interface'
+
+ 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}"
+ fi
+ done
[ $enable_cdp -gt 0 ] && append args '-c'
[ $enable_fdp -gt 0 ] && append args '-f'
@@ -33,7 +57,8 @@ start() {
chown lldp:lldp /var/run/lldp
service_start /usr/sbin/lldpd $args \
- ${lldp_class:+ -M $lldp_class}
+ ${lldp_class:+ -M $lldp_class} \
+ ${lldp_description:+ -S "$lldp_description"}
[ -n "$lldp_location" ] && {
sleep 1