Problem getting layer 4 port numbers with libnetfilter_conntrack
I am using libnetfilter_conntrack and trying to get the layer 4 source
and destination port numbers for a connection.
source_ptr = (uint16_t *)nfct_get_attr(conntrack_p, ATTR_ORIG_PORT_SRC);
dest_ptr = (uint16_t *)nfct_get_attr(conntrack_p, ATTR_ORIG_PORT_DST);
In both cases, the address returned by nfct_get_attr is NULL because
"no data available" (errno=61).
There is a valid connection. I am able to get the source and
destination IP addresses.
Why can't I get the layer 4 source and destination ports? Is there
another way to do it? Am I using the wrong attribute in the call to
nfct_get_attr?
|