Skip to contentSkip to conversation

libipq and destination IP address

DISCUSSION Khoa Nguyen 2 participants 3 messages Oct 16, 2007 – Oct 19, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

I am writing a small libipq program to extract packet info. I "queued" all packets in the OUTPUT chain. It looks like the packet has the same source and destination packet ( = host interface address). Why is that? Is there a way in libipq to extract the REAL destination address?

Thanks,
Khoa

#2 lore raw

Hi,

Quoted 7 lines · Khoa Nguyen

Hi,

I am writing a small libipq program to extract packet info. I "queued" all packets in the OUTPUT chain. It looks like the packet has the same source and destination packet ( = host interface address). Why is that? Is there a way in libipq to extract the REAL destination address?

First of all: switch to libnetfilter_queue

For your question, libipq sends to userspace the whole content of the packet. Thus there is no potential problem of address rewriting. You can have a look at the following code extract from NuFW:
http://docs.nufw.org/doxygen/trunk/html/packetsrv_8c-source.html#l00292

BR,

Signature · 3 lines
Éric Leblond, [email protected]
Téléphone : 01 44 89 46 40, Fax : 01 44 89 45 01
INL, http://www.inl.fr
#3 lore raw

Hi,

Thanks for your response. Actually, the problem is inet_ntoa() function -- I should have printed out the IP address right away before calling the function again

Thanks,
Khoa

Quoted 25 lines · Eric Leblond

Hi,

Quoted 7 lines · Khoa Nguyen

Hi,

I am writing a small libipq program to extract packet info. I "queued" all packets in the OUTPUT chain. It looks like the packet has the same source and destination packet ( = host interface address). Why is that? Is there a way in libipq to extract the REAL destination address?

First of all: switch to libnetfilter_queue

For your question, libipq sends to userspace the whole content of the packet. Thus there is no potential problem of address rewriting. You can have a look at the following code extract from NuFW:
http://docs.nufw.org/doxygen/trunk/html/packetsrv_8c-source.html#l00292

BR,
--
Éric Leblond, [email protected]
Téléphone : 01 44 89 46 40, Fax : 01 44 89 45 01
INL, http://www.inl.fr