lldpd: implement lldp_policy parameter
authorPaul Donald <newtwen@gmail.com>
Thu, 8 Feb 2024 19:35:31 +0000 (20:35 +0100)
committerRobert Marko <robimarko@gmail.com>
Tue, 12 Mar 2024 19:39:06 +0000 (20:39 +0100)
For certain lldp_class scenarios (2 & 3) a policy must be set also.
Class 4 is default, although it's good to handle the policy eventuality.

Here, set a default lldp_policy for all lldp_class scenarios. Any
lldp_policy can now be set.

Depends on PR #14584 (which introduced an `if` block)

Tested on 22.03.5, 22.03.6

Signed-off-by: Paul Donald <newtwen@gmail.com>
package/network/services/lldpd/Makefile
package/network/services/lldpd/files/lldpd.config
package/network/services/lldpd/files/lldpd.init

index 1f8d1e546b0d5c0518fbb8fb7d4cc7d4ee09efb8..ffe2a8d01525455c174595af98bf205de9302f5c 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=lldpd
 PKG_VERSION:=1.0.17
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/
index fa9fe2b4f89abff183131a7b7f382b5e798612dd..6df3f73bf727e53b9d41ea6453e51ac2b148809a 100644 (file)
@@ -7,6 +7,8 @@ config lldpd config
        option agentxsocket /var/run/agentx.sock
 
        option lldp_class 4
+       # lldp_policy only needed for lldp_class 2-3
+       # option lldp_policy 'application streaming-video unknown'
        option lldp_location "address country EU"
 
        # if empty, the distribution description is sent
index 498c9e615e8fca2e6f9ebb40776654f1b01e9bdf..0ba438c379f110885ce198bff4680d08c31d3590 100644 (file)
@@ -118,6 +118,12 @@ write_lldpd_conf()
                local lldp_location
                config_get lldp_location 'config' 'lldp_location'
 
+               local lldp_class
+               config_get lldp_class 'config' 'lldp_class'
+
+               local lldp_policy
+               config_get lldp_policy 'config' 'lldp_policy'
+
        fi
 
        local lldp_agenttype
@@ -154,6 +160,12 @@ write_lldpd_conf()
 
                [ -n "$lldp_location" ] && echo "configure med location" "$lldp_location" >> "$LLDPD_CONF"
 
+               # Manual states that if Class (-M) is 2 or 3, at least one network policy must be defined
+               case "$lldp_class" in
+                       2 | 3 ) [ -n "$lldp_policy" ] && echo "configure med policy $lldp_policy" >> "$LLDPD_CONF"
+                       ;;
+               esac
+
        fi
 
        [ -n "$lldp_agenttype" ] && echo "configure lldp agent-type" "\"$lldp_agenttype\"" >> "$LLDPD_CONF"