]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Implement IANA OUI and LLDP MUD option
authorEliot Lear <[email protected]>
Fri, 30 Dec 2016 13:44:16 +0000 (14:44 +0100)
committerEliot Lear <[email protected]>
Sat, 31 Dec 2016 07:17:55 +0000 (08:17 +0100)
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]

oui.c
oui.h
print-lldp.c
tests/TESTLIST
tests/lldp_mudurl-v.out [new file with mode: 0644]
tests/lldp_mudurl-vv.out [new file with mode: 0644]
tests/lldp_mudurl.pcap [new file with mode: 0644]

diff --git a/oui.c b/oui.c
index d00e7c5b0f6390c163b23516538f0e4279decdeb..1750799b6c85c1492d3ee2b83d770a8f2c2864d7 100644 (file)
--- a/oui.c
+++ b/oui.c
@@ -26,6 +26,7 @@
 const struct tok oui_values[] = {
     { OUI_ENCAP_ETHER, "Ethernet" },
     { OUI_CISCO, "Cisco" },
 const struct tok oui_values[] = {
     { OUI_ENCAP_ETHER, "Ethernet" },
     { OUI_CISCO, "Cisco" },
+    { OUI_IANA, "IANA"   },
     { OUI_NORTEL, "Nortel Networks SONMP" },
     { OUI_CISCO_90, "Cisco bridged" },
     { OUI_RFC2684, "Ethernet bridged" },
     { OUI_NORTEL, "Nortel Networks SONMP" },
     { OUI_CISCO_90, "Cisco bridged" },
     { OUI_RFC2684, "Ethernet bridged" },
diff --git a/oui.h b/oui.h
index 4a983ecd3de8891166e7b87d4d2a29b7ede75dff..d2fb4b209e7bcb97dbb0777cbf8409a2923432f2 100644 (file)
--- a/oui.h
+++ b/oui.h
@@ -18,6 +18,7 @@ extern const struct tok smi_values[];
 
 #define OUI_ENCAP_ETHER 0x000000        /* encapsulated Ethernet */
 #define OUI_CISCO       0x00000c        /* Cisco protocols */
 
 #define OUI_ENCAP_ETHER 0x000000        /* encapsulated Ethernet */
 #define OUI_CISCO       0x00000c        /* Cisco protocols */
+#define OUI_IANA        0x00005E       /* IANA */
 #define OUI_NORTEL      0x000081        /* Nortel SONMP */
 #define OUI_CISCO_90    0x0000f8        /* Cisco bridging */
 #define OUI_RFC2684     0x0080c2        /* RFC 2427/2684 bridged Ethernet */
 #define OUI_NORTEL      0x000081        /* Nortel SONMP */
 #define OUI_CISCO_90    0x0000f8        /* Cisco bridging */
 #define OUI_RFC2684     0x0080c2        /* RFC 2427/2684 bridged Ethernet */
index e05394626e2d759ef27cd98163a682d72986dcaa..b7934861df1cbb0b7b3cd5b5f700ec85046d0a05 100644 (file)
@@ -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_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)
 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;
 }
 
     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.
  */
 /*
  * 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_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;
                 case OUI_TIA:
                     hexdump = lldp_private_tia_print(ndo, tptr, tlv_len);
                     break;
index 9aaffefa69d72dc873c98641dcf599443b62f5a9..4025047b736b0630d08e57482f93bd7258d66298 100644 (file)
@@ -264,6 +264,8 @@ lacp-ev             LACP.pcap               lacp-ev.out             -t -e -v
 lldp_cdp-ev    LLDP_and_CDP.pcap       lldp_cdp-ev.out         -t -e -v
 cdp-v          3560_CDP.pcap           cdp-v.out               -t -v
 udld-v         UDLD.pcap               udld-v.out              -t -v
 lldp_cdp-ev    LLDP_and_CDP.pcap       lldp_cdp-ev.out         -t -e -v
 cdp-v          3560_CDP.pcap           cdp-v.out               -t -v
 udld-v         UDLD.pcap               udld-v.out              -t -v
+lldp_mud-v     lldp_mudurl.pcap        lldp_mudurl-v.out       -t -e -v
+lldp_mud-vv    lldp_mudurl.pcap        lldp_mudurl-vv.out      -t -e -vv
 
 # EIGRP tests
 eigrp1-v       EIGRP_adjacency.pcap    eigrp1-v.out    -t -v
 
 # EIGRP tests
 eigrp1-v       EIGRP_adjacency.pcap    eigrp1-v.out    -t -v
diff --git a/tests/lldp_mudurl-v.out b/tests/lldp_mudurl-v.out
new file mode 100644 (file)
index 0000000..57ac6ff
--- /dev/null
@@ -0,0 +1,62 @@
+00:23:54:c2:57:02 > 01:80:c2:00:00:0e, ethertype LLDP (0x88cc), length 302: LLDP, length 288
+       Chassis ID TLV (1), length 7
+         Subtype MAC address (4): 00:23:54:c2:57:02
+       Port ID TLV (2), length 7
+         Subtype MAC address (3): 00:23:54:c2:57:02
+       Time to Live TLV (3), length 2: TTL 120s
+       System Name TLV (5), length 28: upstairs.ofcourseimright.com
+       System Description TLV (6), length 92
+         Ubuntu 14.04.5 LTS Linux 3.13.0-106-generic #153-Ubuntu SMP Tue Dec 6 15:45:13 UTC 2016 i686
+       System Capabilities TLV (7), length 4
+         System  Capabilities [Bridge, WLAN AP, Router, Station Only] (0x009c)
+         Enabled Capabilities [WLAN AP] (0x0008)
+       Management Address TLV (8), length 12
+         Management Address length 5, AFI IPv4 (1): 62.12.173.114
+         Interface Index Interface Numbering (2): 2
+       Management Address TLV (8), length 24
+         Management Address length 17, AFI IPv6 (2): 2001:8a8:1006:4:223:54ff:fec2:5702
+         Interface Index Interface Numbering (2): 2
+       Port Description TLV (4), length 4: eth0
+       Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
+         Link aggregation Subtype (3)
+           aggregation status [supported], aggregation port ID 0
+       Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
+         MAC/PHY configuration/status Subtype (1)
+           autonegotiation [supported, enabled] (0x03)
+           PMD autoneg capability [10BASE-T hdx, 10BASE-T fdx, 100BASE-TX hdx, 100BASE-TX fdx, Pause for fdx links, Asym PAUSE for fdx, 1000BASE-T hdx, 1000BASE-T fdx] (0xecc3)
+           MAU type 100BASETX fdx (0x0010)
+       Organization specific TLV (127), length 64: OUI IANA (0x00005e)
+         MUD-URL Subtype (1)
+         MUD-URL=https://imright.mud.example.com/.well-known/mud/v1/vomitv2.0
+       End TLV (0), length 0
+00:23:54:c2:57:02 > 01:80:c2:00:00:0e, ethertype LLDP (0x88cc), length 302: LLDP, length 288
+       Chassis ID TLV (1), length 7
+         Subtype MAC address (4): 00:23:54:c2:57:02
+       Port ID TLV (2), length 7
+         Subtype MAC address (3): 00:23:54:c2:57:02
+       Time to Live TLV (3), length 2: TTL 120s
+       System Name TLV (5), length 28: upstairs.ofcourseimright.com
+       System Description TLV (6), length 92
+         Ubuntu 14.04.5 LTS Linux 3.13.0-106-generic #153-Ubuntu SMP Tue Dec 6 15:45:13 UTC 2016 i686
+       System Capabilities TLV (7), length 4
+         System  Capabilities [Bridge, WLAN AP, Router, Station Only] (0x009c)
+         Enabled Capabilities [WLAN AP] (0x0008)
+       Management Address TLV (8), length 12
+         Management Address length 5, AFI IPv4 (1): 62.12.173.114
+         Interface Index Interface Numbering (2): 2
+       Management Address TLV (8), length 24
+         Management Address length 17, AFI IPv6 (2): 2001:8a8:1006:4:223:54ff:fec2:5702
+         Interface Index Interface Numbering (2): 2
+       Port Description TLV (4), length 4: eth0
+       Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
+         Link aggregation Subtype (3)
+           aggregation status [supported], aggregation port ID 0
+       Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
+         MAC/PHY configuration/status Subtype (1)
+           autonegotiation [supported, enabled] (0x03)
+           PMD autoneg capability [10BASE-T hdx, 10BASE-T fdx, 100BASE-TX hdx, 100BASE-TX fdx, Pause for fdx links, Asym PAUSE for fdx, 1000BASE-T hdx, 1000BASE-T fdx] (0xecc3)
+           MAU type 100BASETX fdx (0x0010)
+       Organization specific TLV (127), length 64: OUI IANA (0x00005e)
+         MUD-URL Subtype (1)
+         MUD-URL=https://imright.mud.example.com/.well-known/mud/v1/vomitv2.0
+       End TLV (0), length 0
diff --git a/tests/lldp_mudurl-vv.out b/tests/lldp_mudurl-vv.out
new file mode 100644 (file)
index 0000000..5564898
--- /dev/null
@@ -0,0 +1,106 @@
+00:23:54:c2:57:02 > 01:80:c2:00:00:0e, ethertype LLDP (0x88cc), length 302: LLDP, length 288
+       Chassis ID TLV (1), length 7
+         Subtype MAC address (4): 00:23:54:c2:57:02
+         0x0000:  0400 2354 c257 02
+       Port ID TLV (2), length 7
+         Subtype MAC address (3): 00:23:54:c2:57:02
+         0x0000:  0300 2354 c257 02
+       Time to Live TLV (3), length 2: TTL 120s
+         0x0000:  0078
+       System Name TLV (5), length 28: upstairs.ofcourseimright.com
+         0x0000:  7570 7374 6169 7273 2e6f 6663 6f75 7273
+         0x0010:  6569 6d72 6967 6874 2e63 6f6d
+       System Description TLV (6), length 92
+         Ubuntu 14.04.5 LTS Linux 3.13.0-106-generic #153-Ubuntu SMP Tue Dec 6 15:45:13 UTC 2016 i686
+         0x0000:  5562 756e 7475 2031 342e 3034 2e35 204c
+         0x0010:  5453 204c 696e 7578 2033 2e31 332e 302d
+         0x0020:  3130 362d 6765 6e65 7269 6320 2331 3533
+         0x0030:  2d55 6275 6e74 7520 534d 5020 5475 6520
+         0x0040:  4465 6320 3620 3135 3a34 353a 3133 2055
+         0x0050:  5443 2032 3031 3620 6936 3836
+       System Capabilities TLV (7), length 4
+         System  Capabilities [Bridge, WLAN AP, Router, Station Only] (0x009c)
+         Enabled Capabilities [WLAN AP] (0x0008)
+         0x0000:  009c 0008
+       Management Address TLV (8), length 12
+         Management Address length 5, AFI IPv4 (1): 62.12.173.114
+         Interface Index Interface Numbering (2): 2
+         0x0000:  0501 3e0c ad72 0200 0000 0200
+       Management Address TLV (8), length 24
+         Management Address length 17, AFI IPv6 (2): 2001:8a8:1006:4:223:54ff:fec2:5702
+         Interface Index Interface Numbering (2): 2
+         0x0000:  1102 2001 08a8 1006 0004 0223 54ff fec2
+         0x0010:  5702 0200 0000 0200
+       Port Description TLV (4), length 4: eth0
+         0x0000:  6574 6830
+       Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
+         Link aggregation Subtype (3)
+           aggregation status [supported], aggregation port ID 0
+         0x0000:  0012 0f03 0100 0000 00
+       Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
+         MAC/PHY configuration/status Subtype (1)
+           autonegotiation [supported, enabled] (0x03)
+           PMD autoneg capability [10BASE-T hdx, 10BASE-T fdx, 100BASE-TX hdx, 100BASE-TX fdx, Pause for fdx links, Asym PAUSE for fdx, 1000BASE-T hdx, 1000BASE-T fdx] (0xecc3)
+           MAU type 100BASETX fdx (0x0010)
+         0x0000:  0012 0f01 03ec c300 10
+       Organization specific TLV (127), length 64: OUI IANA (0x00005e)
+         MUD-URL Subtype (1)
+         MUD-URL=https://imright.mud.example.com/.well-known/mud/v1/vomitv2.0
+         0x0000:  0000 5e01 6874 7470 733a 2f2f 696d 7269
+         0x0010:  6768 742e 6d75 642e 6578 616d 706c 652e
+         0x0020:  636f 6d2f 2e77 656c 6c2d 6b6e 6f77 6e2f
+         0x0030:  6d75 642f 7631 2f76 6f6d 6974 7632 2e30
+       End TLV (0), length 0
+00:23:54:c2:57:02 > 01:80:c2:00:00:0e, ethertype LLDP (0x88cc), length 302: LLDP, length 288
+       Chassis ID TLV (1), length 7
+         Subtype MAC address (4): 00:23:54:c2:57:02
+         0x0000:  0400 2354 c257 02
+       Port ID TLV (2), length 7
+         Subtype MAC address (3): 00:23:54:c2:57:02
+         0x0000:  0300 2354 c257 02
+       Time to Live TLV (3), length 2: TTL 120s
+         0x0000:  0078
+       System Name TLV (5), length 28: upstairs.ofcourseimright.com
+         0x0000:  7570 7374 6169 7273 2e6f 6663 6f75 7273
+         0x0010:  6569 6d72 6967 6874 2e63 6f6d
+       System Description TLV (6), length 92
+         Ubuntu 14.04.5 LTS Linux 3.13.0-106-generic #153-Ubuntu SMP Tue Dec 6 15:45:13 UTC 2016 i686
+         0x0000:  5562 756e 7475 2031 342e 3034 2e35 204c
+         0x0010:  5453 204c 696e 7578 2033 2e31 332e 302d
+         0x0020:  3130 362d 6765 6e65 7269 6320 2331 3533
+         0x0030:  2d55 6275 6e74 7520 534d 5020 5475 6520
+         0x0040:  4465 6320 3620 3135 3a34 353a 3133 2055
+         0x0050:  5443 2032 3031 3620 6936 3836
+       System Capabilities TLV (7), length 4
+         System  Capabilities [Bridge, WLAN AP, Router, Station Only] (0x009c)
+         Enabled Capabilities [WLAN AP] (0x0008)
+         0x0000:  009c 0008
+       Management Address TLV (8), length 12
+         Management Address length 5, AFI IPv4 (1): 62.12.173.114
+         Interface Index Interface Numbering (2): 2
+         0x0000:  0501 3e0c ad72 0200 0000 0200
+       Management Address TLV (8), length 24
+         Management Address length 17, AFI IPv6 (2): 2001:8a8:1006:4:223:54ff:fec2:5702
+         Interface Index Interface Numbering (2): 2
+         0x0000:  1102 2001 08a8 1006 0004 0223 54ff fec2
+         0x0010:  5702 0200 0000 0200
+       Port Description TLV (4), length 4: eth0
+         0x0000:  6574 6830
+       Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
+         Link aggregation Subtype (3)
+           aggregation status [supported], aggregation port ID 0
+         0x0000:  0012 0f03 0100 0000 00
+       Organization specific TLV (127), length 9: OUI IEEE 802.3 Private (0x00120f)
+         MAC/PHY configuration/status Subtype (1)
+           autonegotiation [supported, enabled] (0x03)
+           PMD autoneg capability [10BASE-T hdx, 10BASE-T fdx, 100BASE-TX hdx, 100BASE-TX fdx, Pause for fdx links, Asym PAUSE for fdx, 1000BASE-T hdx, 1000BASE-T fdx] (0xecc3)
+           MAU type 100BASETX fdx (0x0010)
+         0x0000:  0012 0f01 03ec c300 10
+       Organization specific TLV (127), length 64: OUI IANA (0x00005e)
+         MUD-URL Subtype (1)
+         MUD-URL=https://imright.mud.example.com/.well-known/mud/v1/vomitv2.0
+         0x0000:  0000 5e01 6874 7470 733a 2f2f 696d 7269
+         0x0010:  6768 742e 6d75 642e 6578 616d 706c 652e
+         0x0020:  636f 6d2f 2e77 656c 6c2d 6b6e 6f77 6e2f
+         0x0030:  6d75 642f 7631 2f76 6f6d 6974 7632 2e30
+       End TLV (0), length 0
diff --git a/tests/lldp_mudurl.pcap b/tests/lldp_mudurl.pcap
new file mode 100644 (file)
index 0000000..49d83a3
Binary files /dev/null and b/tests/lldp_mudurl.pcap differ