tcpdump mailing list archives

Re: help with packet tracer


From: "Tyler Littlefield" <tyler () tysdomain com>
Date: Thu, 19 Feb 2009 08:14:59 -0700

thanks, that was it, I think.
Does this need to be used for the ID and that too?

----- Original Message ----- From: "Gisle Vanem" <gvanem () broadpark no>
To: <tcpdump-workers () lists tcpdump org>
Sent: Thursday, February 19, 2009 6:38 AM
Subject: Re: [tcpdump-workers] help with packet tracer


the size of the Ip works, but when I get the tcp packet, things don't work as planned--it gives invalid ports.

I see:

 tcp = (tcp_hdr *) ((packet + sizeof (ether_hdr)) + ip_size);
cout << "Source port: " << tcp->th_sport << "\t\tDestination port: " << tcp->th_dport << "." << endl;

You forgot to use ntohs(). These are 16-bit on network order.

--gv

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: