mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-11-01 18:04:12 +08:00
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".
This commit is contained in:
1 parent
1856aeba28
commit
ea79fa018f
1 file changed
+8
-3
+8
-3
@@ -9,6 +9,7 @@
|
|||||||
#include "uip.h"
|
#include "uip.h"
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
extern __xdata bool lldp_enabled;
|
extern __xdata bool lldp_enabled;
|
||||||
extern __code const struct machine machine;
|
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
|
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++ = 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);
|
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;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user