]> The Tcpdump Group git mirrors - tcpdump/commitdiff
OpenFlow 1.3: Recognise 3 more messages types.
authorDenis Ovsienko <[email protected]>
Sun, 4 Oct 2020 12:16:28 +0000 (13:16 +0100)
committerDenis Ovsienko <[email protected]>
Sun, 4 Oct 2020 12:16:28 +0000 (13:16 +0100)
print-openflow-1.3.c
tests/of13_ericsson-v.out
tests/of13_ericsson-vv.out

index a44e987d82513ccb428785547604a9a655174785..17e44fecd105cd62b8295c34dffe3da9b365a8c5 100644 (file)
@@ -140,6 +140,14 @@ static const struct tok ofp_config_str[] = {
        { 0, NULL }
 };
 
+#define OFPTT_MAX 0xfeU
+#define OFPTT_ALL 0xffU
+static const struct tok ofptt_str[] = {
+       { OFPTT_MAX, "MAX" },
+       { OFPTT_ALL, "ALL" },
+       { 0, NULL },
+};
+
 #define OFPCML_MAX       0xffe5U
 #define OFPCML_NO_BUFFER 0xffffU
 static const struct tok ofpcml_str[] = {
@@ -272,6 +280,30 @@ static const struct tok ofverbm_str[] = {
 #define OF_BIT_VER_U (~(OF_BIT_VER_1_0 | OF_BIT_VER_1_1 | OF_BIT_VER_1_2 | \
                         OF_BIT_VER_1_3 | OF_BIT_VER_1_4 | OF_BIT_VER_1_5))
 
+#define OFPR_NO_MATCH    0U
+#define OFPR_ACTION      1U
+#define OFPR_INVALID_TTL 2U
+#if 0 /* for OFPT_PACKET_IN */
+static const struct tok ofpr_str[] = {
+       { OFPR_NO_MATCH,    "NO_MATCH"         },
+       { OFPR_ACTION,      "ACTION"           },
+       { OFPR_INVALID_TTL, "OFPR_INVALID_TTL" },
+       { 0, NULL }
+};
+#endif
+
+#define ASYNC_OFPR_NO_MATCH    (1U << OFPR_NO_MATCH   )
+#define ASYNC_OFPR_ACTION      (1U << OFPR_ACTION     )
+#define ASYNC_OFPR_INVALID_TTL (1U << OFPR_INVALID_TTL)
+static const struct tok async_ofpr_bm[] = {
+       { ASYNC_OFPR_NO_MATCH,    "NO_MATCH"    },
+       { ASYNC_OFPR_ACTION,      "ACTION"      },
+       { ASYNC_OFPR_INVALID_TTL, "INVALID_TTL" },
+       { 0, NULL }
+};
+#define ASYNC_OFPR_U (~(ASYNC_OFPR_NO_MATCH | ASYNC_OFPR_ACTION | \
+                        ASYNC_OFPR_INVALID_TTL))
+
 #define OFPPR_ADD    0U
 #define OFPPR_DELETE 1U
 #define OFPPR_MODIFY 2U
@@ -282,6 +314,18 @@ static const struct tok ofppr_str[] = {
        { 0, NULL }
 };
 
+#define ASYNC_OFPPR_ADD    (1U << OFPPR_ADD   )
+#define ASYNC_OFPPR_DELETE (1U << OFPPR_DELETE)
+#define ASYNC_OFPPR_MODIFY (1U << OFPPR_MODIFY)
+static const struct tok async_ofppr_bm[] = {
+       { ASYNC_OFPPR_ADD,    "ADD"    },
+       { ASYNC_OFPPR_DELETE, "DELETE" },
+       { ASYNC_OFPPR_MODIFY, "MODIFY" },
+       { 0, NULL }
+};
+#define ASYNC_OFPPR_U (~(ASYNC_OFPPR_ADD | ASYNC_OFPPR_DELETE | \
+                         ASYNC_OFPPR_MODIFY))
+
 #define OFPET_HELLO_FAILED           0U
 #define OFPET_BAD_REQUEST            1U
 #define OFPET_BAD_ACTION             2U
@@ -619,8 +663,10 @@ static const struct uint_tokary of13_ofpet2tokary[] = {
 #define OF_FEATURES_REPLY_FIXLEN              32U
 #define OF_PORT_MOD_FIXLEN                    40U
 #define OF_SWITCH_CONFIG_MSG_FIXLEN           12U
+#define OF_TABLE_MOD_FIXLEN                   16U
 #define OF_QUEUE_GET_CONFIG_REQUEST_FIXLEN    16U
 #define OF_ROLE_MSG_FIXLEN                    24U
+#define OF_ASYNC_MSG_FIXLEN                   32U
 #define OF_PORT_STATUS_FIXLEN                 80U
 #define OF_EXPERIMENTER_MSG_MINLEN            16U
 
@@ -733,6 +779,20 @@ of13_switch_config_msg_print(netdissect_options *ndo,
                 tok2str(ofpcml_str, "%u", GET_BE_U_2(cp)));
 }
 
+/* [OF13] Section 7.3.3 */
+static void
+of13_table_mod_print(netdissect_options *ndo,
+                     const u_char *cp)
+{
+       /* table_id */
+       ND_PRINT("\n\t table_id %s", tok2str(ofptt_str, "%u", GET_U_1(cp)));
+       cp += 1;
+       /* pad */
+       cp += 3;
+       /* config */
+       ND_PRINT(", config 0x%08x", GET_BE_U_4(cp));
+}
+
 /* [OF13] Section 7.3.9 */
 static void
 of13_role_msg_print(netdissect_options *ndo,
@@ -748,6 +808,36 @@ of13_role_msg_print(netdissect_options *ndo,
        ND_PRINT(", generation_id 0x%016" PRIx64, GET_BE_U_8(cp));
 }
 
+/* [OF13] Section 7.3.10 */
+static void
+of13_async_msg_print(netdissect_options *ndo,
+                    const u_char *cp)
+{
+       /* packet_in_mask[0] */
+       ND_PRINT("\n\t packet_in_mask[EM] 0x%08x", GET_BE_U_4(cp));
+       of_bitmap_print(ndo, async_ofpr_bm, GET_BE_U_4(cp), ASYNC_OFPR_U);
+       cp += 4;
+       /* packet_in_mask[1] */
+       ND_PRINT("\n\t packet_in_mask[S] 0x%08x", GET_BE_U_4(cp));
+       of_bitmap_print(ndo, async_ofpr_bm, GET_BE_U_4(cp), ASYNC_OFPR_U);
+       cp += 4;
+       /* port_status_mask[0] */
+       ND_PRINT("\n\t port_status_mask[EM] 0x%08x", GET_BE_U_4(cp));
+       of_bitmap_print(ndo, async_ofppr_bm, GET_BE_U_4(cp), ASYNC_OFPPR_U);
+       cp += 4;
+       /* port_status_mask[1] */
+       ND_PRINT("\n\t port_status_mask[S] 0x%08x", GET_BE_U_4(cp));
+       of_bitmap_print(ndo, async_ofppr_bm, GET_BE_U_4(cp), ASYNC_OFPPR_U);
+       cp += 4;
+       /* flow_removed_mask[0] */
+       ND_PRINT("\n\t flow_removed_mask[EM] 0x%08x", GET_BE_U_4(cp));
+       of_bitmap_print(ndo, async_ofppr_bm, GET_BE_U_4(cp), ASYNC_OFPPR_U);
+       cp += 4;
+       /* flow_removed_mask[1] */
+       ND_PRINT("\n\t flow_removed_mask[S] 0x%08x", GET_BE_U_4(cp));
+       of_bitmap_print(ndo, async_ofppr_bm, GET_BE_U_4(cp), ASYNC_OFPPR_U);
+}
+
 /* [OF13] Section 7.3.4.3 */
 static void
 of13_port_mod_print(netdissect_options *ndo,
@@ -960,6 +1050,21 @@ of13_message_print(netdissect_options *ndo,
                        break;
                of13_port_status_print(ndo, cp);
                return;
+       case OFPT_TABLE_MOD: /* [OF13] Section 7.3.3 */
+               if (len != OF_TABLE_MOD_FIXLEN - OF_HEADER_FIXLEN)
+                       goto invalid;
+               if (ndo->ndo_vflag < 1)
+                       break;
+               of13_table_mod_print(ndo, cp);
+               return;
+       case OFPT_SET_ASYNC: /* [OF13] Section 7.3.10 */
+       case OFPT_GET_ASYNC_REPLY: /* ibid */
+               if (len != OF_ASYNC_MSG_FIXLEN - OF_HEADER_FIXLEN)
+                       goto invalid;
+               if (ndo->ndo_vflag < 1)
+                       break;
+               of13_async_msg_print(ndo, cp);
+               return;
 
        /* OpenFlow header and variable-size data. */
        case OFPT_ECHO_REQUEST: /* [OF13] Section A.5.2 */
index 6edc90ce6dfc30769bf3b5309346b85f20320e77..9c54a837693a8525bfa5cec8a59c25fdb66b3c74 100644 (file)
   147  19:45:17.176752 IP (tos 0x0, ttl 64, id 17714, offset 0, flags [DF], proto TCP (6), length 68)
     127.0.0.1.6633 > 127.0.0.1.51984: Flags [P.], cksum 0xfe38 (incorrect -> 0xe026), seq 8:24, ack 9, win 94, options [nop,nop,TS val 6181593 ecr 6181423], length 16: OpenFlow
        version 1.3, type TABLE_MOD, length 16, xid 0x0000006e
+        table_id 1, config 0x00000000
   148  19:45:17.215970 IP (tos 0x0, ttl 64, id 23687, offset 0, flags [DF], proto TCP (6), length 52)
     127.0.0.1.51984 > 127.0.0.1.6633: Flags [.], cksum 0xfe28 (incorrect -> 0xe511), ack 24, win 86, options [nop,nop,TS val 6181603 ecr 6181593], length 0
   149  19:53:23.472776 IP (tos 0x0, ttl 64, id 17917, offset 0, flags [DF], proto TCP (6), length 92)
   167  20:28:54.103683 IP (tos 0x0, ttl 64, id 46088, offset 0, flags [DF], proto TCP (6), length 84)
     127.0.0.1.6633 > 127.0.0.1.51987: Flags [P.], cksum 0xfe48 (incorrect -> 0xeb3a), seq 1912:1944, ack 1993, win 96, options [nop,nop,TS val 6835824 ecr 6835451], length 32: OpenFlow
        version 1.3, type SET_ASYNC, length 32, xid 0x00000166
+        packet_in_mask[EM] 0x00000003 (NO_MATCH, ACTION)
+        packet_in_mask[S] 0x00000002 (ACTION)
+        port_status_mask[EM] 0x00000007 (ADD, DELETE, MODIFY)
+        port_status_mask[S] 0x00000002 (DELETE)
+        flow_removed_mask[EM] 0x00000007 (ADD, DELETE, MODIFY)
+        flow_removed_mask[S] 0x00000004 (MODIFY)
   168  20:28:54.140673 IP (tos 0x0, ttl 64, id 49438, offset 0, flags [DF], proto TCP (6), length 52)
     127.0.0.1.51987 > 127.0.0.1.6633: Flags [.], cksum 0xfe28 (incorrect -> 0xef88), ack 1944, win 86, options [nop,nop,TS val 6835834 ecr 6835824], length 0
   169  20:28:56.308694 IP (tos 0x0, ttl 64, id 46089, offset 0, flags [DF], proto TCP (6), length 60)
   171  20:28:56.309209 IP (tos 0x0, ttl 64, id 49440, offset 0, flags [DF], proto TCP (6), length 84)
     127.0.0.1.51987 > 127.0.0.1.6633: Flags [P.], cksum 0xfe48 (incorrect -> 0xe557), seq 1993:2025, ack 1952, win 86, options [nop,nop,TS val 6836376 ecr 6836376], length 32: OpenFlow
        version 1.3, type GET_ASYNC_REPLY, length 32, xid 0x00000167
+        packet_in_mask[EM] 0x00000003 (NO_MATCH, ACTION)
+        packet_in_mask[S] 0x00000002 (ACTION)
+        port_status_mask[EM] 0x00000007 (ADD, DELETE, MODIFY)
+        port_status_mask[S] 0x00000002 (DELETE)
+        flow_removed_mask[EM] 0x00000007 (ADD, DELETE, MODIFY)
+        flow_removed_mask[S] 0x00000004 (MODIFY)
   172  20:28:56.309230 IP (tos 0x0, ttl 64, id 46090, offset 0, flags [DF], proto TCP (6), length 52)
     127.0.0.1.6633 > 127.0.0.1.51987: Flags [.], cksum 0xfe28 (incorrect -> 0xeb10), ack 2025, win 96, options [nop,nop,TS val 6836376 ecr 6836376], length 0
   173  20:37:22.358712 IP (tos 0x0, ttl 64, id 18246, offset 0, flags [DF], proto TCP (6), length 100)
index 4538d376d59d5f9c2b58af859c04fbdf6a323d11..60205947f666c5ad550494424852e67712f91afe 100644 (file)
   147  19:45:17.176752 IP (tos 0x0, ttl 64, id 17714, offset 0, flags [DF], proto TCP (6), length 68)
     127.0.0.1.6633 > 127.0.0.1.51984: Flags [P.], cksum 0xfe38 (incorrect -> 0xe026), seq 8:24, ack 9, win 94, options [nop,nop,TS val 6181593 ecr 6181423], length 16: OpenFlow
        version 1.3, type TABLE_MOD, length 16, xid 0x0000006e
+        table_id 1, config 0x00000000
   148  19:45:17.215970 IP (tos 0x0, ttl 64, id 23687, offset 0, flags [DF], proto TCP (6), length 52)
     127.0.0.1.51984 > 127.0.0.1.6633: Flags [.], cksum 0xfe28 (incorrect -> 0xe511), seq 9, ack 24, win 86, options [nop,nop,TS val 6181603 ecr 6181593], length 0
   149  19:53:23.472776 IP (tos 0x0, ttl 64, id 17917, offset 0, flags [DF], proto TCP (6), length 92)
   167  20:28:54.103683 IP (tos 0x0, ttl 64, id 46088, offset 0, flags [DF], proto TCP (6), length 84)
     127.0.0.1.6633 > 127.0.0.1.51987: Flags [P.], cksum 0xfe48 (incorrect -> 0xeb3a), seq 1912:1944, ack 1993, win 96, options [nop,nop,TS val 6835824 ecr 6835451], length 32: OpenFlow
        version 1.3, type SET_ASYNC, length 32, xid 0x00000166
+        packet_in_mask[EM] 0x00000003 (NO_MATCH, ACTION)
+        packet_in_mask[S] 0x00000002 (ACTION)
+        port_status_mask[EM] 0x00000007 (ADD, DELETE, MODIFY)
+        port_status_mask[S] 0x00000002 (DELETE)
+        flow_removed_mask[EM] 0x00000007 (ADD, DELETE, MODIFY)
+        flow_removed_mask[S] 0x00000004 (MODIFY)
   168  20:28:54.140673 IP (tos 0x0, ttl 64, id 49438, offset 0, flags [DF], proto TCP (6), length 52)
     127.0.0.1.51987 > 127.0.0.1.6633: Flags [.], cksum 0xfe28 (incorrect -> 0xef88), seq 1993, ack 1944, win 86, options [nop,nop,TS val 6835834 ecr 6835824], length 0
   169  20:28:56.308694 IP (tos 0x0, ttl 64, id 46089, offset 0, flags [DF], proto TCP (6), length 60)
   171  20:28:56.309209 IP (tos 0x0, ttl 64, id 49440, offset 0, flags [DF], proto TCP (6), length 84)
     127.0.0.1.51987 > 127.0.0.1.6633: Flags [P.], cksum 0xfe48 (incorrect -> 0xe557), seq 1993:2025, ack 1952, win 86, options [nop,nop,TS val 6836376 ecr 6836376], length 32: OpenFlow
        version 1.3, type GET_ASYNC_REPLY, length 32, xid 0x00000167
+        packet_in_mask[EM] 0x00000003 (NO_MATCH, ACTION)
+        packet_in_mask[S] 0x00000002 (ACTION)
+        port_status_mask[EM] 0x00000007 (ADD, DELETE, MODIFY)
+        port_status_mask[S] 0x00000002 (DELETE)
+        flow_removed_mask[EM] 0x00000007 (ADD, DELETE, MODIFY)
+        flow_removed_mask[S] 0x00000004 (MODIFY)
   172  20:28:56.309230 IP (tos 0x0, ttl 64, id 46090, offset 0, flags [DF], proto TCP (6), length 52)
     127.0.0.1.6633 > 127.0.0.1.51987: Flags [.], cksum 0xfe28 (incorrect -> 0xeb10), seq 1952, ack 2025, win 96, options [nop,nop,TS val 6836376 ecr 6836376], length 0
   173  20:37:22.358712 IP (tos 0x0, ttl 64, id 18246, offset 0, flags [DF], proto TCP (6), length 100)