tcpdump mailing list archives
Re: help with packet tracer
From: Gisle Vanem <gvanem () broadpark no>
Date: Thu, 19 Feb 2009 14:38:53 +0100
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.
Current thread:
- help with packet tracer Tyler Littlefield (Feb 18)
- Re: help with packet tracer Gisle Vanem (Feb 19)
- Re: help with packet tracer Tyler Littlefield (Feb 19)
- Re: help with packet tracer Gisle Vanem (Feb 19)
- Re: help with packet tracer Tyler Littlefield (Feb 19)
- Re: help with packet tracer Tyler Littlefield (Feb 19)
- Re: help with packet tracer Gisle Vanem (Feb 19)