X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/a8726b69466cd029875d851b35ad41778b3e8cc3..c20547acdacc5a3c31b834c73f00dba895256444:/print-tcp.c diff --git a/print-tcp.c b/print-tcp.c index 4f91b762..38f80d9b 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -30,9 +30,7 @@ __RCSID("$NetBSD: print-tcp.c,v 1.8 2007/07/24 11:53:48 drochner Exp $"); #endif -#ifdef HAVE_CONFIG_H #include -#endif #include "netdissect-stdinc.h" @@ -113,6 +111,7 @@ const struct tok tcp_flag_values[] = { { TH_URG, "U" }, { TH_ECNECHO, "E" }, { TH_CWR, "W" }, + { TH_AE, "e" }, { 0, NULL } }; @@ -166,7 +165,7 @@ tcp_print(netdissect_options *ndo, { const struct tcphdr *tp; const struct ip *ip; - u_char flags; + uint16_t flags; u_int hlen; char ch; uint16_t sport, dport, win, urp; @@ -248,7 +247,7 @@ tcp_print(netdissect_options *ndo, return; } - flags = GET_U_1(tp->th_flags); + flags = tcp_get_flags(tp); ND_PRINT("Flags [%s]", bittok2str_nosep(tcp_flag_values, "none", flags)); if (!ndo->ndo_Sflag && (flags & TH_ACK)) { @@ -426,14 +425,19 @@ tcp_print(netdissect_options *ndo, } } - if (flags & TH_ACK) { + if (flags & TH_ACK) ND_PRINT(", ack %u", ack); - } + else + if (ndo->ndo_vflag > 1 && ack != 0) + ND_PRINT(", [ack %u != 0 while ACK flag not set]", ack); ND_PRINT(", win %u", win); if (flags & TH_URG) ND_PRINT(", urg %u", urp); + else + if (ndo->ndo_vflag > 1 && urp != 0) + ND_PRINT(", [urg %u != 0 while URG flag not set]", urp); /* * Handle any options. */ @@ -445,7 +449,7 @@ tcp_print(netdissect_options *ndo, hlen -= sizeof(*tp); cp = (const u_char *)tp + sizeof(*tp); ND_PRINT(", options ["); - while (hlen > 0) { + while (hlen != 0) { if (ch != '\0') ND_PRINT("%c", ch); opt = GET_U_1(cp);