X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/94a3708f00f658994293a440fbbb7e71e2047a0f..806745e10e5ad2c963792a481c88fe2ee039bb00:/print-tcp.c diff --git a/print-tcp.c b/print-tcp.c index 161f17e7..d997cbcd 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -425,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. */ @@ -724,8 +729,11 @@ tcp_print(netdissect_options *ndo, nd_trunc_longjmp(ndo); } bp += header_len; - if ((flags & TH_RST) && ndo->ndo_vflag) { - print_tcp_rst_data(ndo, bp, length); + if (flags & TH_RST) { + if (ndo->ndo_vflag) + print_tcp_rst_data(ndo, bp, length); + else + ND_TCHECK_LEN(bp, length); return; } @@ -859,14 +867,13 @@ static void print_tcp_rst_data(netdissect_options *ndo, const u_char *sp, u_int length) { - ND_PRINT(ND_TTEST_LEN(sp, length) ? " [RST" : " [!RST"); - if (length > MAX_RST_DATA_LEN) { - length = MAX_RST_DATA_LEN; /* can use -X for longer */ + ND_PRINT(" [RST"); + if (length > MAX_RST_DATA_LEN) /* can use -X for longer */ ND_PRINT("+"); /* indicate we truncate */ - } ND_PRINT(" "); - (void)nd_printn(ndo, sp, length, ndo->ndo_snapend); + nd_printjn(ndo, sp, ND_MIN(length, MAX_RST_DATA_LEN)); ND_PRINT("]"); + ND_TCHECK_LEN(sp, length); } static void