]> The Tcpdump Group git mirrors - tcpdump/commitdiff
OpenFlow 1.3: Implement OFPT_FEATURES_REPLY.
authorDenis Ovsienko <[email protected]>
Wed, 30 Sep 2020 13:49:38 +0000 (14:49 +0100)
committerDenis Ovsienko <[email protected]>
Wed, 30 Sep 2020 13:53:37 +0000 (14:53 +0100)
print-openflow-1.3.c
tests/of13_ericsson-v.out
tests/of13_ericsson-vv.out

index b4f7e3541d76e74d294bb125d925cb2732e742a8..34e4b873cde4cc206b6e3d289d6be3a7308722f8 100644 (file)
@@ -108,6 +108,27 @@ static const struct tok ofpt_str[] = {
        { 0, NULL }
 };
 
+#define OFPC_FLOW_STATS   (1U <<0)
+#define OFPC_TABLE_STATS  (1U <<1)
+#define OFPC_PORT_STATS   (1U <<2)
+#define OFPC_GROUP_STATS  (1U <<3)
+#define OFPC_IP_REASM     (1U <<5)
+#define OFPC_QUEUE_STATS  (1U <<6)
+#define OFPC_PORT_BLOCKED (1U <<8)
+static const struct tok ofp_capabilities_bm[] = {
+       { OFPC_FLOW_STATS,   "FLOW_STATS"   },
+       { OFPC_TABLE_STATS,  "TABLE_STATS"  },
+       { OFPC_PORT_STATS,   "PORT_STATS"   },
+       { OFPC_GROUP_STATS,  "GROUP_STATS"  },
+       { OFPC_IP_REASM,     "IP_REASM"     },
+       { OFPC_QUEUE_STATS,  "QUEUE_STATS"  },
+       { OFPC_PORT_BLOCKED, "PORT_BLOCKED" },
+       { 0, NULL }
+};
+#define OFPCAP_U (~(OFPC_FLOW_STATS | OFPC_TABLE_STATS | OFPC_PORT_STATS | \
+                    OFPC_GROUP_STATS | OFPC_IP_REASM | OFPC_QUEUE_STATS | \
+                    OFPC_PORT_BLOCKED))
+
 #define OFPHET_VERSIONBITMAP 1U
 static const struct tok ofphet_str[] = {
        { OFPHET_VERSIONBITMAP, "VERSIONBITMAP" },
@@ -474,6 +495,7 @@ static const struct tok ofptffc_str[] = {
 /* lengths (fixed or minimal) of particular protocol structures */
 #define OF_HELLO_ELEM_MINSIZE                 4U
 #define OF_ERROR_MSG_MINLEN                   12U
+#define OF_FEATURES_REPLY_FIXLEN              32U
 #define OF_QUEUE_GET_CONFIG_REQUEST_FIXLEN    16U
 
 /* [OF13] Section A.1 */
@@ -483,6 +505,33 @@ of13_msgtype_str(const uint8_t type)
        return tok2str(ofpt_str, "invalid (0x%02x)", type);
 }
 
+/* [OF13] Section 7.3.1 */
+static void
+of13_features_reply_print(netdissect_options *ndo,
+                          const u_char *cp, u_int len)
+{
+       /* datapath_id */
+       ND_PRINT("\n\t dpid 0x%016" PRIx64, GET_BE_U_8(cp));
+       OF_FWD(8);
+       /* n_buffers */
+       ND_PRINT(", n_buffers %u", GET_BE_U_4(cp));
+       OF_FWD(4);
+       /* n_tables */
+       ND_PRINT(", n_tables %u", GET_U_1(cp));
+       OF_FWD(1);
+       /* auxiliary_id */
+       ND_PRINT(", auxiliary_id %u", GET_U_1(cp));
+       OF_FWD(1);
+       /* pad */
+       OF_FWD(2);
+       /* capabilities */
+       ND_PRINT("\n\t capabilities 0x%08x", GET_BE_U_4(cp));
+       of_bitmap_print(ndo, ofp_capabilities_bm, GET_BE_U_4(cp), OFPCAP_U);
+       OF_FWD(4);
+       /* reserved */
+       ND_TCHECK_4(cp);
+}
+
 /* [OF13] Section 7.5.1 */
 static void
 of13_hello_elements_print(netdissect_options *ndo,
@@ -592,6 +641,13 @@ of13_message_print(netdissect_options *ndo,
                return;
 
        /* OpenFlow header and fixed-size message body. */
+       case OFPT_FEATURES_REPLY:
+               if (len != OF_FEATURES_REPLY_FIXLEN - OF_HEADER_FIXLEN)
+                       goto invalid;
+               if (ndo->ndo_vflag < 1)
+                       break;
+               of13_features_reply_print(ndo, cp, len);
+               return;
        case OFPT_QUEUE_GET_CONFIG_REQUEST: /* [OF13] Section A.3.6 */
                if (len != OF_QUEUE_GET_CONFIG_REQUEST_FIXLEN - OF_HEADER_FIXLEN)
                        goto invalid;
index 27e70228f3d0664f3aad83df4d0e2f5b2e636b0a..b022be4d0a1e36232c72b99b3375e053f19f204f 100644 (file)
    51  15:47:18.962238 IP (tos 0x0, ttl 64, id 51478, offset 0, flags [DF], proto TCP (6), length 84)
     127.0.0.1.58445 > 127.0.0.1.6633: Flags [P.], cksum 0xfe48 (incorrect -> 0xbbc3), seq 698:730, ack 657, win 86, options [nop,nop,TS val 267876 ecr 267876], length 32: OpenFlow
        version 1.3, type FEATURES_REPLY, length 32, xid 0x0000008e
+        dpid 0x000026a2b46fd9ba, n_buffers 256, n_tables 64, auxiliary_id 0
+        capabilities 0x0000004f (FLOW_STATS, TABLE_STATS, PORT_STATS, GROUP_STATS, QUEUE_STATS)
    52  15:47:18.962333 IP (tos 0x0, ttl 64, id 14609, offset 0, flags [DF], proto TCP (6), length 52)
     127.0.0.1.6633 > 127.0.0.1.58445: Flags [.], cksum 0xfe28 (incorrect -> 0xb693), ack 730, win 94, options [nop,nop,TS val 267876 ecr 267876], length 0
    53  16:32:34.623939 IP (tos 0x0, ttl 64, id 44797, offset 0, flags [DF], proto TCP (6), length 60)
index 6bc54a93e05da308dd8bc527f8440cb5a89e57fa..ef6c48463bb28e30c8bd811502e319f6cdb214e9 100644 (file)
    51  15:47:18.962238 IP (tos 0x0, ttl 64, id 51478, offset 0, flags [DF], proto TCP (6), length 84)
     127.0.0.1.58445 > 127.0.0.1.6633: Flags [P.], cksum 0xfe48 (incorrect -> 0xbbc3), seq 698:730, ack 657, win 86, options [nop,nop,TS val 267876 ecr 267876], length 32: OpenFlow
        version 1.3, type FEATURES_REPLY, length 32, xid 0x0000008e
+        dpid 0x000026a2b46fd9ba, n_buffers 256, n_tables 64, auxiliary_id 0
+        capabilities 0x0000004f (FLOW_STATS, TABLE_STATS, PORT_STATS, GROUP_STATS, QUEUE_STATS)
    52  15:47:18.962333 IP (tos 0x0, ttl 64, id 14609, offset 0, flags [DF], proto TCP (6), length 52)
     127.0.0.1.6633 > 127.0.0.1.58445: Flags [.], cksum 0xfe28 (incorrect -> 0xb693), seq 657, ack 730, win 94, options [nop,nop,TS val 267876 ecr 267876], length 0
    53  16:32:34.623939 IP (tos 0x0, ttl 64, id 44797, offset 0, flags [DF], proto TCP (6), length 60)