tcpdump mailing list archives
Bug Fix in tcpdump 3.8.3
From: Sebastien Vincent <svincent () idems fr>
Date: Fri, 03 Sep 2004 14:48:31 +0400
Hello. I found a bug in current tcpdump (3.8.3). This bug concern the use of the flags -x/xx and -X/XX. Wheither you use x's or X's flags the output is the same. It print raw data in hex and ascii. The man says : -x's : hex print 'X's : hex + ascii print So I made changes into ./tcpdump.c and it now works fine. My system is gentoo 2004.2 under i386. Here is the diff : shinmei@seb_linux shinmei $ diff -u tcpdump.c.old tcpdump.c --- tcpdump.c.old 2004-09-03 14:37:24.944016224 +0400 +++ tcpdump.c 2004-09-03 14:36:34.957615312 +0400 @@ -585,7 +585,6 @@ break; case 'X': - ++xflag; ++Xflag; break; @@ -1020,7 +1019,7 @@ /* * Include the link-layer header. */ - default_print(sp, h->caplen); + hex_print("\n\t", sp, h->caplen); } else { /* * Don't include the link-layer header - and if @@ -1028,9 +1027,28 @@ * print nothing. */ if (h->caplen > hdrlen) - default_print(sp + hdrlen, + hex_print("\n\t", sp + hdrlen, h->caplen - hdrlen); } + } else if (Xflag) { + /* + * Print the raw packet data. + */ + if (Xflag > 1) { + /* + * Include the link-layer header. + */ + ascii_print("\n\t", sp, h->caplen); + } else { + /* + * Don't include the link-layer header - and if + * we have nothing past the link-layer header, + * print nothing. + */ + if (h->caplen > hdrlen) + ascii_print("\n\t", sp + hdrlen, + h->caplen - hdrlen); + } } putchar('\n'); shinmei@seb_linux shinmei $ Hope I can help :) Sebastien Vincent - This is the tcpdump-workers list. Visit https://lists.sandelman.ca/ to unsubscribe.
Current thread:
- Bug Fix in tcpdump 3.8.3 Sebastien Vincent (Sep 03)
- Re: Bug Fix in tcpdump 3.8.3 Guy Harris (Sep 03)
- Re: Bug Fix in tcpdump 3.8.3 Sebastien Vincent (Sep 06)
- Re: Bug Fix in tcpdump 3.8.3 Guy Harris (Sep 03)