From 4fc6de5df31c81ae35e82ed91d0a2ee515edad41 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 27 Jul 2015 18:04:46 +0200 Subject: lldp: add sd_lldp_tlv_packet_get_destination_type() It can be useful to know the destination address of a LLDP frame because it determines the scope of propagation of the frame and thus this information be used to know whether the neighbor is connected to the same physical link. See clause 7.1 of IEEE Std 802.1AB-2009. --- src/libsystemd-network/test-lldp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/libsystemd-network/test-lldp.c') diff --git a/src/libsystemd-network/test-lldp.c b/src/libsystemd-network/test-lldp.c index 26f64347a7..294198a0b5 100644 --- a/src/libsystemd-network/test-lldp.c +++ b/src/libsystemd-network/test-lldp.c @@ -202,6 +202,15 @@ static int lldp_parse_ttl_tlv(tlv_packet *m) { return 0; } +static int lldp_get_destination_type(tlv_packet *m) { + int dest; + + assert_se(sd_lldp_packet_get_destination_type(m, &dest) >= 0); + assert_se(dest == SD_LLDP_DESTINATION_TYPE_NEAREST_BRIDGE); + + return 0; +} + static int lldp_parse_tlv_packet(tlv_packet *m, int len) { uint8_t subtype; @@ -212,6 +221,8 @@ static int lldp_parse_tlv_packet(tlv_packet *m, int len) { assert_se(lldp_parse_ttl_tlv(m) >= 0); assert_se(lldp_parse_system_desc_tlv(m) >= 0); + assert_se(lldp_get_destination_type(m) >= 0); + return 0; } -- cgit v1.2.1