diff mbox series

[5/7] lldpd: make capabilities advertisement controllable

Message ID 20240402130221.58706-5-newtwen+github@gmail.com
State New
Headers show
Series [1/7] lldpd: fixed interface(s) parsing | expand

Commit Message

Paul Donald April 2, 2024, 1:02 p.m. UTC
Defaults to off.

Only available from >= 1.0.15

These capabilities are sent in TLV.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
---
 package/network/services/lldpd/files/lldpd.init | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jo-Philipp Wich April 2, 2024, 11:21 p.m. UTC | #1
Hi,

comment below.

Am 4/2/24 um 15:02 schrieb Paul Donald:
> Defaults to off.
> 
> Only available from >= 1.0.15
> 
> These capabilities are sent in TLV.
> 
> Signed-off-by: Paul Donald <newtwen+github@gmail.com>
> ---
>   package/network/services/lldpd/files/lldpd.init | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
> index 284c37c2ef..3e804cd033 100644
> --- a/package/network/services/lldpd/files/lldpd.init
> +++ b/package/network/services/lldpd/files/lldpd.init
> @@ -124,6 +124,10 @@ write_lldpd_conf()
>   	local lldp_syscapabilities
>   	config_get lldp_syscapabilities 'config' 'lldp_syscapabilities'
>   
> +	# Configurable capabilities in lldpd >= v1.0.15
> +	local lldp_capadv
> +	config_get_bool lldp_capadv 'config' 'lldp_capadv' 0

Can we at least try to aim for some consistency here? Most preexisting options 
are spelled out, even the other capability related option right next does not 
abbreviate "capabilities", so this new option should likely be called 
"lldp_advcapabilities". Also "adv" is ambiguous, could be interpreted as 
"advanced" instead of "advertise" without further context, so consider naming 
it "lldp_capability_advertisement" or similar.

~ Jo
diff mbox series

Patch

diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init
index 284c37c2ef..3e804cd033 100644
--- a/package/network/services/lldpd/files/lldpd.init
+++ b/package/network/services/lldpd/files/lldpd.init
@@ -124,6 +124,10 @@  write_lldpd_conf()
 	local lldp_syscapabilities
 	config_get lldp_syscapabilities 'config' 'lldp_syscapabilities'
 
+	# Configurable capabilities in lldpd >= v1.0.15
+	local lldp_capadv
+	config_get_bool lldp_capadv 'config' 'lldp_capadv' 0
+
 	if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then
 		local lldpmed_fast_start
 		config_get_bool lldpmed_fast_start 'config' 'lldpmed_fast_start' 0
@@ -164,6 +168,7 @@  write_lldpd_conf()
 	[ -n "$lldp_hostname" ] && echo "configure system hostname" "\"$lldp_hostname\"" >> "$LLDPD_CONF"
 	[ -n "$lldp_mgmt_ip" ] && echo "configure system ip management pattern" "\"$lldp_mgmt_ip\"" >> "$LLDPD_CONF"
 	[ -n "$lldp_syscapabilities" ] && echo "configure system capabilities enabled $lldp_syscapabilities" >> "$LLDPD_CONF"
+
 	if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ] && [ "$lldpmed_fast_start" -gt 0 ]; then
 		if [ "$lldpmed_fast_start_tx_interval" -gt 0 ]; then
 			echo "configure med fast-start tx-interval $lldpmed_fast_start_tx_interval" >> "$LLDPD_CONF"
@@ -189,6 +194,7 @@  write_lldpd_conf()
 	[ -n "$lldp_platform" ] && echo "configure system platform" "\"$lldp_platform\"" >> "$LLDPD_CONF"
 	[ -n "$lldp_tx_interval" ] && echo "configure lldp tx-interval $lldp_tx_interval" >> "$LLDPD_CONF"
 	[ "$lldp_tx_hold" -gt 0 ] && echo "configure lldp tx-hold $lldp_tx_hold" >> "$LLDPD_CONF"
+	[ "$lldp_capadv" -gt 0 ] && echo "configure lldp capabilities-advertisements" >> "$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"
@@ -367,6 +373,7 @@  reload_service() {
 	$LLDPCLI -u "$LLDPSOCKET" >/dev/null 2>&1 <<-EOF
 		pause
 		unconfigure lldp custom-tlv
+		unconfigure lldp capabilities-advertisements
 		unconfigure system interface pattern
 		unconfigure system description
 		unconfigure system hostname