summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-lldp.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2017-02-10 07:22:12 +0000
committerglebius <glebius@FreeBSD.org>2017-02-10 07:22:12 +0000
commitad0c9114e00a9a30168e0c13c17d8f65571aa67f (patch)
treecb3a133c7e3d0cba63195c130f2f7543735cd2a1 /contrib/tcpdump/print-lldp.c
parent84761e71d50647a6c1a71f36b39a73c2fbe8c558 (diff)
downloadFreeBSD-src-ad0c9114e00a9a30168e0c13c17d8f65571aa67f.zip
FreeBSD-src-ad0c9114e00a9a30168e0c13c17d8f65571aa67f.tar.gz
Merge r309649, r313048, r313083, r313104:
tcpdump 4.9.0
Diffstat (limited to 'contrib/tcpdump/print-lldp.c')
-rw-r--r--contrib/tcpdump/print-lldp.c58
1 files changed, 51 insertions, 7 deletions
diff --git a/contrib/tcpdump/print-lldp.c b/contrib/tcpdump/print-lldp.c
index ce3c093..730b36f 100644
--- a/contrib/tcpdump/print-lldp.c
+++ b/contrib/tcpdump/print-lldp.c
@@ -12,23 +12,22 @@
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
- * support for the IEEE Link Discovery Protocol as per 802.1AB
- *
* Original code by Hannes Gredler (hannes@juniper.net)
* IEEE and TIA extensions by Carles Kishimoto <carles.kishimoto@gmail.com>
* DCBX extensions by Kaladhar Musunuru <kaladharm@sourceforge.net>
*/
-#define NETDISSECT_REWORKED
+/* \summary: IEEE 802.1ab Link Layer Discovery Protocol (LLDP) printer */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
#include <stdio.h>
-#include "interface.h"
+#include "netdissect.h"
#include "extract.h"
#include "addrtoname.h"
#include "af.h"
@@ -602,6 +601,14 @@ static const struct tok lldp_evb_mode_values[]={
#define LLDP_PRIVATE_8021_SUBTYPE_EVB_LENGTH 9
#define LLDP_PRIVATE_8021_SUBTYPE_CDCP_MIN_LENGTH 8
+#define LLDP_IANA_SUBTYPE_MUDURL 1
+
+static const struct tok lldp_iana_subtype_values[] = {
+ { LLDP_IANA_SUBTYPE_MUDURL, "MUD-URL" },
+ { 0, NULL }
+};
+
+
static void
print_ets_priority_assignment_table(netdissect_options *ndo,
const u_char *ptr)
@@ -915,6 +922,40 @@ lldp_extract_latlon(const u_char *tptr)
return latlon;
}
+/* objects defined in IANA subtype 00 00 5e
+ * (right now there is only one)
+ */
+
+
+static int
+lldp_private_iana_print(netdissect_options *ndo,
+ const u_char *tptr, u_int tlv_len)
+{
+ int subtype, hexdump = FALSE;
+
+ if (tlv_len < 8) {
+ return hexdump;
+ }
+ subtype = *(tptr+3);
+
+ ND_PRINT((ndo, "\n\t %s Subtype (%u)",
+ tok2str(lldp_iana_subtype_values, "unknown", subtype),
+ subtype));
+
+ switch (subtype) {
+ case LLDP_IANA_SUBTYPE_MUDURL:
+ ND_PRINT((ndo, "\n\t MUD-URL="));
+ (void)fn_printn(ndo, tptr+4, tlv_len-4, NULL);
+ break;
+ default:
+ hexdump=TRUE;
+ }
+
+ return hexdump;
+}
+
+
+
/*
* Print private TIA extensions.
*/
@@ -1279,15 +1320,15 @@ lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len)
case AFNUM_INET:
if (len < 4)
return NULL;
+ /* This cannot be assigned to ipaddr_string(), which is a macro. */
pfunc = getname;
break;
-#ifdef INET6
case AFNUM_INET6:
if (len < 16)
return NULL;
+ /* This cannot be assigned to ip6addr_string(), which is a macro. */
pfunc = getname6;
break;
-#endif
case AFNUM_802:
if (len < 6)
return NULL;
@@ -1574,6 +1615,9 @@ lldp_print(netdissect_options *ndo,
case OUI_IEEE_8023_PRIVATE:
hexdump = lldp_private_8023_print(ndo, tptr, tlv_len);
break;
+ case OUI_IANA:
+ hexdump = lldp_private_iana_print(ndo, tptr, tlv_len);
+ break;
case OUI_TIA:
hexdump = lldp_private_tia_print(ndo, tptr, tlv_len);
break;
OpenPOWER on IntegriCloud