From dc16de3204d1956d4fd17808e6d34ac926bbe932 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sun, 5 Feb 2023 13:07:30 +0000 Subject: [lldp] Add support for the Link Layer Discovery Protocol Add support for recording LLDP packets and exposing TLV values via the settings mechanism. LLDP settings are encoded as ${netX.lldp/....} where is the TLV type is the starting offset within the TLV value is the length (or zero to read the from to the end) , if it has a non-zero value, is the subtype byte string of length to match at the start of the TLV value, up to a maximum matched length of 4 bytes is the index of the entry matching and to be accessed, with zero indicating the first matching entry The is designed to accommodate both matching of the OUI within an organization-specific TLV (e.g. 0x0080c2 for IEEE 802.1 TLVs) and of a subtype byte as found within many TLVs. This encoding allows most LLDP values to be extracted easily. For example System name: ${netX.lldp/5.0.0.0:string} System description: ${netX.lldp/6.0.0.0:string} Port description: ${netX.lldp/4.0.0.0:string} Port interface name: ${netX.lldp/5.2.0.1.0:string} Chassis MAC address: ${netX.lldp/4.1.0.1.0:hex} Management IPv4 address: ${netX.lldp/5.1.8.0.2.4:ipv4} Port VLAN ID: ${netX.lldp/0x0080c2.1.127.0.4.2:int16} Port VLAN name: ${netX.lldp/0x0080c2.3.127.0.7.0:string} Maximum frame size: ${netX.lldp/0x00120f.4.127.0.4.2:uint16} Originally-implemented-by: Marin Hannache Signed-off-by: Michael Brown --- src/config/config_ethernet.c | 3 +++ src/config/general.h | 1 + 2 files changed, 4 insertions(+) (limited to 'src/config') diff --git a/src/config/config_ethernet.c b/src/config/config_ethernet.c index 8a663c923..c1b35bfe6 100644 --- a/src/config/config_ethernet.c +++ b/src/config/config_ethernet.c @@ -49,3 +49,6 @@ REQUIRE_OBJECT ( eth_slow ); #ifdef NET_PROTO_EAPOL REQUIRE_OBJECT ( eapol ); #endif +#ifdef NET_PROTO_LLDP +REQUIRE_OBJECT ( lldp ); +#endif diff --git a/src/config/general.h b/src/config/general.h index 2d15f500a..e9ceaff57 100644 --- a/src/config/general.h +++ b/src/config/general.h @@ -40,6 +40,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #define NET_PROTO_STP /* Spanning Tree protocol */ #define NET_PROTO_LACP /* Link Aggregation control protocol */ #define NET_PROTO_EAPOL /* EAP over LAN protocol */ +#undef NET_PROTO_LLDP /* Link Layer Discovery protocol */ /* * PXE support -- cgit v1.2.3-55-g7522