X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ca8ca82e22164ec56dd8db3668fdc7f217ea5411..c86534460a4e0cc2516b96f67aabd8b5ea4e9d16:/print-openflow-1.0.c diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index aaef0649..7751f2d9 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -318,7 +318,6 @@ static const struct tok ofp_capabilities_bm[] = { #define OFPC_FRAG_NORMAL 0x0000U #define OFPC_FRAG_DROP 0x0001U #define OFPC_FRAG_REASM 0x0002U -#define OFPC_FRAG_MASK 0x0003U static const struct tok ofp_config_str[] = { { OFPC_FRAG_NORMAL, "FRAG_NORMAL" }, { OFPC_FRAG_DROP, "FRAG_DROP" }, @@ -828,7 +827,7 @@ of10_bsn_message_print(netdissect_options *ndo, OF_FWD(4); /* data */ ND_PRINT(", data '"); - (void)nd_printn(ndo, cp, len, NULL); + nd_printjn(ndo, cp, len); ND_PRINT("'"); break; case BSN_SHELL_OUTPUT: @@ -845,7 +844,7 @@ of10_bsn_message_print(netdissect_options *ndo, /* already checked that len >= 4 */ /* data */ ND_PRINT(", data '"); - (void)nd_printn(ndo, cp, len, NULL); + nd_printjn(ndo, cp, len); ND_PRINT("'"); break; case BSN_SHELL_STATUS: @@ -1018,7 +1017,19 @@ of10_packet_data_print(netdissect_options *ndo, } ndo->ndo_vflag -= 3; ND_PRINT(", frame decoding below\n"); + /* + * The encapsulated Ethernet frame is not necessarily the last + * data of this packet (i.e. there may be more OpenFlow messages + * after the current OFPT_PACKET_IN/OFPT_PACKET_OUT message, in + * which case the current (outer) packet's snapshot end is not + * what ether_print() needs to decode an Ethernet frame nested in + * the middle of a TCP payload. + */ + if (!nd_push_snapend(ndo, cp + len)) + (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC, + "%s: failed to adjust snapend", __func__); ether_print(ndo, cp, len, ND_BYTES_AVAILABLE_AFTER(cp), NULL, NULL); + nd_pop_packet_info(ndo); ndo->ndo_vflag += 3; } @@ -1038,7 +1049,7 @@ of10_phy_port_print(netdissect_options *ndo, cp += MAC_ADDR_LEN; /* name */ ND_PRINT(", name '"); - (void)nd_print(ndo, cp, cp + OFP_MAX_PORT_NAME_LEN); + nd_printjnp(ndo, cp, OFP_MAX_PORT_NAME_LEN); ND_PRINT("'"); cp += OFP_MAX_PORT_NAME_LEN; @@ -1542,15 +1553,15 @@ of10_port_mod_print(netdissect_options *ndo, ND_PRINT(", hw_addr %s", GET_ETHERADDR_STRING(cp)); cp += MAC_ADDR_LEN; /* config */ - ND_PRINT("\n\t config 0x%08x", GET_BE_U_4(cp)); + ND_PRINT("\n\t config 0x%08x", GET_BE_U_4(cp)); of_bitmap_print(ndo, ofppc_bm, GET_BE_U_4(cp), OFPPC_U); cp += 4; /* mask */ - ND_PRINT("\n\t mask 0x%08x", GET_BE_U_4(cp)); + ND_PRINT("\n\t mask 0x%08x", GET_BE_U_4(cp)); of_bitmap_print(ndo, ofppc_bm, GET_BE_U_4(cp), OFPPC_U); cp += 4; /* advertise */ - ND_PRINT("\n\t advertise 0x%08x", GET_BE_U_4(cp)); + ND_PRINT("\n\t advertise 0x%08x", GET_BE_U_4(cp)); of_bitmap_print(ndo, ofppf_bm, GET_BE_U_4(cp), OFPPF_U); cp += 4; /* pad */ @@ -1670,27 +1681,27 @@ of10_desc_stats_reply_print(netdissect_options *ndo, goto invalid; /* mfr_desc */ ND_PRINT("\n\t mfr_desc '"); - (void)nd_print(ndo, cp, cp + DESC_STR_LEN); + nd_printjnp(ndo, cp, DESC_STR_LEN); ND_PRINT("'"); OF_FWD(DESC_STR_LEN); /* hw_desc */ ND_PRINT("\n\t hw_desc '"); - (void)nd_print(ndo, cp, cp + DESC_STR_LEN); + nd_printjnp(ndo, cp, DESC_STR_LEN); ND_PRINT("'"); OF_FWD(DESC_STR_LEN); /* sw_desc */ ND_PRINT("\n\t sw_desc '"); - (void)nd_print(ndo, cp, cp + DESC_STR_LEN); + nd_printjnp(ndo, cp, DESC_STR_LEN); ND_PRINT("'"); OF_FWD(DESC_STR_LEN); /* serial_num */ ND_PRINT("\n\t serial_num '"); - (void)nd_print(ndo, cp, cp + SERIAL_NUM_LEN); + nd_printjnp(ndo, cp, SERIAL_NUM_LEN); ND_PRINT("'"); OF_FWD(SERIAL_NUM_LEN); /* dp_desc */ ND_PRINT("\n\t dp_desc '"); - (void)nd_print(ndo, cp, cp + DESC_STR_LEN); + nd_printjnp(ndo, cp, DESC_STR_LEN); ND_PRINT("'"); return; @@ -1803,7 +1814,7 @@ of10_table_stats_reply_print(netdissect_options *ndo, OF_FWD(3); /* name */ ND_PRINT(", name '"); - (void)nd_print(ndo, cp, cp + OFP_MAX_TABLE_NAME_LEN); + nd_printjnp(ndo, cp, OFP_MAX_TABLE_NAME_LEN); ND_PRINT("'"); OF_FWD(OFP_MAX_TABLE_NAME_LEN); /* wildcards */