From: Denis Ovsienko Date: Thu, 1 Oct 2020 16:22:51 +0000 (+0100) Subject: OpenFlow 1.0: Simplify of10_vendor_message_print(). X-Git-Tag: tcpdump-4.99-bp~164 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/d547d61e5b14264b0c0dbb2ffe77d2dbb5836007 OpenFlow 1.0: Simplify of10_vendor_message_print(). The length check was the same as the one in the calling function, which is the right function for this check. --- diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index dd42866a..65703dd8 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -991,6 +991,7 @@ invalid: /* skip the undersized data */ ND_TCHECK_LEN(cp, len); } +/* [OF10] Section 5.5.4 */ static void of10_vendor_message_print(netdissect_options *ndo, const u_char *cp, u_int len) @@ -998,8 +999,6 @@ of10_vendor_message_print(netdissect_options *ndo, uint32_t vendor; void (*decoder)(netdissect_options *, const u_char *, u_int); - if (len < 4) - goto invalid; /* vendor */ vendor = GET_BE_U_4(cp); OF_FWD(4); @@ -1009,11 +1008,6 @@ of10_vendor_message_print(netdissect_options *ndo, vendor == OUI_BSN ? of10_bsn_message_print : of_data_print; decoder(ndo, cp, len); - return; - -invalid: /* skip the undersized data */ - nd_print_invalid(ndo); - ND_TCHECK_LEN(cp, len); } /* Vendor ID is mandatory, data is optional. */