aboutsummaryrefslogtreecommitdiff
path: root/contrib/tcpdump/print-aoe.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tcpdump/print-aoe.c')
-rw-r--r--contrib/tcpdump/print-aoe.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/contrib/tcpdump/print-aoe.c b/contrib/tcpdump/print-aoe.c
index f8bc1fc9b990..97e93df2eab5 100644
--- a/contrib/tcpdump/print-aoe.c
+++ b/contrib/tcpdump/print-aoe.c
@@ -1,8 +1,4 @@
/*
- * This module implements decoding of the ATA over Ethernet (AoE) protocol
- * according to the following specification:
- * http://support.coraid.com/documents/AoEr11.txt
- *
* Copyright (c) 2014 The TCPDUMP project
* All rights reserved.
*
@@ -29,20 +25,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
+/* \summary: ATA over Ethernet (AoE) protocol printer */
+
+/* specification: http://brantleycoilecompany.com/AoEr11.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 "addrtoname.h"
#include "ether.h"
static const char tstr[] = " [|aoe]";
-static const char cstr[] = " (corrupt)";
#define AOE_V1 1
#define ATA_SECTOR_SIZE 512
@@ -148,7 +146,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)));
@@ -197,8 +195,8 @@ aoev1_issue_print(netdissect_options *ndo,
ND_PRINT((ndo, "\n\tData: %u bytes", len - AOEV1_ISSUE_ARG_LEN));
return;
-corrupt:
- ND_PRINT((ndo, "%s", cstr));
+invalid:
+ ND_PRINT((ndo, "%s", istr));
ND_TCHECK2(*cp, ep - cp);
return;
trunc:
@@ -213,7 +211,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)));
@@ -236,7 +234,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) {
@@ -246,8 +244,8 @@ aoev1_query_print(netdissect_options *ndo,
}
return;
-corrupt:
- ND_PRINT((ndo, "%s", cstr));
+invalid:
+ ND_PRINT((ndo, "%s", istr));
ND_TCHECK2(*cp, ep - cp);
return;
trunc:
@@ -262,7 +260,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;
@@ -280,7 +278,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 */
@@ -297,8 +295,8 @@ aoev1_mac_print(netdissect_options *ndo,
}
return;
-corrupt:
- ND_PRINT((ndo, "%s", cstr));
+invalid:
+ ND_PRINT((ndo, "%s", istr));
ND_TCHECK2(*cp, ep - cp);
return;
trunc:
@@ -313,7 +311,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)));
@@ -324,7 +322,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)));
@@ -332,8 +330,8 @@ aoev1_reserve_print(netdissect_options *ndo,
}
return;
-corrupt:
- ND_PRINT((ndo, "%s", cstr));
+invalid:
+ ND_PRINT((ndo, "%s", istr));
ND_TCHECK2(*cp, ep - cp);
return;
trunc:
@@ -350,7 +348,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)));
@@ -390,8 +388,8 @@ aoev1_print(netdissect_options *ndo,
cmd_decoder(ndo, cp, len - AOEV1_COMMON_HDR_LEN);
return;
-corrupt:
- ND_PRINT((ndo, "%s", cstr));
+invalid:
+ ND_PRINT((ndo, "%s", istr));
ND_TCHECK2(*cp, ep - cp);
return;
trunc:
@@ -408,7 +406,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;
@@ -422,8 +420,8 @@ aoe_print(netdissect_options *ndo,
}
return;
-corrupt:
- ND_PRINT((ndo, "%s", cstr));
+invalid:
+ ND_PRINT((ndo, "%s", istr));
ND_TCHECK2(*cp, ep - cp);
return;
trunc: