[openwrt/openwrt] lldpd: add option to set system platform

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


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

commit b2008404abd3cad31a1999a0720e61453e453b67
Author: Stephen Howell <howels at allthatwemight.be>
AuthorDate: Sun Dec 17 00:34:37 2023 +0000

    lldpd: add option to set system platform
    
    add option to override system platform instead of using kernel name
    
    Signed-off-by: Stephen Howell <howels at allthatwemight.be>
    (cherry picked from commit 4159acceebeec646fb2ebecdd85561ba140f1ce4)
    Link: https://github.com/openwrt/openwrt/pull/15299
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 package/network/services/lldpd/files/lldpd.init | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
index 8e825e4f87..656128ef5d 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -122,6 +122,9 @@ write_lldpd_conf()
 	local lldp_portidsubtype
 	config_get lldp_portidsubtype 'config' 'lldp_portidsubtype' 'macaddress'
 
+	local lldp_platform
+	config_get lldp_platform 'config' 'lldp_platform' ""
+
 	# Clear out the config file first
 	echo -n > "$LLDPD_CONF"
 	[ -n "$ifnames" ] && echo "configure system interface pattern" "$ifnames" >> "$LLDPD_CONF"
@@ -138,6 +141,7 @@ write_lldpd_conf()
 	fi
 	[ -n "$lldp_agenttype" ] && echo "configure lldp agent-type" "\"$lldp_agenttype\"" >> "$LLDPD_CONF"
 	[ -n "$lldp_portidsubtype" ] && echo "configure lldp portidsubtype" "\"$lldp_portidsubtype\"" >> "$LLDPD_CONF"
+	[ -n "$lldp_platform" ] && echo "configure system platform" "\"$lldp_platform\"" >> "$LLDPD_CONF"
 
 	# Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR
 	[ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR
@@ -307,6 +311,7 @@ reload_service() {
 		unconfigure system description
 		unconfigure system hostname
 		unconfigure system ip management pattern
+		unconfigure system platform
 	EOF
 	if [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ]; then
 		$LLDPCLI -u $LLDPSOCKET &> /dev/null <<-EOF




More information about the lede-commits mailing list