sd-lldp-rx: add VLAN ID parsing (#37725)

While the `port_vlan_id` field was already present in the
`sd_lldp_neighbor`, it wasn't currently parsed from the LLDP packet.
Added support for that as well as a small parsing test.

Closes #28354.
This commit is contained in:
Yu Watanabe
2025-06-06 19:12:48 +09:00
committed by GitHub
6 changed files with 98 additions and 5 deletions
+2
View File
@@ -44,6 +44,7 @@ typedef struct LLDPNeighborInfo {
const char *system_name;
const char *system_description;
uint16_t capabilities;
uint16_t vlan_id;
} LLDPNeighborInfo;
static const sd_json_dispatch_field lldp_neighbor_dispatch_table[] = {
@@ -53,6 +54,7 @@ static const sd_json_dispatch_field lldp_neighbor_dispatch_table[] = {
{ "SystemName", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LLDPNeighborInfo, system_name), 0 },
{ "SystemDescription", SD_JSON_VARIANT_STRING, sd_json_dispatch_const_string, offsetof(LLDPNeighborInfo, system_description), 0 },
{ "EnabledCapabilities", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint16, offsetof(LLDPNeighborInfo, capabilities), 0 },
{ "VlanID", _SD_JSON_VARIANT_TYPE_INVALID, sd_json_dispatch_uint16, offsetof(LLDPNeighborInfo, vlan_id), 0 },
{},
};