X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/546558eabd81cfc36a81a4df728fdfea0d83b41a..e67f4fcae8173ccd4a7de1a0c5fedd2265675f81:/print-tcp.c diff --git a/print-tcp.c b/print-tcp.c index 3b81059b..a7b60b8e 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -183,14 +183,15 @@ tcp_print(netdissect_options *ndo, ch = '\0'; if (!ND_TTEST_2(tp->th_dport)) { if (ip6) { - ND_PRINT("%s > %s: ", + ND_PRINT("%s > %s:", ip6addr_string(ndo, ip6->ip6_src), ip6addr_string(ndo, ip6->ip6_dst)); } else { - ND_PRINT("%s > %s: [|tcp]", - ipaddr_string(ndo, ip->ip_src), + ND_PRINT("%s > %s:", + ipaddr_string(ndo, ip->ip_src), ipaddr_string(ndo, ip->ip_dst)); } + nd_print_trunc(ndo); return; } @@ -274,11 +275,11 @@ tcp_print(netdissect_options *ndo, if (rev) { UNALIGNED_MEMCPY(&tha.src, dst, sizeof(ip6->ip6_dst)); UNALIGNED_MEMCPY(&tha.dst, src, sizeof(ip6->ip6_src)); - tha.port = dport << 16 | sport; + tha.port = ((u_int)dport) << 16 | sport; } else { UNALIGNED_MEMCPY(&tha.dst, dst, sizeof(ip6->ip6_dst)); UNALIGNED_MEMCPY(&tha.src, src, sizeof(ip6->ip6_src)); - tha.port = sport << 16 | dport; + tha.port = ((u_int)sport) << 16 | dport; } for (th = &tcp_seq_hash[tha.port % TSEQ_HASHSIZE]; @@ -330,13 +331,13 @@ tcp_print(netdissect_options *ndo, sizeof(ip->ip_dst)); UNALIGNED_MEMCPY(&tha.dst, ip->ip_src, sizeof(ip->ip_src)); - tha.port = dport << 16 | sport; + tha.port = ((u_int)dport) << 16 | sport; } else { UNALIGNED_MEMCPY(&tha.dst, ip->ip_dst, sizeof(ip->ip_dst)); UNALIGNED_MEMCPY(&tha.src, ip->ip_src, sizeof(ip->ip_src)); - tha.port = sport << 16 | dport; + tha.port = ((u_int)sport) << 16 | dport; } for (th = &tcp_seq_hash[tha.port % TSEQ_HASHSIZE]; @@ -736,6 +737,12 @@ tcp_print(netdissect_options *ndo, rtsp_print(ndo, bp, length); } else if (length > 2 && (IS_SRC_OR_DST_PORT(NAMESERVER_PORT))) { + /* domain_print() assumes it does not have to prepend a space before its + * own output to separate it from the output of the calling function. This + * works well with udp_print(), but requires a small prop here. + */ + ND_PRINT(" "); + /* * TCP DNS query has 2byte length at the head. * XXX packet could be unaligned, it can go strange @@ -786,10 +793,10 @@ tcp_print(netdissect_options *ndo, bad: ND_PRINT("[bad opt]"); if (ch != '\0') - ND_PRINT(">"); + ND_PRINT("]"); return; trunc: - ND_PRINT("[|tcp]"); + nd_print_trunc(ndo); if (ch != '\0') ND_PRINT(">"); } @@ -824,7 +831,7 @@ print_tcp_rst_data(netdissect_options *ndo, while (length-- && sp < ndo->ndo_snapend) { c = EXTRACT_U_1(sp); sp++; - safeputchar(ndo, c); + fn_print_char(ndo, c); } ND_PRINT("]"); } @@ -936,10 +943,3 @@ tcp_verify_signature(netdissect_options *ndo, } USES_APPLE_RST #endif /* HAVE_LIBCRYPTO */ - -/* - * Local Variables: - * c-style: whitesmith - * c-basic-offset: 8 - * End: - */