From: Francois-Xavier Le Bail Date: Sun, 6 Sep 2015 11:34:05 +0000 (+0200) Subject: Use the word 'invalid' for 'malformed' or 'corrupted' packets X-Git-Tag: tcpdump-4.8.0~174 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/7ea344d76a21255867275a199d1ddb1e5b358f77 Use the word 'invalid' for 'malformed' or 'corrupted' packets An invalid packet could be: 1) built malformed originally by the sender or a fuzz tester, 2) became corrupted in transit. --- diff --git a/CHANGES b/CHANGES index 3cd618cc..824dc910 100644 --- a/CHANGES +++ b/CHANGES @@ -468,10 +468,10 @@ Wed. November 12, 2003. mcr@sandelman.ottawa.on.ca. Summary for 3.8 release Tuesday, February 25, 2003. fenner@research.att.com. 3.7.2 release - Fixed infinite loop when parsing malformed isakmp packets. + Fixed infinite loop when parsing invalid isakmp packets. (reported by iDefense; already fixed in CVS) - Fixed infinite loop when parsing malformed BGP packets. - Fixed buffer overflow with certain malformed NFS packets. + Fixed infinite loop when parsing invalid BGP packets. + Fixed buffer overflow with certain invalid NFS packets. Pretty-print unprintable network names in 802.11 printer. Handle truncated nbp (appletalk) packets. Updated DHCPv6 printer to match draft-ietf-dhc-dhcpv6-22.txt diff --git a/print-802_15_4.c b/print-802_15_4.c index 08317c56..e60a8a9e 100644 --- a/print-802_15_4.c +++ b/print-802_15_4.c @@ -111,7 +111,7 @@ ieee802_15_4_if_print(netdissect_options *ndo, if (ndo->ndo_vflag) ND_PRINT((ndo,"seq %02x ", seq)); if (hdrlen == -1) { - ND_PRINT((ndo,"malformed! ")); + ND_PRINT((ndo,"invalid! ")); return caplen; } diff --git a/print-ahcp.c b/print-ahcp.c index 520c23a6..5d79f0fe 100644 --- a/print-ahcp.c +++ b/print-ahcp.c @@ -40,7 +40,7 @@ #include "addrtoname.h" static const char tstr[] = " [|ahcp]"; -static const char cstr[] = "(corrupt)"; +static const char cstr[] = "(invalid)"; #define AHCP_MAGIC_NUMBER 43 #define AHCP_VERSION_1 1 @@ -106,7 +106,7 @@ ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) char buf[BUFSIZE]; if (cp + 4 != ep) - goto corrupt; + goto invalid; ND_TCHECK2(*cp, 4); t = EXTRACT_32BITS(cp); if (NULL == (tm = gmtime(&t))) @@ -117,7 +117,7 @@ ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) ND_PRINT((ndo, ": %s UTC", buf)); return 0; -corrupt: +invalid: ND_PRINT((ndo, ": %s", cstr)); ND_TCHECK2(*cp, ep - cp); return 0; @@ -130,12 +130,12 @@ static int ahcp_seconds_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) { if (cp + 4 != ep) - goto corrupt; + goto invalid; ND_TCHECK2(*cp, 4); ND_PRINT((ndo, ": %us", EXTRACT_32BITS(cp))); return 0; -corrupt: +invalid: ND_PRINT((ndo, ": %s", cstr)); ND_TCHECK2(*cp, ep - cp); return 0; @@ -151,7 +151,7 @@ ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha while (cp < ep) { if (cp + 16 > ep) - goto corrupt; + goto invalid; ND_TCHECK2(*cp, 16); #ifdef INET6 ND_PRINT((ndo, "%s%s", sep, ip6addr_string(ndo, cp))); @@ -163,7 +163,7 @@ ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha } return 0; -corrupt: +invalid: ND_PRINT((ndo, ": %s", cstr)); ND_TCHECK2(*cp, ep - cp); return 0; @@ -179,7 +179,7 @@ ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha while (cp < ep) { if (cp + 4 > ep) - goto corrupt; + goto invalid; ND_TCHECK2(*cp, 4); ND_PRINT((ndo, "%s%s", sep, ipaddr_string(ndo, cp))); cp += 4; @@ -187,7 +187,7 @@ ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha } return 0; -corrupt: +invalid: ND_PRINT((ndo, ": %s", cstr)); ND_TCHECK2(*cp, ep - cp); return 0; @@ -203,7 +203,7 @@ ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char while (cp < ep) { if (cp + 17 > ep) - goto corrupt; + goto invalid; ND_TCHECK2(*cp, 17); #ifdef INET6 ND_PRINT((ndo, "%s%s/%u", sep, ip6addr_string(ndo, cp), *(cp + 16))); @@ -215,7 +215,7 @@ ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char } return 0; -corrupt: +invalid: ND_PRINT((ndo, ": %s", cstr)); ND_TCHECK2(*cp, ep - cp); return 0; @@ -231,7 +231,7 @@ ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char while (cp < ep) { if (cp + 5 > ep) - goto corrupt; + goto invalid; ND_TCHECK2(*cp, 5); ND_PRINT((ndo, "%s%s/%u", sep, ipaddr_string(ndo, cp), *(cp + 4))); cp += 5; @@ -239,7 +239,7 @@ ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char } return 0; -corrupt: +invalid: ND_PRINT((ndo, ": %s", cstr)); ND_TCHECK2(*cp, ep - cp); return 0; @@ -282,12 +282,12 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) continue; /* Length */ if (cp + 1 > ep) - goto corrupt; + goto invalid; ND_TCHECK2(*cp, 1); option_len = *cp; cp += 1; if (cp + option_len > ep) - goto corrupt; + goto invalid; /* Value */ if (option_no <= AHCP1_OPT_MAX && data_decoders[option_no] != NULL) { if (data_decoders[option_no](ndo, cp, cp + option_len) < 0) @@ -300,7 +300,7 @@ ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) } return; -corrupt: +invalid: ND_PRINT((ndo, " %s", cstr)); ND_TCHECK2(*cp, ep - cp); return; @@ -315,7 +315,7 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) uint16_t body_len; if (cp + AHCP1_BODY_MIN_LEN > ep) - goto corrupt; + goto invalid; /* Type */ ND_TCHECK2(*cp, 1); type = *cp; @@ -336,7 +336,7 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) ND_PRINT((ndo, ", Length %u", body_len)); } if (cp + body_len > ep) - goto corrupt; + goto invalid; /* Options */ if (ndo->ndo_vflag >= 2) @@ -345,7 +345,7 @@ ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep) ND_TCHECK2(*cp, body_len); return; -corrupt: +invalid: ND_PRINT((ndo, " %s", cstr)); ND_TCHECK2(*cp, ep - cp); return; @@ -361,11 +361,11 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) ND_PRINT((ndo, "AHCP")); if (len < 2) - goto corrupt; + goto invalid; /* Magic */ ND_TCHECK2(*cp, 1); if (*cp != AHCP_MAGIC_NUMBER) - goto corrupt; + goto invalid; cp += 1; /* Version */ ND_TCHECK2(*cp, 1); @@ -375,7 +375,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) case AHCP_VERSION_1: { ND_PRINT((ndo, " Version 1")); if (len < AHCP1_HEADER_FIX_LEN) - goto corrupt; + goto invalid; if (!ndo->ndo_vflag) { ND_TCHECK2(*cp, AHCP1_HEADER_FIX_LEN - 2); cp += AHCP1_HEADER_FIX_LEN - 2; @@ -411,7 +411,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) } return; -corrupt: +invalid: ND_PRINT((ndo, " %s", cstr)); ND_TCHECK2(*cp, ep - cp); return; diff --git a/print-aoe.c b/print-aoe.c index 0834a243..02eda7d9 100644 --- a/print-aoe.c +++ b/print-aoe.c @@ -41,7 +41,7 @@ #include "ether.h" static const char tstr[] = " [|aoe]"; -static const char cstr[] = " (corrupt)"; +static const char cstr[] = " (invalid)"; #define AOE_V1 1 #define ATA_SECTOR_SIZE 512 @@ -147,7 +147,7 @@ aoev1_issue_print(netdissect_options *ndo, const u_char *ep = cp + len; if (len < AOEV1_ISSUE_ARG_LEN) - goto corrupt; + goto invalid; /* AFlags */ ND_TCHECK2(*cp, 1); ND_PRINT((ndo, "\n\tAFlags: [%s]", bittok2str(aoev1_aflag_str, "none", *cp))); @@ -196,7 +196,7 @@ aoev1_issue_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\tData: %u bytes", len - AOEV1_ISSUE_ARG_LEN)); return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return; @@ -212,7 +212,7 @@ aoev1_query_print(netdissect_options *ndo, uint16_t cslen; if (len < AOEV1_QUERY_ARG_LEN) - goto corrupt; + goto invalid; /* Buffer Count */ ND_TCHECK2(*cp, 2); ND_PRINT((ndo, "\n\tBuffer Count: %u", EXTRACT_16BITS(cp))); @@ -235,7 +235,7 @@ aoev1_query_print(netdissect_options *ndo, cslen = EXTRACT_16BITS(cp); cp += 2; if (cslen > AOEV1_MAX_CONFSTR_LEN || AOEV1_QUERY_ARG_LEN + cslen > len) - goto corrupt; + goto invalid; /* Config String */ ND_TCHECK2(*cp, cslen); if (cslen) { @@ -245,7 +245,7 @@ aoev1_query_print(netdissect_options *ndo, } return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return; @@ -261,7 +261,7 @@ aoev1_mac_print(netdissect_options *ndo, uint8_t dircount, i; if (len < AOEV1_MAC_ARG_LEN) - goto corrupt; + goto invalid; /* Reserved */ ND_TCHECK2(*cp, 1); cp += 1; @@ -279,7 +279,7 @@ aoev1_mac_print(netdissect_options *ndo, cp += 1; ND_PRINT((ndo, ", Dir Count: %u", dircount)); if (AOEV1_MAC_ARG_LEN + dircount * 8 > len) - goto corrupt; + goto invalid; /* directives */ for (i = 0; i < dircount; i++) { /* Reserved */ @@ -296,7 +296,7 @@ aoev1_mac_print(netdissect_options *ndo, } return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return; @@ -312,7 +312,7 @@ aoev1_reserve_print(netdissect_options *ndo, uint8_t nmacs, i; if (len < AOEV1_RESERVE_ARG_LEN || (len - AOEV1_RESERVE_ARG_LEN) % ETHER_ADDR_LEN) - goto corrupt; + goto invalid; /* RCmd */ ND_TCHECK2(*cp, 1); ND_PRINT((ndo, "\n\tRCmd: %s", tok2str(aoev1_rcmd_str, "Unknown (0x%02x)", *cp))); @@ -323,7 +323,7 @@ aoev1_reserve_print(netdissect_options *ndo, cp += 1; ND_PRINT((ndo, ", NMacs: %u", nmacs)); if (AOEV1_RESERVE_ARG_LEN + nmacs * ETHER_ADDR_LEN != len) - goto corrupt; + goto invalid; /* addresses */ for (i = 0; i < nmacs; i++) { ND_PRINT((ndo, "\n\tEthernet Address %u: %s", i, etheraddr_string(ndo, cp))); @@ -331,7 +331,7 @@ aoev1_reserve_print(netdissect_options *ndo, } return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return; @@ -349,7 +349,7 @@ aoev1_print(netdissect_options *ndo, void (*cmd_decoder)(netdissect_options *, const u_char *, const u_int); if (len < AOEV1_COMMON_HDR_LEN) - goto corrupt; + goto invalid; /* Flags */ flags = *cp & 0x0F; ND_PRINT((ndo, ", Flags: [%s]", bittok2str(aoev1_flag_str, "none", flags))); @@ -389,7 +389,7 @@ aoev1_print(netdissect_options *ndo, cmd_decoder(ndo, cp, len - AOEV1_COMMON_HDR_LEN); return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return; @@ -407,7 +407,7 @@ aoe_print(netdissect_options *ndo, ND_PRINT((ndo, "AoE length %u", len)); if (len < 1) - goto corrupt; + goto invalid; /* Ver/Flags */ ND_TCHECK2(*cp, 1); ver = (*cp & 0xF0) >> 4; @@ -421,7 +421,7 @@ aoe_print(netdissect_options *ndo, } return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return; diff --git a/print-babel.c b/print-babel.c index 375c9a8b..ea724666 100644 --- a/print-babel.c +++ b/print-babel.c @@ -52,7 +52,7 @@ babel_print(netdissect_options *ndo, ND_TCHECK2(*cp, 4); if(cp[0] != 42) { - ND_PRINT((ndo, " malformed header")); + ND_PRINT((ndo, " invalid header")); return; } else { ND_PRINT((ndo, " %d", cp[1])); @@ -286,10 +286,10 @@ subtlvs_print(netdissect_options *ndo, continue; } if(cp == ep) - goto corrupt; + goto invalid; sublen = *cp++; if(cp + sublen > ep) - goto corrupt; + goto invalid; switch(subtype) { case MESSAGE_SUB_PADN: @@ -315,12 +315,12 @@ subtlvs_print(netdissect_options *ndo, ND_PRINT((ndo, " sub-timestamp")); if(tlv_type == MESSAGE_HELLO) { if(sublen < 4) - goto corrupt; + goto invalid; t1 = EXTRACT_32BITS(cp); ND_PRINT((ndo, " %s", format_timestamp(t1))); } else if(tlv_type == MESSAGE_IHU) { if(sublen < 8) - goto corrupt; + goto invalid; t1 = EXTRACT_32BITS(cp); ND_PRINT((ndo, " %s", format_timestamp(t1))); t2 = EXTRACT_32BITS(cp + 4); @@ -336,12 +336,12 @@ subtlvs_print(netdissect_options *ndo, } /* while */ return; - corrupt: - ND_PRINT((ndo, " (corrupt)")); + invalid: + ND_PRINT((ndo, " (invalid)")); } #define ICHECK(i, l) \ - if ((i) + (l) > bodylen || (i) + (l) > length) goto corrupt; + if ((i) + (l) > bodylen || (i) + (l) > length) goto invalid; static void babel_print_v2(netdissect_options *ndo, @@ -355,7 +355,7 @@ babel_print_v2(netdissect_options *ndo, ND_TCHECK2(*cp, 4); if (length < 4) - goto corrupt; + goto invalid; bodylen = EXTRACT_16BITS(cp + 2); ND_PRINT((ndo, " (%u)", bodylen)); @@ -396,7 +396,7 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT((ndo, " ack-req")); else { ND_PRINT((ndo, "\n\tAcknowledgment Request ")); - if(len < 6) goto corrupt; + if(len < 6) goto invalid; nonce = EXTRACT_16BITS(message + 4); interval = EXTRACT_16BITS(message + 6); ND_PRINT((ndo, "%04x %s", nonce, format_interval(interval))); @@ -410,7 +410,7 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT((ndo, " ack")); else { ND_PRINT((ndo, "\n\tAcknowledgment ")); - if(len < 2) goto corrupt; + if(len < 2) goto invalid; nonce = EXTRACT_16BITS(message + 2); ND_PRINT((ndo, "%04x", nonce)); } @@ -423,7 +423,7 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT((ndo, " hello")); else { ND_PRINT((ndo, "\n\tHello ")); - if(len < 6) goto corrupt; + if(len < 6) goto invalid; seqno = EXTRACT_16BITS(message + 4); interval = EXTRACT_16BITS(message + 6); ND_PRINT((ndo, "seqno %u interval %s", seqno, format_interval(interval))); @@ -442,7 +442,7 @@ babel_print_v2(netdissect_options *ndo, u_char address[16]; int rc; ND_PRINT((ndo, "\n\tIHU ")); - if(len < 6) goto corrupt; + if(len < 6) goto invalid; txcost = EXTRACT_16BITS(message + 4); interval = EXTRACT_16BITS(message + 6); rc = network_address(message[2], message + 8, len - 6, address); @@ -462,7 +462,7 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT((ndo, " router-id")); else { ND_PRINT((ndo, "\n\tRouter Id")); - if(len < 10) goto corrupt; + if(len < 10) goto invalid; ND_PRINT((ndo, " %s", format_id(message + 4))); } } @@ -475,9 +475,9 @@ babel_print_v2(netdissect_options *ndo, int rc; u_char nh[16]; ND_PRINT((ndo, "\n\tNext Hop")); - if(len < 2) goto corrupt; + if(len < 2) goto invalid; rc = network_address(message[2], message + 4, len - 2, nh); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; ND_PRINT((ndo, " %s", format_address(ndo, nh))); } } @@ -499,13 +499,13 @@ babel_print_v2(netdissect_options *ndo, int rc; u_char prefix[16]; ND_PRINT((ndo, "\n\tUpdate")); - if(len < 10) goto corrupt; + if(len < 10) goto invalid; plen = message[4] + (message[2] == 1 ? 96 : 0); rc = network_prefix(message[2], message[4], message[5], message + 12, message[2] == 1 ? v4_prefix : v6_prefix, len - 10, prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; interval = EXTRACT_16BITS(message + 6); seqno = EXTRACT_16BITS(message + 8); metric = EXTRACT_16BITS(message + 10); @@ -535,11 +535,11 @@ babel_print_v2(netdissect_options *ndo, int rc; u_char prefix[16], plen; ND_PRINT((ndo, "\n\tRequest ")); - if(len < 2) goto corrupt; + if(len < 2) goto invalid; plen = message[3] + (message[2] == 1 ? 96 : 0); rc = network_prefix(message[2], message[3], 0, message + 4, NULL, len - 2, prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; ND_PRINT((ndo, "for %s", message[2] == 0 ? "any" : format_prefix(ndo, prefix, plen))); } @@ -554,11 +554,11 @@ babel_print_v2(netdissect_options *ndo, u_short seqno; u_char prefix[16], plen; ND_PRINT((ndo, "\n\tMH-Request ")); - if(len < 14) goto corrupt; + if(len < 14) goto invalid; seqno = EXTRACT_16BITS(message + 4); rc = network_prefix(message[2], message[3], 0, message + 16, NULL, len - 14, prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; plen = message[3] + (message[2] == 1 ? 96 : 0); ND_PRINT((ndo, "(%u hops) for %s seqno %u id %s", message[6], format_prefix(ndo, prefix, plen), @@ -571,7 +571,7 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT((ndo, " tspc")); else { ND_PRINT((ndo, "\n\tTS/PC ")); - if(len < 6) goto corrupt; + if(len < 6) goto invalid; ND_PRINT((ndo, "timestamp %u packetcounter %u", EXTRACT_32BITS (message + 4), EXTRACT_16BITS(message + 2))); } @@ -582,7 +582,7 @@ babel_print_v2(netdissect_options *ndo, else { unsigned j; ND_PRINT((ndo, "\n\tHMAC ")); - if(len < 18) goto corrupt; + if(len < 18) goto invalid; ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_16BITS(message + 2), len - 2)); for (j = 0; j < len - 2; j++) ND_PRINT((ndo, "%02X", message[4 + j])); @@ -600,7 +600,7 @@ babel_print_v2(netdissect_options *ndo, int rc; int parsed_len = 10; ND_PRINT((ndo, "\n\tSS-Update")); - if(len < 10) goto corrupt; + if(len < 10) goto invalid; ae = message[2]; src_plen = message[3]; plen = message[4]; @@ -611,13 +611,13 @@ babel_print_v2(netdissect_options *ndo, rc = network_prefix(ae, plen, omitted, message + 2 + parsed_len, ae == 1 ? v4_prefix : v6_prefix, len - parsed_len, prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; if(ae == 1) plen += 96; parsed_len += rc; rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len, NULL, len - parsed_len, src_prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; if(ae == 1) src_plen += 96; parsed_len += rc; @@ -641,19 +641,19 @@ babel_print_v2(netdissect_options *ndo, int rc, parsed_len = 3; u_char ae, plen, src_plen, prefix[16], src_prefix[16]; ND_PRINT((ndo, "\n\tSS-Request ")); - if(len < 3) goto corrupt; + if(len < 3) goto invalid; ae = message[2]; plen = message[3]; src_plen = message[4]; rc = network_prefix(ae, plen, 0, message + 2 + parsed_len, NULL, len - parsed_len, prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; if(ae == 1) plen += 96; parsed_len += rc; rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len, NULL, len - parsed_len, src_prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; if(ae == 1) src_plen += 96; parsed_len += rc; @@ -676,7 +676,7 @@ babel_print_v2(netdissect_options *ndo, u_char ae, plen, src_plen, prefix[16], src_prefix[16], hopc; const u_char *router_id = NULL; ND_PRINT((ndo, "\n\tSS-MH-Request ")); - if(len < 14) goto corrupt; + if(len < 14) goto invalid; ae = message[2]; plen = message[3]; seqno = EXTRACT_16BITS(message + 4); @@ -685,13 +685,13 @@ babel_print_v2(netdissect_options *ndo, router_id = message + 8; rc = network_prefix(ae, plen, 0, message + 2 + parsed_len, NULL, len - parsed_len, prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; if(ae == 1) plen += 96; parsed_len += rc; rc = network_prefix(ae, src_plen, 0, message + 2 + parsed_len, NULL, len - parsed_len, src_prefix); - if(rc < 0) goto corrupt; + if(rc < 0) goto invalid; if(ae == 1) src_plen += 96; ND_PRINT((ndo, "(%u hops) for (%s, ", @@ -717,7 +717,7 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT((ndo, " %s", tstr)); return; - corrupt: - ND_PRINT((ndo, " (corrupt)")); + invalid: + ND_PRINT((ndo, " (invalid)")); return; } diff --git a/print-bgp.c b/print-bgp.c index 9b622234..8d3ea155 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -2339,7 +2339,7 @@ bgp_capabilities_print(netdissect_options *ndo, } while (tcap_len > 0) { if (tcap_len < 4) { - ND_PRINT((ndo, "\n\t\t(malformed)")); + ND_PRINT((ndo, "\n\t\t(invalid)")); break; } ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u), Send/Receive: %s", diff --git a/print-bootp.c b/print-bootp.c index bc03be9f..2bd47bee 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -996,7 +996,7 @@ rfc1048_print(netdissect_options *ndo, break; } if (len < suboptlen) { - ND_PRINT((ndo, "ERROR: malformed option")); + ND_PRINT((ndo, "ERROR: invalid option")); bp += len; len = 0; break; diff --git a/print-geonet.c b/print-geonet.c index 45326154..9b61ef20 100644 --- a/print-geonet.c +++ b/print-geonet.c @@ -117,7 +117,7 @@ geonet_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_int /* Process Common Header */ if (length < 36) - goto malformed; + goto invalid; ND_TCHECK2(*bp, 7); version = bp[0] >> 4; @@ -223,7 +223,7 @@ geonet_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_int /* Skip Extended headers */ if (hdr_size >= 0) { if (length < (u_int)hdr_size) - goto malformed; + goto invalid; ND_TCHECK2(*bp, hdr_size); length -= hdr_size; bp += hdr_size; @@ -233,7 +233,7 @@ geonet_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_int case 1: case 2: /* BTP A/B */ if (length < 4) - goto malformed; + goto invalid; ND_TCHECK2(*bp, 4); print_btp(ndo, bp); length -= 4; @@ -260,7 +260,7 @@ geonet_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_int ND_DEFAULTPRINT(bp, length); return; -malformed: +invalid: ND_PRINT((ndo, " Malformed (small) ")); /* XXX - print the remaining data as hex? */ return; diff --git a/print-isoclns.c b/print-isoclns.c index 4298d5e4..b1b4e215 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -2450,7 +2450,7 @@ isis_print(netdissect_options *ndo, tlv_type, tlv_len)); - if (tlv_len == 0) /* something is malformed */ + if (tlv_len == 0) /* something is invalid */ continue; /* now check if we have a decoder otherwise do a hexdump at the end*/ @@ -2670,7 +2670,7 @@ isis_print(netdissect_options *ndo, ND_PRINT((ndo, "%02x", *(tptr + i))); } if (tlv_len != ISIS_SUBTLV_AUTH_MD5_LEN+1) - ND_PRINT((ndo, ", (malformed subTLV) ")); + ND_PRINT((ndo, ", (invalid subTLV) ")); #ifdef HAVE_LIBCRYPTO sigcheck = signature_verify(ndo, optr, length, @@ -2916,7 +2916,7 @@ isis_print(netdissect_options *ndo, tptr+=mt_len; tmp-=mt_len; } else { - ND_PRINT((ndo, "\n\t malformed MT-ID")); + ND_PRINT((ndo, "\n\t invalid MT-ID")); break; } } diff --git a/print-loopback.c b/print-loopback.c index e54d1dbf..fa679512 100644 --- a/print-loopback.c +++ b/print-loopback.c @@ -42,7 +42,7 @@ #include "addrtoname.h" static const char tstr[] = " [|loopback]"; -static const char cstr[] = " (corrupt)"; +static const char cstr[] = " (invalid)"; #define LOOPBACK_REPLY 1 #define LOOPBACK_FWDDATA 2 @@ -60,7 +60,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le uint16_t function; if (len < 2) - goto corrupt; + goto invalid; /* function */ ND_TCHECK2(*cp, 2); function = EXTRACT_LE_16BITS(cp); @@ -70,7 +70,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le switch (function) { case LOOPBACK_REPLY: if (len < 4) - goto corrupt; + goto invalid; /* receipt number */ ND_TCHECK2(*cp, 2); ND_PRINT((ndo, ", receipt number %u", EXTRACT_LE_16BITS(cp))); @@ -81,7 +81,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le break; case LOOPBACK_FWDDATA: if (len < 8) - goto corrupt; + goto invalid; /* forwarding address */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); ND_PRINT((ndo, ", forwarding address %s", etheraddr_string(ndo, cp))); @@ -96,7 +96,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le } return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return; @@ -112,7 +112,7 @@ loopback_print(netdissect_options *ndo, const u_char *cp, const u_int len) ND_PRINT((ndo, "Loopback")); if (len < 2) - goto corrupt; + goto invalid; /* skipCount */ ND_TCHECK2(*cp, 2); skipCount = EXTRACT_LE_16BITS(cp); @@ -121,11 +121,11 @@ loopback_print(netdissect_options *ndo, const u_char *cp, const u_int len) if (skipCount % 8) ND_PRINT((ndo, " (bogus)")); if (skipCount > len - 2) - goto corrupt; + goto invalid; loopback_message_print(ndo, cp + skipCount, len - 2 - skipCount); return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return; diff --git a/print-m3ua.c b/print-m3ua.c index b217e8ff..463a9540 100644 --- a/print-m3ua.c +++ b/print-m3ua.c @@ -32,7 +32,7 @@ #include "extract.h" static const char tstr[] = " [|m3ua]"; -static const char cstr[] = " (corrupt)"; +static const char cstr[] = " (invalid)"; /* RFC 4666 */ @@ -217,7 +217,7 @@ tag_value_print(netdissect_options *ndo, case M3UA_PARAM_CORR_ID: /* buf and size don't include the header */ if (size < 4) - goto corrupt; + goto invalid; ND_TCHECK2(*buf, size); ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(buf))); break; @@ -228,7 +228,7 @@ tag_value_print(netdissect_options *ndo, } return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*buf, size); return; @@ -258,7 +258,7 @@ m3ua_tags_print(netdissect_options *ndo, while (p < buf + size) { if (p + sizeof(struct m3ua_param_header) > buf + size) - goto corrupt; + goto invalid; ND_TCHECK2(*p, sizeof(struct m3ua_param_header)); /* Parameter Tag */ hdr_tag = EXTRACT_16BITS(p); @@ -266,7 +266,7 @@ m3ua_tags_print(netdissect_options *ndo, /* Parameter Length */ hdr_len = EXTRACT_16BITS(p + 2); if (hdr_len < sizeof(struct m3ua_param_header)) - goto corrupt; + goto invalid; /* Parameter Value */ align = (p + hdr_len - buf) % 4; align = align ? 4 - align : 0; @@ -276,7 +276,7 @@ m3ua_tags_print(netdissect_options *ndo, } return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*buf, size); return; @@ -304,7 +304,7 @@ m3ua_print(netdissect_options *ndo, /* size includes the header */ if (size < sizeof(struct m3ua_common_header)) - goto corrupt; + goto invalid; ND_TCHECK(*hdr); if (hdr->v != M3UA_REL_1_0) return; @@ -328,7 +328,7 @@ m3ua_print(netdissect_options *ndo, m3ua_tags_print(ndo, buf + sizeof(struct m3ua_common_header), EXTRACT_32BITS(&hdr->len) - sizeof(struct m3ua_common_header)); return; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*buf, size); return; diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index 8cfc00c3..fd3ac3b0 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -14,7 +14,7 @@ * * ep -- the pointer to the end of the captured frame * They return either the pointer to the next not-yet-decoded part of the frame * or the value of ep, which means the current frame processing is over as it - * has been fully decoded or is malformed or truncated. This way it is possible + * has been fully decoded or is invalid or truncated. This way it is possible * to chain and nest such functions uniformly to decode an OF1.0 message, which * consists of several layers of nested structures. * @@ -72,7 +72,7 @@ #include "openflow.h" static const char tstr[] = " [|openflow]"; -static const char cstr[] = " (corrupt)"; +static const char cstr[] = " (invalid)"; #define OFPT_HELLO 0x00 #define OFPT_ERROR 0x01 @@ -759,7 +759,7 @@ of10_bsn_message_print(netdissect_options *ndo, uint32_t subtype; if (len < 4) - goto corrupt; + goto invalid; /* subtype */ ND_TCHECK2(*cp, 4); subtype = EXTRACT_32BITS(cp); @@ -780,7 +780,7 @@ of10_bsn_message_print(netdissect_options *ndo, * */ if (len != 12) - goto corrupt; + goto invalid; /* index */ ND_TCHECK2(*cp, 1); ND_PRINT((ndo, ", index %u", *cp)); @@ -804,7 +804,7 @@ of10_bsn_message_print(netdissect_options *ndo, * */ if (len != 12) - goto corrupt; + goto invalid; /* index */ ND_TCHECK2(*cp, 1); ND_PRINT((ndo, ", index %u", *cp)); @@ -831,7 +831,7 @@ of10_bsn_message_print(netdissect_options *ndo, * */ if (len != 8) - goto corrupt; + goto invalid; /* report_mirror_ports */ ND_TCHECK2(*cp, 1); ND_PRINT((ndo, ", report_mirror_ports %s", tok2str(bsn_onoff_str, "bogus (%u)", *cp))); @@ -854,7 +854,7 @@ of10_bsn_message_print(netdissect_options *ndo, * */ if (len != 4) - goto corrupt; + goto invalid; break; case BSN_VIRTUAL_PORT_REMOVE_REQUEST: /* @@ -868,7 +868,7 @@ of10_bsn_message_print(netdissect_options *ndo, * */ if (len != 8) - goto corrupt; + goto invalid; /* vport_no */ ND_TCHECK2(*cp, 4); ND_PRINT((ndo, ", vport_no %u", EXTRACT_32BITS(cp))); @@ -888,7 +888,7 @@ of10_bsn_message_print(netdissect_options *ndo, * */ if (len < 8) - goto corrupt; + goto invalid; /* service */ ND_TCHECK2(*cp, 4); ND_PRINT((ndo, ", service %u", EXTRACT_32BITS(cp))); @@ -935,7 +935,7 @@ of10_bsn_message_print(netdissect_options *ndo, * */ if (len != 8) - goto corrupt; + goto invalid; /* status */ ND_TCHECK2(*cp, 4); ND_PRINT((ndo, ", status 0x%08x", EXTRACT_32BITS(cp))); @@ -947,7 +947,7 @@ of10_bsn_message_print(netdissect_options *ndo, } return cp; -corrupt: /* skip the undersized data */ +invalid: /* skip the undersized data */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len); return cp0 + len; @@ -964,7 +964,7 @@ of10_bsn_actions_print(netdissect_options *ndo, uint32_t subtype, vlan_tag; if (len < 4) - goto corrupt; + goto invalid; /* subtype */ ND_TCHECK2(*cp, 4); subtype = EXTRACT_32BITS(cp); @@ -987,7 +987,7 @@ of10_bsn_actions_print(netdissect_options *ndo, * */ if (len != 16) - goto corrupt; + goto invalid; /* dest_port */ ND_TCHECK2(*cp, 4); ND_PRINT((ndo, ", dest_port %u", EXTRACT_32BITS(cp))); @@ -1021,7 +1021,7 @@ of10_bsn_actions_print(netdissect_options *ndo, return cp; -corrupt: +invalid: ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len); return cp0 + len; @@ -1038,7 +1038,7 @@ of10_vendor_action_print(netdissect_options *ndo, const u_char *(*decoder)(netdissect_options *, const u_char *, const u_char *, const u_int); if (len < 4) - goto corrupt; + goto invalid; /* vendor */ ND_TCHECK2(*cp, 4); vendor = EXTRACT_32BITS(cp); @@ -1050,7 +1050,7 @@ of10_vendor_action_print(netdissect_options *ndo, of10_data_print; return decoder(ndo, cp, ep, len - 4); -corrupt: /* skip the undersized data */ +invalid: /* skip the undersized data */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, len); return cp + len; @@ -1067,7 +1067,7 @@ of10_vendor_message_print(netdissect_options *ndo, const u_char *(*decoder)(netdissect_options *, const u_char *, const u_char *, u_int); if (len < 4) - goto corrupt; + goto invalid; /* vendor */ ND_TCHECK2(*cp, 4); vendor = EXTRACT_32BITS(cp); @@ -1079,7 +1079,7 @@ of10_vendor_message_print(netdissect_options *ndo, of10_data_print; return decoder(ndo, cp, ep, len - 4); -corrupt: /* skip the undersized data */ +invalid: /* skip the undersized data */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, len); return cp + len; @@ -1096,7 +1096,7 @@ of10_vendor_data_print(netdissect_options *ndo, uint32_t vendor; if (len < 4) - goto corrupt; + goto invalid; /* vendor */ ND_TCHECK2(*cp, 4); vendor = EXTRACT_32BITS(cp); @@ -1105,7 +1105,7 @@ of10_vendor_data_print(netdissect_options *ndo, /* data */ return of10_data_print(ndo, cp, ep, len - 4); -corrupt: /* skip the undersized data */ +invalid: /* skip the undersized data */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, len); return cp + len; @@ -1146,7 +1146,7 @@ of10_phy_ports_print(netdissect_options *ndo, while (len) { if (len < OF_PHY_PORT_LEN) - goto corrupt; + goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); @@ -1202,7 +1202,7 @@ next_port: } /* while */ return cp; -corrupt: /* skip the undersized trailing data */ +invalid: /* skip the undersized trailing data */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -1224,7 +1224,7 @@ of10_queue_props_print(netdissect_options *ndo, u_char plen_bogus = 0, skip = 0; if (len < OF_QUEUE_PROP_HEADER_LEN) - goto corrupt; + goto invalid; /* property */ ND_TCHECK2(*cp, 2); property = EXTRACT_16BITS(cp); @@ -1236,7 +1236,7 @@ of10_queue_props_print(netdissect_options *ndo, cp += 2; ND_PRINT((ndo, ", len %u", plen)); if (plen < OF_QUEUE_PROP_HEADER_LEN || plen > len) - goto corrupt; + goto invalid; /* pad */ ND_TCHECK2(*cp, 4); cp += 4; @@ -1278,7 +1278,7 @@ next_property: } /* while */ return cp; -corrupt: /* skip the rest of queue properties */ +invalid: /* skip the rest of queue properties */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -1298,7 +1298,7 @@ of10_queues_print(netdissect_options *ndo, while (len) { if (len < OF_PACKET_QUEUE_LEN) - goto corrupt; + goto invalid; /* queue_id */ ND_TCHECK2(*cp, 4); ND_PRINT((ndo, "\n\t queue_id %u", EXTRACT_32BITS(cp))); @@ -1309,7 +1309,7 @@ of10_queues_print(netdissect_options *ndo, cp += 2; ND_PRINT((ndo, ", len %u", desclen)); if (desclen < OF_PACKET_QUEUE_LEN || desclen > len) - goto corrupt; + goto invalid; /* pad */ ND_TCHECK2(*cp, 2); cp += 2; @@ -1326,7 +1326,7 @@ next_queue: } /* while */ return cp; -corrupt: /* skip the rest of queues */ +invalid: /* skip the rest of queues */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -1453,7 +1453,7 @@ of10_actions_print(netdissect_options *ndo, u_char alen_bogus = 0, skip = 0; if (len < OF_ACTION_HEADER_LEN) - goto corrupt; + goto invalid; /* type */ ND_TCHECK2(*cp, 2); type = EXTRACT_16BITS(cp); @@ -1466,7 +1466,7 @@ of10_actions_print(netdissect_options *ndo, ND_PRINT((ndo, ", len %u", alen)); /* On action size underrun/overrun skip the rest of the action list. */ if (alen < OF_ACTION_HEADER_LEN || alen > len) - goto corrupt; + goto invalid; /* On action size inappropriate for the given type or invalid type just skip * the current action, as the basic length constraint has been met. */ switch (type) { @@ -1597,7 +1597,7 @@ next_action: } /* while */ return cp; -corrupt: /* skip the rest of actions */ +invalid: /* skip the rest of actions */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -1765,12 +1765,12 @@ of10_stats_request_print(netdissect_options *ndo, case OFPST_DESC: case OFPST_TABLE: if (len) - goto corrupt; + goto invalid; return cp; case OFPST_FLOW: case OFPST_AGGREGATE: if (len != OF_FLOW_STATS_REQUEST_LEN) - goto corrupt; + goto invalid; /* match */ if (ep == (cp = of10_match_print(ndo, "\n\t ", cp, ep))) return ep; /* end of snapshot */ @@ -1787,7 +1787,7 @@ of10_stats_request_print(netdissect_options *ndo, return cp + 2; case OFPST_PORT: if (len != OF_PORT_STATS_REQUEST_LEN) - goto corrupt; + goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); @@ -1797,7 +1797,7 @@ of10_stats_request_print(netdissect_options *ndo, return cp + 6; case OFPST_QUEUE: if (len != OF_QUEUE_STATS_REQUEST_LEN) - goto corrupt; + goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); @@ -1814,7 +1814,7 @@ of10_stats_request_print(netdissect_options *ndo, } return cp; -corrupt: /* skip the message body */ +invalid: /* skip the message body */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -1829,7 +1829,7 @@ of10_desc_stats_reply_print(netdissect_options *ndo, const u_char *cp, const u_char *ep, const u_int len) { if (len != OF_DESC_STATS_LEN) - goto corrupt; + goto invalid; /* mfr_desc */ ND_TCHECK2(*cp, DESC_STR_LEN); ND_PRINT((ndo, "\n\t mfr_desc '")); @@ -1861,7 +1861,7 @@ of10_desc_stats_reply_print(netdissect_options *ndo, ND_PRINT((ndo, "'")); return cp + DESC_STR_LEN; -corrupt: /* skip the message body */ +invalid: /* skip the message body */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, len); return cp + len; @@ -1881,13 +1881,13 @@ of10_flow_stats_reply_print(netdissect_options *ndo, while (len) { if (len < OF_FLOW_STATS_LEN) - goto corrupt; + goto invalid; /* length */ ND_TCHECK2(*cp, 2); entry_len = EXTRACT_16BITS(cp); ND_PRINT((ndo, "\n\t length %u", entry_len)); if (entry_len < OF_FLOW_STATS_LEN || entry_len > len) - goto corrupt; + goto invalid; cp += 2; /* table_id */ ND_TCHECK2(*cp, 1); @@ -1942,7 +1942,7 @@ of10_flow_stats_reply_print(netdissect_options *ndo, } /* while */ return cp; -corrupt: /* skip the rest of flow statistics entries */ +invalid: /* skip the rest of flow statistics entries */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -1958,7 +1958,7 @@ of10_aggregate_stats_reply_print(netdissect_options *ndo, const u_int len) { if (len != OF_AGGREGATE_STATS_REPLY_LEN) - goto corrupt; + goto invalid; /* packet_count */ ND_TCHECK2(*cp, 8); ND_PRINT((ndo, "\n\t packet_count %" PRIu64, EXTRACT_64BITS(cp))); @@ -1975,7 +1975,7 @@ of10_aggregate_stats_reply_print(netdissect_options *ndo, ND_TCHECK2(*cp, 4); return cp + 4; -corrupt: /* skip the message body */ +invalid: /* skip the message body */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, len); return cp + len; @@ -1994,7 +1994,7 @@ of10_table_stats_reply_print(netdissect_options *ndo, while (len) { if (len < OF_TABLE_STATS_LEN) - goto corrupt; + goto invalid; /* table_id */ ND_TCHECK2(*cp, 1); ND_PRINT((ndo, "\n\t table_id %s", tok2str(tableid_str, "%u", *cp))); @@ -2034,7 +2034,7 @@ of10_table_stats_reply_print(netdissect_options *ndo, } /* while */ return cp; -corrupt: /* skip the undersized trailing data */ +invalid: /* skip the undersized trailing data */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -2053,7 +2053,7 @@ of10_port_stats_reply_print(netdissect_options *ndo, while (len) { if (len < OF_PORT_STATS_LEN) - goto corrupt; + goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); @@ -2119,7 +2119,7 @@ next_port: } /* while */ return cp; -corrupt: /* skip the undersized trailing data */ +invalid: /* skip the undersized trailing data */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -2138,7 +2138,7 @@ of10_queue_stats_reply_print(netdissect_options *ndo, while (len) { if (len < OF_QUEUE_STATS_LEN) - goto corrupt; + goto invalid; /* port_no */ ND_TCHECK2(*cp, 2); ND_PRINT((ndo, "\n\t port_no %s", tok2str(ofpp_str, "%u", EXTRACT_16BITS(cp)))); @@ -2167,7 +2167,7 @@ of10_queue_stats_reply_print(netdissect_options *ndo, } /* while */ return cp; -corrupt: /* skip the undersized trailing data */ +invalid: /* skip the undersized trailing data */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -2238,14 +2238,14 @@ of10_packet_out_print(netdissect_options *ndo, actions_len = EXTRACT_16BITS(cp); cp += 2; if (actions_len > len - OF_PACKET_OUT_LEN) - goto corrupt; + goto invalid; /* actions */ if (ep == (cp = of10_actions_print(ndo, "\n\t ", cp, ep, actions_len))) return ep; /* end of snapshot */ /* data */ return of10_packet_data_print(ndo, cp, ep, len - OF_PACKET_OUT_LEN - actions_len); -corrupt: /* skip the rest of the message body */ +invalid: /* skip the rest of the message body */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp0, len0); return cp0 + len0; @@ -2386,7 +2386,7 @@ of10_header_body_print(netdissect_options *ndo, * possible, check that message length meets the constraint, in remaining * cases check that the length is OK to begin decoding and leave any final * verification up to a lower-layer function. When the current message is - * corrupt, proceed to the next message. */ + * invalid, proceed to the next message. */ /* [OF10] Section 5.1 */ ND_PRINT((ndo, "\n\tversion 1.0, type %s, length %u, xid 0x%08x", @@ -2398,14 +2398,14 @@ of10_header_body_print(netdissect_options *ndo, case OFPT_BARRIER_REQUEST: /* [OF10] Section 5.3.7 */ case OFPT_BARRIER_REPLY: /* ibid */ if (len != OF_HEADER_LEN) - goto corrupt; + goto invalid; break; /* 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; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; /* flags */ @@ -2418,13 +2418,13 @@ of10_header_body_print(netdissect_options *ndo, return cp + 2; case OFPT_PORT_MOD: if (len != OF_PORT_MOD_LEN) - goto corrupt; + goto invalid; 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; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; /* port */ @@ -2436,13 +2436,13 @@ of10_header_body_print(netdissect_options *ndo, return cp + 2; case OFPT_FLOW_REMOVED: if (len != OF_FLOW_REMOVED_LEN) - goto corrupt; + goto invalid; 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; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; /* reason */ @@ -2458,7 +2458,7 @@ of10_header_body_print(netdissect_options *ndo, /* OpenFlow header, fixed-size message body and n * fixed-size data units. */ case OFPT_FEATURES_REPLY: if (len < OF_SWITCH_FEATURES_LEN) - goto corrupt; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; return of10_features_reply_print(ndo, cp, ep, len); @@ -2474,21 +2474,21 @@ of10_header_body_print(netdissect_options *ndo, /* OpenFlow header, fixed-size message body and variable-size data. */ case OFPT_ERROR: if (len < OF_ERROR_MSG_LEN) - goto corrupt; + goto invalid; 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; + goto invalid; 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; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; return of10_packet_in_print(ndo, cp, ep, len); @@ -2498,7 +2498,7 @@ of10_header_body_print(netdissect_options *ndo, /* c. OpenFlow header, fixed-size message body and variable-size data. */ case OFPT_STATS_REQUEST: if (len < OF_STATS_REQUEST_LEN) - goto corrupt; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; return of10_stats_request_print(ndo, cp, ep, len); @@ -2509,7 +2509,7 @@ of10_header_body_print(netdissect_options *ndo, /* d. OpenFlow header, fixed-size message body and variable-size data. */ case OFPT_STATS_REPLY: if (len < OF_STATS_REPLY_LEN) - goto corrupt; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; return of10_stats_reply_print(ndo, cp, ep, len); @@ -2517,7 +2517,7 @@ of10_header_body_print(netdissect_options *ndo, /* OpenFlow header and n * variable-size data units and variable-size data. */ case OFPT_PACKET_OUT: if (len < OF_PACKET_OUT_LEN) - goto corrupt; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; return of10_packet_out_print(ndo, cp, ep, len); @@ -2525,7 +2525,7 @@ of10_header_body_print(netdissect_options *ndo, /* OpenFlow header, fixed-size message body and n * variable-size data units. */ case OFPT_FLOW_MOD: if (len < OF_FLOW_MOD_LEN) - goto corrupt; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; return of10_flow_mod_print(ndo, cp, ep, len); @@ -2533,7 +2533,7 @@ of10_header_body_print(netdissect_options *ndo, /* 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; + goto invalid; if (ndo->ndo_vflag < 1) goto next_message; /* port */ @@ -2548,7 +2548,7 @@ of10_header_body_print(netdissect_options *ndo, } /* switch (type) */ goto next_message; -corrupt: /* skip the message body */ +invalid: /* skip the message body */ ND_PRINT((ndo, "%s", cstr)); next_message: ND_TCHECK2(*cp0, len0 - OF_HEADER_LEN); diff --git a/print-openflow.c b/print-openflow.c index 603ed2b6..233efc99 100644 --- a/print-openflow.c +++ b/print-openflow.c @@ -42,7 +42,7 @@ #include "oui.h" static const char tstr[] = " [|openflow]"; -static const char cstr[] = " (corrupt)"; +static const char cstr[] = " (invalid)"; #define OF_VER_1_0 0x01 @@ -82,7 +82,7 @@ of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep uint32_t xid; if (ep < cp + OF_HEADER_LEN) - goto corrupt; + goto invalid; /* version */ ND_TCHECK2(*cp, 1); version = *cp; @@ -106,7 +106,7 @@ of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep * segment. */ if (length < OF_HEADER_LEN) { of_header_print(ndo, version, type, length, xid); - goto corrupt; + goto invalid; } /* Decode known protocol versions further without printing the header (the * type decoding is version-specific. */ @@ -119,7 +119,7 @@ of_header_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep return cp + length - OF_HEADER_LEN; /* done with current message */ } -corrupt: /* fail current packet */ +invalid: /* fail current packet */ ND_PRINT((ndo, "%s", cstr)); ND_TCHECK2(*cp, ep - cp); return ep; diff --git a/print-tcp.c b/print-tcp.c index 5fbb2ebb..9c5ffbdc 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -476,7 +476,7 @@ tcp_print(netdissect_options *ndo, case TCPOPT_SACK: datalen = len - 2; if (datalen % 8 != 0) { - ND_PRINT((ndo, "malformed sack")); + ND_PRINT((ndo, "invalid sack")); } else { uint32_t s, e; @@ -806,7 +806,7 @@ print_tcp_fastopen_option(netdissect_options *ndo, register const u_char *cp, } else { /* Fast Open Cookie */ if (datalen % 2 != 0 || datalen < 4 || datalen > 16) { - ND_PRINT((ndo, " malformed")); + ND_PRINT((ndo, " invalid")); } else { ND_PRINT((ndo, " cookie ")); for (i = 0; i < datalen; ++i) diff --git a/print-timed.c b/print-timed.c index 7b817141..dcf01db0 100644 --- a/print-timed.c +++ b/print-timed.c @@ -125,7 +125,7 @@ timed_print(netdissect_options *ndo, usec = EXTRACT_32BITS(&tsp->tsp_time.tv_usec); /* XXX The comparison below is always false? */ if (usec < 0) - /* corrupt, skip the rest of the packet */ + /* invalid, skip the rest of the packet */ return; ND_PRINT((ndo, " time ")); if (sec < 0 && usec != 0) { diff --git a/tests/of10_p3295-vv.out b/tests/of10_p3295-vv.out index 7d1a6917..1e9f5d5a 100644 --- a/tests/of10_p3295-vv.out +++ b/tests/of10_p3295-vv.out @@ -497,7 +497,7 @@ IP (tos 0x0, ttl 64, id 783, offset 0, flags [DF], proto TCP (6), length 1500) match nw_proto 1 [|openflow] IP (tos 0x0, ttl 64, id 784, offset 0, flags [DF], proto TCP (6), length 740) 10.0.0.20.6633 > 10.0.0.50.35256: Flags [P.], cksum 0x171c (incorrect -> 0xdfee), seq 1549:2237, ack 2585, win 154, options [nop,nop,TS val 220958532 ecr 194889014], length 688: OpenFlow - version unknown (0x00), type 0x00, length 0, xid 0x0003000d (corrupt) + version unknown (0x00), type 0x00, length 0, xid 0x0003000d (invalid) IP (tos 0x0, ttl 64, id 55503, offset 0, flags [DF], proto TCP (6), length 52) 10.0.0.50.35256 > 10.0.0.20.6633: Flags [.], cksum 0x9386 (correct), seq 2585, ack 1549, win 273, options [nop,nop,TS val 194889016 ecr 220958532], length 0 IP (tos 0x0, ttl 64, id 55504, offset 0, flags [DF], proto TCP (6), length 52) @@ -770,7 +770,7 @@ IP (tos 0x0, ttl 64, id 795, offset 0, flags [DF], proto TCP (6), length 52) 10.0.0.20.6633 > 10.0.0.50.35256: Flags [.], cksum 0x146c (incorrect -> 0x733a), seq 2237, ack 9953, win 248, options [nop,nop,TS val 220958722 ecr 194889063], length 0 IP (tos 0x0, ttl 64, id 55532, offset 0, flags [DF], proto TCP (6), length 2680) 10.0.0.50.35256 > 10.0.0.20.6633: Flags [P.], cksum 0x1eb0 (incorrect -> 0x561b), seq 9953:12581, ack 2237, win 364, options [nop,nop,TS val 194889063 ecr 220958721], length 2628: OpenFlow - version unknown (0x00), type 0x00, length 0, xid 0x00000000 (corrupt) + version unknown (0x00), type 0x00, length 0, xid 0x00000000 (invalid) IP (tos 0x0, ttl 64, id 796, offset 0, flags [DF], proto TCP (6), length 52) 10.0.0.20.6633 > 10.0.0.50.35256: Flags [.], cksum 0x146c (incorrect -> 0x68cd), seq 2237, ack 12581, win 289, options [nop,nop,TS val 220958722 ecr 194889063], length 0 IP (tos 0x0, ttl 64, id 55534, offset 0, flags [DF], proto TCP (6), length 64) diff --git a/tests/of10_s4810-vvvv.out b/tests/of10_s4810-vvvv.out index efec098f..2fb45d6a 100644 --- a/tests/of10_s4810-vvvv.out +++ b/tests/of10_s4810-vvvv.out @@ -377,7 +377,7 @@ IP (tos 0x0, ttl 64, id 53101, offset 0, flags [DF], proto TCP (6), length 4156) match dl_dst 00:11:22:33:00:15 [|openflow] IP (tos 0x0, ttl 64, id 53104, offset 0, flags [DF], proto TCP (6), length 180) 10.0.0.20.6633 > 10.0.0.81.56068: Flags [P.], cksum 0x150b (incorrect -> 0x8ec7), seq 4241:4369, ack 677, win 139, options [nop,nop,TS val 47836527 ecr 1], length 128: OpenFlow - version unknown (0x00), type 0x00, length 0, xid 0x00000000 (corrupt) + version unknown (0x00), type 0x00, length 0, xid 0x00000000 (invalid) IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52) 10.0.0.81.56068 > 10.0.0.20.6633: Flags [.], cksum 0xfaa7 (correct), seq 677, ack 2873, win 952, options [nop,nop,TS val 1 ecr 47836527], length 0 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52) @@ -858,7 +858,7 @@ IP (tos 0x0, ttl 64, id 53581, offset 0, flags [DF], proto TCP (6), length 1500) duration_sec 0, duration_nsec 0, priority 65535, idle_timeout 0, hard_timeout 0, cookie 0x0000000000000025, packet_count 0 [|openflow] IP (tos 0x0, ttl 64, id 53582, offset 0, flags [DF], proto TCP (6), length 1040) 10.0.0.81.56068 > 10.0.0.20.6633: Flags [P.], cksum 0x395e (correct), seq 8113:9101, ack 4545, win 1035, options [nop,nop,TS val 2 ecr 47837000], length 988: OpenFlow - version unknown (0x00), type 0x00, length 0, xid 0x00000000 (corrupt) + version unknown (0x00), type 0x00, length 0, xid 0x00000000 (invalid) IP (tos 0x0, ttl 64, id 53111, offset 0, flags [DF], proto TCP (6), length 52) 10.0.0.20.6633 > 10.0.0.81.56068: Flags [.], cksum 0x148b (incorrect -> 0xd387), seq 4641, ack 9101, win 302, options [nop,nop,TS val 47837000 ecr 2], length 0 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52)