From ea79fa018fcb7bca0b3aae64cdadd5e3208eb928 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Tue, 13 Oct 2026 05:19:28 +0200 Subject: [PATCH] lldp: add the firmware version to the system description The System Description TLV carried the model name alone, so an inventory built from LLDP could not tell which firmware a switch runs. Append the version string, as in "SWTGW218AS 8+1 Managed Switch v0.1.0-1856aeba". --- rtl837x_lldp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rtl837x_lldp.c b/rtl837x_lldp.c index 84208433..ecaf9dc6 100644 --- a/rtl837x_lldp.c +++ b/rtl837x_lldp.c @@ -9,6 +9,7 @@ #include "uip.h" #include "uip/uip.h" #include "machine.h" +#include "version.h" extern __xdata bool lldp_enabled; extern __code const struct machine machine; @@ -152,10 +153,14 @@ uint8_t lldp_sysname(__xdata uint8_t *p) __banked uint8_t lldp_sysdesc(__xdata uint8_t *p) __banked { - uint16_t machine_name_length = strlen(machine.machine_name); + uint8_t machine_name_length = strlen(machine.machine_name); + uint8_t version_length = strlen(VERSION_SW); *p++ = LLDP_TYPE(LLDP_SYSDESC_TLV_TYPE); - *p++ = machine_name_length; + *p++ = machine_name_length + 1 + version_length; memcpyc(p, machine.machine_name, machine_name_length); - return machine_name_length + 2; + p += machine_name_length; + *p++ = ' '; + memcpyc(p, VERSION_SW, version_length); + return machine_name_length + 1 + version_length + 2; }