[openwrt/openwrt] lldpd: only use snmp options when compiled in
LEDE Commits
lede-commits at lists.infradead.org
Tue Sep 17 03:36:29 PDT 2024
robimarko pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/13193cb070353dba1c276a79e6f0ec9c2e5a3001
commit 13193cb070353dba1c276a79e6f0ec9c2e5a3001
Author: Stephen Howell <howels at allthatwemight.be>
AuthorDate: Sat Feb 3 13:51:49 2024 +0000
lldpd: only use snmp options when compiled in
prevent SNMP options being passed unless lldpd supports them
Signed-off-by: Stephen Howell <howels at allthatwemight.be>
(cherry picked from commit 8b2d02e48cd2559a52e1cbf04143028e50da6a88)
Link: https://github.com/openwrt/openwrt/pull/15299
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
package/network/services/lldpd/Makefile | 3 ++-
package/network/services/lldpd/files/lldpd.init | 11 ++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile
index fa4143c713..bd01077b66 100644
--- a/package/network/services/lldpd/Makefile
+++ b/package/network/services/lldpd/Makefile
@@ -83,7 +83,8 @@ ifneq ($(CONFIG_LLDPD_WITH_SONMP),y)
sed -i -e '/sonmp/d' $(1)/etc/config/lldpd
endif
ifneq ($(CONFIG_LLDPD_WITH_SNMP),y)
- sed -i -e '/agentxsocket/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
+ sed -i -e 's/CONFIG_LLDPD_WITH_SNMP=y/CONFIG_LLDPD_WITH_SNMP=n/g' $(1)/etc/init.d/lldpd
+ sed -i -e '/agentxsocket/d' $(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
diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
index b69ec16086..98769688ec 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -7,6 +7,7 @@ STOP=01
CONFIG_LLDPD_WITH_CDP=y
CONFIG_LLDPD_WITH_FDP=y
CONFIG_LLDPD_WITH_LLDPMED=y
+CONFIG_LLDPD_WITH_SNMP=y
CONFIG_LLDPD_WITH_SONMP=y
USE_PROCD=1
@@ -37,7 +38,9 @@ get_config_restart_hash() {
config_load 'lldpd'
config_get v 'config' 'lldp_class'; append _string "$v" ","
- config_get v 'config' 'agentxsocket'; append _string "$v" ","
+ if [ "$CONFIG_LLDPD_WITH_SNMP" == "y" ]; then
+ config_get v 'config' 'agentxsocket'; append _string "$v" ","
+ fi
config_get v 'config' 'cid_interface'; append _string "$v" ","
config_get v 'config' 'filter'; append _string "$v" ","
config_get_bool v 'config' 'readonly_mode'; append _string "$v" ","
@@ -201,7 +204,9 @@ start_service() {
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'
+ if [ "$CONFIG_LLDPD_WITH_SNMP" == "y" ]; then
+ config_get agentxsocket 'config' 'agentxsocket'
+ fi
config_get filter 'config' 'filter' 15
mkdir -p ${LLDPD_RUN}
@@ -272,7 +277,7 @@ start_service() {
[ $lldp_no_version -gt 0 ] && procd_append_param commanpackage/network/services/lldpd/Makefile package/network/services/lldpd/files/lldpd.initd '-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"
+ [ "$CONFIG_LLDPD_WITH_SNMP" == "y" ] && [ -n "$agentxsocket" ] && procd_append_param command -x -X "$agentxsocket"
[ -n "$filter" ] && procd_append_param command -H "$filter"
# ChassisID interfaces
More information about the lede-commits
mailing list