tcpdump mailing list archives

Output goes weird!


From: "Justin Robinson" <csmjmr () bath ac uk>
Date: Thu, 11 Sep 2003 00:17:39 +0100

Hi... I'm wondering if anyone can help me...

I'm using the pcap library to monitor a network connection on my local
network.
I've written a small C program to display the payloads of the network
packets to screen.

I'm Capturing packets from an NNTP connection which is a text-based
protocol.
I'm expecting to see readable characters. When I run my C program on
FreeBSD, I get textual (readable) output for the first 50 lines or so....
and then all the characters go wierd!
What gets shown on screen doesn't even look like any kind of characters at
all. It's just a mess. Even after I exit the program, the characters at the
shell prompt are still not readable and I have to close the terminal.

The exact same C program works fine in Linux for the exact same connection,
and all payloads are readable.

Can anyone suggest why my program is messing up the output, and why it
happens on FreeBSD and not Linux?

The output is written to the screen in the callback function for pcap_loop.
And here's the snippet that does it:

   /* The following loop writes each character in the payload to
      stdout */
   for (j = payloadOffset; (j < payloadOffset + payloadLength); j++) {
      putc(*payload, stdout);
      payload++;
   }

Thanks in advance for any advice you may be able to offer
Regards
Justin


-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: