[openwrt/openwrt] lldpd: add option to force EDP

LEDE Commits lede-commits at lists.infradead.org
Tue Sep 17 03:36:30 PDT 2024


robimarko pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/4ebd60b0835819a83f54ba5a8c34803cdff1ce66

commit 4ebd60b0835819a83f54ba5a8c34803cdff1ce66
Author: Stephen Howell <howels at allthatwemight.be>
AuthorDate: Sat Feb 3 14:16:09 2024 +0000

    lldpd: add option to force EDP
    
    allow EDP support if compiled and add force EDP option
    
    Signed-off-by: Stephen Howell <howels at allthatwemight.be>
    (cherry picked from commit d274867c217cade795537af93ff9b209e472e19c)
    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 | 22 +++++++++++++++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile
index bd01077b66..1f8d1e546b 100644
--- a/package/network/services/lldpd/Makefile
+++ b/package/network/services/lldpd/Makefile
@@ -76,7 +76,8 @@ ifneq ($(CONFIG_LLDPD_WITH_FDP),y)
 	sed -i -e '/fdp/d' $(1)/etc/config/lldpd
 endif
 ifneq ($(CONFIG_LLDPD_WITH_EDP),y)
-	sed -i -e '/edp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
+	sed -i -e 's/CONFIG_LLDPD_WITH_EDP=y/CONFIG_LLDPD_WITH_EDP=n/g' $(1)/etc/init.d/lldpd
+	sed -i -e '/edp/d' $(1)/etc/config/lldpd
 endif
 ifneq ($(CONFIG_LLDPD_WITH_SONMP),y)
 	sed -i -e 's/CONFIG_LLDPD_WITH_SONMP=y/CONFIG_LLDPD_WITH_SONMP=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 98769688ec..f90b4a237c 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -5,6 +5,7 @@ START=90
 STOP=01
 
 CONFIG_LLDPD_WITH_CDP=y
+CONFIG_LLDPD_WITH_EDP=y
 CONFIG_LLDPD_WITH_FDP=y
 CONFIG_LLDPD_WITH_LLDPMED=y
 CONFIG_LLDPD_WITH_SNMP=y
@@ -56,7 +57,10 @@ get_config_restart_hash() {
 		config_get_bool v 'config' 'force_cdp'; append _string "$v" ","
 		config_get_bool v 'config' 'force_cdpv2'; append _string "$v" ","
 	fi
-	config_get_bool v 'config' 'enable_edp'; append _string "$v" ","
+	if [ "$CONFIG_LLDPD_WITH_EDP" == "y" ]; then
+		config_get_bool v 'config' 'enable_edp'; append _string "$v" ","
+		config_get_bool v 'config' 'force_edp'; append _string "$v" ","
+	fi
 	if [ "$CONFIG_LLDPD_WITH_FDP" == "y" ]; then
 		config_get_bool v 'config' 'enable_fdp'; append _string "$v" ","
 		config_get_bool v 'config' 'force_fdp'; append _string "$v" ","
@@ -171,6 +175,7 @@ start_service() {
 	local enable_sonmp
 	local force_sonmp
 	local enable_edp
+	local force_edp
 	local lldp_class
 	local lldp_location
 	local lldp_no_version
@@ -196,7 +201,10 @@ start_service() {
 		config_get_bool enable_sonmp 'config' 'enable_sonmp' 0
 		config_get_bool force_sonmp 'config' 'force_sonmp' 0
 	fi
-	config_get_bool enable_edp 'config' 'enable_edp' 0
+	if [ "$CONFIG_LLDPD_WITH_EDP" == "y" ]; then
+		config_get_bool enable_edp 'config' 'enable_edp' 0
+		config_get_bool force_edp 'config' 'force_edp' 0
+	fi
 	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
@@ -271,7 +279,15 @@ start_service() {
 		fi
 	fi
 
-	[ $enable_edp -gt 0 ] && procd_append_param command '-e'
+	if [ "$CONFIG_LLDPD_WITH_EDP" == "y" ] && [ $enable_edp -gt 0 ]; then
+		if [ $force_edp -gt 0 ]; then
+			# EDP enbled and forced
+			procd_append_param command '-ee'
+		else
+			# EDP enbled
+			procd_append_param command '-e'
+		fi
+	fi
 
 	[ $readonly_mode -gt 0 ] && procd_append_param command '-r'
 	[ $lldp_no_version -gt 0 ] && procd_append_param commanpackage/network/services/lldpd/Makefile package/network/services/lldpd/files/lldpd.initd '-k'




More information about the lede-commits mailing list