summaryrefslogtreecommitdiff
path: root/print-tcp.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-06-10 12:13:53 +0200
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2020-06-10 15:22:00 +0200
commit63216357de0aa557888329c614946626e37d7c6b (patch)
treec0375c5bd432b7ddba713ee70f180a27917457a0 /print-tcp.c
parent403ae5774ba79909da85efebec754a2c82b24053 (diff)
downloadtcpdump-63216357de0aa557888329c614946626e37d7c6b.tar.gz
DNS: Do the 'over TCP' processing in the printer
Add the parameter 'over_tcp'. Move the shift by 2 bytes from the TCP printer to the DNS printer. Move adding a prepended space from the TCP printer to the DNS printer. Add a length check. Add some comments about 'over_tcp' and 'is_mdns' call values.
Diffstat (limited to 'print-tcp.c')
-rw-r--r--print-tcp.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/print-tcp.c b/print-tcp.c
index a08053b6..88870c65 100644
--- a/print-tcp.c
+++ b/print-tcp.c
@@ -703,8 +703,8 @@ tcp_print(netdissect_options *ndo,
resp_print(ndo, bp, length);
break;
case PT_DOMAIN:
- ND_PRINT(" ");
- domain_print(ndo, bp + 2, length - 2, 0);
+ /* over_tcp: TRUE, is_mdns: FALSE */
+ domain_print(ndo, bp, length, TRUE, FALSE);
break;
}
return;
@@ -746,19 +746,9 @@ tcp_print(netdissect_options *ndo,
} else if (IS_SRC_OR_DST_PORT(RTSP_PORT) || IS_SRC_OR_DST_PORT(RTSP_PORT_ALT)) {
ND_PRINT(": ");
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
- */
- domain_print(ndo, bp + 2, length - 2, 0);
+ } else if (IS_SRC_OR_DST_PORT(NAMESERVER_PORT)) {
+ /* over_tcp: TRUE, is_mdns: FALSE */
+ domain_print(ndo, bp, length, TRUE, FALSE);
} else if (IS_SRC_OR_DST_PORT(MSDP_PORT)) {
msdp_print(ndo, bp, length);
} else if (IS_SRC_OR_DST_PORT(RPKI_RTR_PORT)) {