[Click] inet_ntoa()

Kurtis Heimerl munncha at gmail.com
Tue Oct 23 03:02:51 EDT 2007


Hi, I've got a little problem I thought this list might be able to help me
with.

I've begun modifying LinearIPLookup.cc for my own uses. The first thing I've
begun doing is printing the IP and port of the incoming packets.

The IP I am able to get in long format via the ip->ip_src.s_addr. I need it
in dot. The normal way to do this is with the  inet_ntoa() function  in
either the
netinet/in.h or arpa/inet.h
libraries.

However, the inclusion of either causes the element to fail to compile.
What's the proper way to do this in click?

Another question is about the TCP header. The port I am pulling out seems to
be nonsensical, at least compared to the ones TCP dump are providing. A
brief code snippet:
const click_tcp* tcp = p->tcp_header();
printf("%d\n", tcp->th_sport);

Am I doing anything wrong?

Thanks!
****


More information about the click mailing list