Skip to contentSkip to conversation

How to re-send out the packets captured by my hook function at NF_IP_PRE_ROUTING

DISCUSSION David G. 2 participants 2 messages Apr 26, 2006 – Apr 27, 2006 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]

David G.

author
#1 lore raw
Quoted 7 lines · Real Oneone

Hi, I plugged a callback function into netfilter at the hook point of NF_IP_PRE_ROUTING, tring to capture all the packets, make some changes to some of them, and invoke skb->dev->hard_start_xmit to send them out directly. However, the kernel crashed before I could get any printked information.

If you have any idea of how to send the received packets out, please tell me.

You might want to explore the possibilities of the existing "ip_queue" kernel extension instead, it was design to do packet capture/inspection/changing in userspace.

FireFlier works that way ( http://fireflier.sourceforge.net/ ) and so does inlined snort (http://www.snort.org/docs/snort_manual/node7.html).

You can take a look at:
http://www.linuxia.de/netfilter.en.html#userspace and
http://www.cs.princeton.edu/~nakao/libipq.htm for an example application.

#2 lore raw

Many thanks, David!

I've read what you mentioned and since I've done most of the work in kernelspace, I wonder if there is any way to send out the modified packet directly, when of course the mac address is not filled?

Thanks again!

2006/4/26, David G. <[email protected]>:

Quoted 20 lines
Quoted 7 lines · Real Oneone

Hi, I plugged a callback function into netfilter at the hook point of NF_IP_PRE_ROUTING, tring to capture all the packets, make some changes to some of them, and invoke skb->dev->hard_start_xmit to send them out directly. However, the kernel crashed before I could get any printked information.

If you have any idea of how to send the received packets out, please tell me.

You might want to explore the possibilities of the existing "ip_queue" kernel extension instead, it was design to do packet capture/inspection/changing in userspace.

FireFlier works that way ( http://fireflier.sourceforge.net/ ) and so does inlined snort (http://www.snort.org/docs/snort_manual/node7.html).

You can take a look at:
http://www.linuxia.de/netfilter.en.html#userspace and
http://www.cs.princeton.edu/~nakao/libipq.htm for an example application.