aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2013-10-26 12:21:04 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2013-10-26 12:21:04 +0400
commit58e0619cac3ee6427827804d2c50b8efd8061bfb (patch)
treed022120a9d5abd7be16e6efe3d66aa3bdef4afe6
parentc9569fd10ac8b0a9abde3bfd908db98625d11592 (diff)
downloadpublic-58e0619cac3ee6427827804d2c50b8efd8061bfb.tar.gz
fix printing of unknown TCP options
TCP options decoder would mix decimal and hexadecimal digits when printing an unknown option. For example, the pre-TFO revision would print TFO as follows: [Unknown Option 254f989090909090000] Refine output format to print the same data as follows: [unknown-254 0xf989090909090000]
-rw-r--r--print-tcp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/print-tcp.c b/print-tcp.c
index aedc666..713778a 100644
--- a/print-tcp.c
+++ b/print-tcp.c
@@ -488,7 +488,7 @@ tcp_print(register const u_char *bp, register u_int length,
#define LENCHECK(l) { if ((l) > hlen) goto bad; TCHECK2(*cp, l); }
- printf("%s", tok2str(tcp_option_values, "Unknown Option %u", opt));
+ printf("%s", tok2str(tcp_option_values, "unknown-%u", opt));
switch (opt) {
@@ -654,6 +654,8 @@ tcp_print(register const u_char *bp, register u_int length,
default:
datalen = len - 2;
+ if (datalen)
+ printf(" 0x");
for (i = 0; i < datalen; ++i) {
LENCHECK(i);
(void)printf("%02x", cp[i]);