diff options
author | Eliot Lear <lear@upstairs.ofcourseimright.com> | 2016-12-30 14:44:16 +0100 |
---|---|---|
committer | Eliot Lear <lear@upstairs.ofcourseimright.com> | 2016-12-31 08:17:55 +0100 |
commit | 01e8e1485fd8253c288a55bcd78dcd8d0e609bb4 (patch) | |
tree | c035566b2f54719c0eda850df634e82a6f9b2934 /print-lldp.c | |
parent | 38fce5474fd8375aff201c6d07ef7b2835e55688 (diff) | |
download | tcpdump-01e8e1485fd8253c288a55bcd78dcd8d0e609bb4.tar.gz |
Implement IANA OUI and LLDP MUD option
The changes associated with this commit introduce the IANA subtree
for LLDP and its first element, the MUDURL, as documented in
draft-ietf-opsawg-mud. This is similar to the changes made for
DHCP and DHCPv6.
[updated to use fn_printn]
Diffstat (limited to 'print-lldp.c')
-rw-r--r-- | print-lldp.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/print-lldp.c b/print-lldp.c index e0539462..b7934861 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -601,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) @@ -914,6 +922,39 @@ 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=%.*s",tlv_len-4,tptr+4)); + break; + default: + hexdump=TRUE; + } + + return hexdump; +} + + + /* * Print private TIA extensions. */ @@ -1573,6 +1614,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; |