summaryrefslogtreecommitdiffstats
path: root/contrib/tcpdump/print-loopback.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2017-02-10 07:22:12 +0000
committerRenato Botelho <renato@netgate.com>2017-02-10 07:04:32 -0200
commitabb72844124d16a7ad83487bf5f12c49b66e60d5 (patch)
treed6de71264e438b11eb1d196ca9e0c63eda8e56b4 /contrib/tcpdump/print-loopback.c
parent9c520da80579466ed328970249f2a9ea5cb61063 (diff)
downloadFreeBSD-src-abb72844124d16a7ad83487bf5f12c49b66e60d5.zip
FreeBSD-src-abb72844124d16a7ad83487bf5f12c49b66e60d5.tar.gz
Merge r309649, r313048, r313083, r313104:
tcpdump 4.9.0 (cherry picked from commit ad0c9114e00a9a30168e0c13c17d8f65571aa67f)
Diffstat (limited to 'contrib/tcpdump/print-loopback.c')
-rw-r--r--contrib/tcpdump/print-loopback.c36
1 files changed, 18 insertions, 18 deletions
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 <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
-#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:
OpenPOWER on IntegriCloud