- /* OpenFlow header and fixed-size message body. */
- case OFPT_SET_CONFIG: /* [OF10] Section 5.3.2 */
- case OFPT_GET_CONFIG_REPLY: /* ibid */
- if (len != OF_SWITCH_CONFIG_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- /* flags */
- ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t flags %s", tok2str(ofp_config_str, "invalid (0x%04x)", EXTRACT_16BITS(cp))));
- cp += 2;
- /* miss_send_len */
- ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, ", miss_send_len %u", EXTRACT_16BITS(cp)));
- return cp + 2;
- case OFPT_PORT_MOD:
- if (len != OF_PORT_MOD_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_port_mod_print(ndo, cp, ep);
- case OFPT_QUEUE_GET_CONFIG_REQUEST: /* [OF10] Section 5.3.4 */
- if (len != OF_QUEUE_GET_CONFIG_REQUEST_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- /* port */
- ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
- cp += 2;
- /* pad */
- ND_TCHECK2(*cp, 2);
- return cp + 2;
- case OFPT_FLOW_REMOVED:
- if (len != OF_FLOW_REMOVED_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_flow_removed_print(ndo, cp, ep);
- case OFPT_PORT_STATUS: /* [OF10] Section 5.4.3 */
- if (len != OF_PORT_STATUS_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- /* reason */
- ND_TCHECK2(*cp, 1);
- ND_PRINT((ndo, "\n\t reason %s", tok2str(ofppr_str, "invalid (0x%02x)", *cp)));
- cp += 1;
- /* pad */
- ND_TCHECK2(*cp, 7);
- cp += 7;
- /* desc */
- return of10_phy_ports_print(ndo, cp, ep, OF_PHY_PORT_LEN);
-
- /* OpenFlow header, fixed-size message body and n * fixed-size data units. */
- case OFPT_FEATURES_REPLY:
- if (len < OF_SWITCH_FEATURES_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_features_reply_print(ndo, cp, ep, len);
-
- /* OpenFlow header and variable-size data. */
- case OFPT_HELLO: /* [OF10] Section 5.5.1 */
- case OFPT_ECHO_REQUEST: /* [OF10] Section 5.5.2 */
- case OFPT_ECHO_REPLY: /* [OF10] Section 5.5.3 */
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_data_print(ndo, cp, ep, len - OF_HEADER_LEN);
-
- /* OpenFlow header, fixed-size message body and variable-size data. */
- case OFPT_ERROR:
- if (len < OF_ERROR_MSG_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_error_print(ndo, cp, ep, len);
- case OFPT_VENDOR:
- /* [OF10] Section 5.5.4 */
- if (len < OF_VENDOR_HEADER_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_vendor_message_print(ndo, cp, ep, len - OF_HEADER_LEN);
- case OFPT_PACKET_IN:
- /* 2 mock octets count in OF_PACKET_IN_LEN but not in len */
- if (len < OF_PACKET_IN_LEN - 2)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_packet_in_print(ndo, cp, ep, len);
-
- /* a. OpenFlow header. */
- /* b. OpenFlow header and one of the fixed-size message bodies. */
- /* c. OpenFlow header, fixed-size message body and variable-size data. */
- case OFPT_STATS_REQUEST:
- if (len < OF_STATS_REQUEST_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_stats_request_print(ndo, cp, ep, len);
-
- /* a. OpenFlow header and fixed-size message body. */
- /* b. OpenFlow header and n * fixed-size data units. */
- /* c. OpenFlow header and n * variable-size data units. */
- /* d. OpenFlow header, fixed-size message body and variable-size data. */
- case OFPT_STATS_REPLY:
- if (len < OF_STATS_REPLY_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_stats_reply_print(ndo, cp, ep, len);
-
- /* OpenFlow header and n * variable-size data units and variable-size data. */
- case OFPT_PACKET_OUT:
- if (len < OF_PACKET_OUT_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_packet_out_print(ndo, cp, ep, len);
-
- /* OpenFlow header, fixed-size message body and n * variable-size data units. */
- case OFPT_FLOW_MOD:
- if (len < OF_FLOW_MOD_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- return of10_flow_mod_print(ndo, cp, ep, len);
-
- /* OpenFlow header, fixed-size message body and n * variable-size data units. */
- case OFPT_QUEUE_GET_CONFIG_REPLY: /* [OF10] Section 5.3.4 */
- if (len < OF_QUEUE_GET_CONFIG_REPLY_LEN)
- goto corrupt;
- if (ndo->ndo_vflag < 1)
- goto next_message;
- /* port */
- ND_TCHECK2(*cp, 2);
- ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp))));
- cp += 2;
- /* pad */
- ND_TCHECK2(*cp, 6);
- cp += 6;
- /* queues */
- return of10_queues_print(ndo, cp, ep, len - OF_QUEUE_GET_CONFIG_REPLY_LEN);
- } /* switch (type) */
- goto next_message;
-
-corrupt: /* skip the message body */
- ND_PRINT((ndo, "%s", cstr));
-next_message:
- ND_TCHECK2(*cp0, len0 - OF_HEADER_LEN);
- return cp0 + len0 - OF_HEADER_LEN;
-trunc:
- ND_PRINT((ndo, "%s", tstr));
- return ep;