]> The Tcpdump Group git mirrors - tcpdump/commitdiff
OpenFlow: add vendor name printing
authorDenis Ovsienko <[email protected]>
Thu, 11 Dec 2014 23:49:30 +0000 (23:49 +0000)
committerDenis Ovsienko <[email protected]>
Sat, 13 Dec 2014 18:06:04 +0000 (18:06 +0000)
The new function goes into print-openflow.c as vendor name decoding is
the same in all versions of OpenFlow (although in 1.0 it is "vendor"
and in subsequent versions it is "experimenter"). The mapping is from:

https://rs.opennetworking.org/wiki/display/PUBLIC/ONF+Registry

openflow.h
oui.c
oui.h
print-openflow-1.0.c
print-openflow.c
tests/of10_7050q-v.out
tests/of10_p3295-vv.out

index d330f1ecf0a9b12cef74002fcb3395a1d397aaed..31ef03c425234728aecd76aacece56643f33904b 100644 (file)
 
 #define OF_HEADER_LEN 8
 
+#define ONF_EXP_ONF               0x4f4e4600
+#define ONF_EXP_BUTE              0xff000001
+#define ONF_EXP_NOVIFLOW          0xff000002
+#define ONF_EXP_L3                0xff000003
+#define ONF_EXP_L4L7              0xff000004
+#define ONF_EXP_WMOB              0xff000005
+#define ONF_EXP_FABS              0xff000006
+#define ONF_EXP_OTRANS            0xff000007
+extern const struct tok onf_exp_str[];
+
 /*
  * Routines to print packets for various versions of OpenFlow.
  */
 extern const u_char *of10_header_body_print(netdissect_options *ndo,
        const u_char *, const u_char *,
        const uint8_t, const uint16_t, const uint32_t);
+extern const char * of_vendor_name(const uint32_t);
diff --git a/oui.c b/oui.c
index a6d5787f79b92bcee540eb92036b9ebf9b82bba7..2aea5ad74d0ac5c9824bc5396210841dfaec93ac 100644 (file)
--- a/oui.c
+++ b/oui.c
@@ -39,6 +39,15 @@ const struct tok oui_values[] = {
     { OUI_IEEE_8023_PRIVATE, "IEEE 802.3 Private"},
     { OUI_TIA, "ANSI/TIA"},
     { OUI_DCBX, "DCBX"},
+    { OUI_NICIRA, "Nicira Networks" },
+    { OUI_BSN, "Big Switch Networks" },
+    { OUI_VELLO, "Vello Systems" },
+    { OUI_HP2, "HP" },
+    { OUI_HPLABS, "HP-Labs" },
+    { OUI_INFOBLOX, "Infoblox Inc" },
+    { OUI_ONLAB, "Open Networking Lab" },
+    { OUI_FREESCALE, "Freescale" },
+    { OUI_NETRONOME, "Netronome" },
     { 0, NULL }
 };
 
diff --git a/oui.h b/oui.h
index bf87099d26ce5fa46bf3f6941fda6300aeb9d2d5..4a983ecd3de8891166e7b87d4d2a29b7ede75dff 100644 (file)
--- a/oui.h
+++ b/oui.h
@@ -30,6 +30,15 @@ extern const struct tok smi_values[];
 #define OUI_IEEE_8023_PRIVATE 0x00120f      /* IEEE 802.3 Organisation Specific - Annex G */
 #define OUI_TIA         0x0012bb        /* TIA - Telecommunications Industry Association - ANSI/TIA-1057- 2006 */
 #define OUI_DCBX        0x001B21        /* DCBX */
+#define OUI_NICIRA      0x002320        /* Nicira Networks */
+#define OUI_BSN         0x5c16c7        /* Big Switch Networks */
+#define OUI_VELLO       0xb0d2f5        /* Vello Systems */
+#define OUI_HP2         0x002481        /* HP too */
+#define OUI_HPLABS      0x0004ea        /* HP-Labs */
+#define OUI_INFOBLOX    0x748771        /* Infoblox Inc */
+#define OUI_ONLAB       0xa42305        /* Open Networking Lab */
+#define OUI_FREESCALE   0x00049f        /* Freescale */
+#define OUI_NETRONOME   0x0015ad        /* Netronome */
 
 /*
  * These are SMI Network Management Private Enterprise Codes for
index a26f2dc0cdb32a9208d72103ab59d1fc05d5c0c6..1bb11a6678fd6c9c384c6a364fc1c5901c3db93a 100644 (file)
@@ -637,12 +637,15 @@ trunc:
 static const u_char *
 of10_vendor_data_print(netdissect_options *ndo,
                        const u_char *cp, const u_char *ep, const u_int len) {
+       uint32_t vendor;
+
        if (len < 4)
                goto corrupt;
        /* vendor */
        ND_TCHECK2(*cp, 4);
-       ND_PRINT((ndo, ", vendor 0x%08x", EXTRACT_32BITS(cp)));
+       vendor = EXTRACT_32BITS(cp);
        cp += 4;
+       ND_PRINT((ndo, ", vendor 0x%08x (%s)", vendor, of_vendor_name(vendor)));
        /* data */
        return of10_data_print(ndo, cp, ep, len - 4);
 
index 9a675855302c2a0765101fce97483ab5462f1a61..d7682a0ecb71aea312fb9ff645261669aa5bf470 100644 (file)
 #include "interface.h"
 #include "extract.h"
 #include "openflow.h"
+#include "oui.h"
 
 static const char tstr[] = " [|openflow]";
 static const char cstr[] = " (corrupt)";
 
 #define OF_VER_1_0    0x01
 
+const struct tok onf_exp_str[] = {
+       { ONF_EXP_ONF,               "ONF Extensions"                                  },
+       { ONF_EXP_BUTE,              "Budapest University of Technology and Economics" },
+       { ONF_EXP_NOVIFLOW,          "NoviFlow"                                        },
+       { ONF_EXP_L3,                "L3+ Extensions, Vendor Neutral"                  },
+       { ONF_EXP_L4L7,              "L4-L7 Extensions"                                },
+       { ONF_EXP_WMOB,              "Wireless and Mobility Extensions"                },
+       { ONF_EXP_FABS,              "Forwarding Abstractions Extensions"              },
+       { ONF_EXP_OTRANS,            "Optical Transport Extensions"                    },
+       { 0, NULL }
+};
+
+const char *
+of_vendor_name(const uint32_t vendor) {
+       const struct tok *table = (vendor & 0xff000000) == 0 ? oui_values : onf_exp_str;
+       return tok2str(table, "unknown", vendor);
+}
+
 static void
 of_header_print(netdissect_options *ndo, const uint8_t version, const uint8_t type,
                       const uint16_t length, const uint32_t xid) {
index faa8045d04026d7f468ddc3324ce1411df836dbe..dc696e1654d05f4ebe11a9fdcffa338bcfd7cff2 100644 (file)
@@ -1,18 +1,18 @@
 IP (tos 0x0, ttl 64, id 53965, offset 0, flags [DF], proto TCP (6), length 104)
     10.0.0.80.6633 > 86.139.225.177.57145: Flags [P.], cksum 0xddb3 (correct), seq 3804035784:3804035836, ack 3936946676, win 136, options [nop,nop,TS val 256259488 ecr 12980962], length 52: OpenFlow
-       version 1.0, type VENDOR, length 24, xid 0x00000018, vendor 0x005c16c7
+       version 1.0, type VENDOR, length 24, xid 0x00000018, vendor 0x005c16c7 (Big Switch Networks)
         data (12 octets)
-       version 1.0, type VENDOR, length 20, xid 0x00000019, vendor 0x005c16c7
+       version 1.0, type VENDOR, length 20, xid 0x00000019, vendor 0x005c16c7 (Big Switch Networks)
         data (8 octets)
        version 1.0, type BARRIER_REQUEST, length 8, xid 0x0000001a
 IP (tos 0x0, ttl 44, id 2943, offset 0, flags [DF], proto TCP (6), length 76)
     86.139.225.177.57145 > 10.0.0.80.6633: Flags [P.], cksum 0xf75f (correct), seq 1:25, ack 52, win 54, options [nop,nop,TS val 12980987 ecr 256259488], length 24: OpenFlow
-       version 1.0, type VENDOR, length 24, xid 0x00000018, vendor 0x005c16c7
+       version 1.0, type VENDOR, length 24, xid 0x00000018, vendor 0x005c16c7 (Big Switch Networks)
         data (12 octets)
 IP (tos 0x0, ttl 64, id 53966, offset 0, flags [DF], proto TCP (6), length 52)
     10.0.0.80.6633 > 86.139.225.177.57145: Flags [.], cksum 0x42b3 (incorrect -> 0x0ee3), ack 25, win 136, options [nop,nop,TS val 256259628 ecr 12980987], length 0
 IP (tos 0x0, ttl 44, id 2944, offset 0, flags [DF], proto TCP (6), length 80)
     86.139.225.177.57145 > 10.0.0.80.6633: Flags [P.], cksum 0xf55e (correct), seq 25:53, ack 52, win 54, options [nop,nop,TS val 12981023 ecr 256259628], length 28: OpenFlow
-       version 1.0, type VENDOR, length 20, xid 0x00000019, vendor 0x005c16c7
+       version 1.0, type VENDOR, length 20, xid 0x00000019, vendor 0x005c16c7 (Big Switch Networks)
         data (8 octets)
        version 1.0, type BARRIER_REPLY, length 8, xid 0x0000001a
index 521bdd4e5c05a9f8f7d43e0cdf5390fa908e6a13..7d1a691787af3aee7b892159702a9bfb940969ec 100644 (file)
@@ -456,7 +456,7 @@ IP (tos 0x0, ttl 64, id 783, offset 0, flags [DF], proto TCP (6), length 1500)
        version 1.0, type FLOW_MOD, length 144, xid 0x00000010
         match in_port 4
         cookie 0x000000000000000b, command ADD, priority 54311, buffer_id NONE, flags 0x0001 (SEND_FLOW_REM)
-        action type VENDOR, len 72, vendor 0x00001234
+        action type VENDOR, len 72, vendor 0x00001234 (unknown)
         data (64 octets)
          0x0000:  4469 6420 796f 7520 6b6e 6f77 2076 656e  Did.you.know.ven
          0x0010:  646f 7220 6163 7469 6f6e 2064 6174 6120  dor.action.data.