From abb72844124d16a7ad83487bf5f12c49b66e60d5 Mon Sep 17 00:00:00 2001 From: glebius Date: Fri, 10 Feb 2017 07:22:12 +0000 Subject: Merge r309649, r313048, r313083, r313104: tcpdump 4.9.0 (cherry picked from commit ad0c9114e00a9a30168e0c13c17d8f65571aa67f) --- contrib/tcpdump/print-loopback.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'contrib/tcpdump/print-loopback.c') diff --git a/contrib/tcpdump/print-loopback.c b/contrib/tcpdump/print-loopback.c index 9a74ae6..10f6931 100644 --- a/contrib/tcpdump/print-loopback.c +++ b/contrib/tcpdump/print-loopback.c @@ -1,9 +1,4 @@ /* - * This module implements decoding of the Loopback Protocol, originally - * defined as the Configuration Testing Protocol. It is based on the following - * specification: - * http://www.mit.edu/people/jhawk/ctp.pdf - * * Copyright (c) 2014 The TCPDUMP project * All rights reserved. * @@ -30,20 +25,25 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#define NETDISSECT_REWORKED +/* \summary: Loopback Protocol printer */ + +/* + * originally defined as the Ethernet Configuration Testing Protocol. + * specification: http://www.mit.edu/people/jhawk/ctp.pdf + */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include -#include "interface.h" +#include "netdissect.h" #include "extract.h" #include "ether.h" #include "addrtoname.h" static const char tstr[] = " [|loopback]"; -static const char cstr[] = " (corrupt)"; #define LOOPBACK_REPLY 1 #define LOOPBACK_FWDDATA 2 @@ -61,7 +61,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); @@ -71,7 +71,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))); @@ -82,7 +82,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))); @@ -97,8 +97,8 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le } return; -corrupt: - ND_PRINT((ndo, "%s", cstr)); +invalid: + ND_PRINT((ndo, "%s", istr)); ND_TCHECK2(*cp, ep - cp); return; trunc: @@ -113,7 +113,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); @@ -122,12 +122,12 @@ 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: - ND_PRINT((ndo, "%s", cstr)); +invalid: + ND_PRINT((ndo, "%s", istr)); ND_TCHECK2(*cp, ep - cp); return; trunc: -- cgit v1.1