From 15e6259231226148a100e7107c09dccf033babd9 Mon Sep 17 00:00:00 2001 From: Stephen Howell Date: Sat, 16 Dec 2023 23:08:08 +0000 Subject: [PATCH] lldpd: option to disable LLDP-MED inventory TLV add option to disable LLDP-MED inventory TLV transmission Signed-off-by: Stephen Howell (cherry picked from commit 1753498b01d86b8d63349b01cb04026c07c343d9) Link: https://github.com/openwrt/openwrt/pull/15299 Signed-off-by: Robert Marko --- package/network/services/lldpd/Makefile | 4 ++++ package/network/services/lldpd/files/lldpd.init | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 289adc55c9..9e4ee0727e 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -82,6 +82,10 @@ endif ifneq ($(CONFIG_LLDPD_WITH_SNMP),y) sed -i -e '/agentxsocket/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd endif +ifneq ($(CONFIG_LLDPD_WITH_LLDPMED),y) + sed -i -e 's/CONFIG_LLDPD_WITH_LLDPMED=y/CONFIG_LLDPD_WITH_LLDPMED=n/g' $(1)/etc/init.d/lldpd + sed -i -e '/agentxsocket/d' $(1)/etc/config/lldpd +endif endef define Package/lldpd/conffiles diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 0456e7875e..4eca9ac8f4 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -4,6 +4,8 @@ START=90 STOP=01 +CONFIG_LLDPD_WITH_LLDPMED=y + USE_PROCD=1 LLDPDBIN=/usr/sbin/lldpd LLDPCLI=/usr/sbin/lldpcli @@ -37,6 +39,9 @@ get_config_restart_hash() { config_get v 'config' 'filter'; append _string "$v" "," config_get_bool v 'config' 'readonly_mode'; append _string "$v" "," config_get_bool v 'config' 'lldp_no_version'; append _string "$v" "," + if [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ]; then + config_get_bool v 'config' 'lldpmed_no_inventory'; append _string "$v" "," + fi config_get_bool v 'config' 'enable_lldp' 1; append _string "$v" "," config_get_bool v 'config' 'enable_cdp'; append _string "$v" "," config_get_bool v 'config' 'enable_edp'; append _string "$v" "," @@ -110,6 +115,7 @@ start_service() { local lldp_class local lldp_location local lldp_no_version + local lldpmed_no_inventory local readonly_mode local agentxsocket local filter @@ -122,6 +128,9 @@ start_service() { config_get lldp_class 'config' 'lldp_class' config_get lldp_location 'config' 'lldp_location' config_get_bool lldp_no_version 'config' 'lldp_no_version' 0 + if [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ]; then + config_get_bool lldpmed_no_inventory 'config' 'lldpmed_no_inventory' 0 + fi config_get_bool readonly_mode 'config' 'readonly_mode' 0 config_get agentxsocket 'config' 'agentxsocket' config_get filter 'config' 'filter' 15 @@ -142,6 +151,7 @@ start_service() { [ $enable_edp -gt 0 ] && procd_append_param command '-e' [ $readonly_mode -gt 0 ] && procd_append_param command '-r' [ $lldp_no_version -gt 0 ] && procd_append_param command '-k' + [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ] && [ $lldpmed_no_inventory -gt 0 ] && procd_append_param command '-i' [ -n "$lldp_class" ] && procd_append_param command -M "$lldp_class" [ -n "$agentxsocket" ] && procd_append_param command -x -X "$agentxsocket" [ -n "$filter" ] && procd_append_param command -H "$filter" -- 2.30.2