}
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.
+ */
+ const u_char *snapend_save = ndo->ndo_snapend;
+ ndo->ndo_snapend = ND_MIN(cp + len, ndo->ndo_snapend);
ether_print(ndo, cp, len, ND_BYTES_AVAILABLE_AFTER(cp), NULL, NULL);
+ ndo->ndo_snapend = snapend_save;
ndo->ndo_vflag += 3;
}
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;
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;
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 */