any plan for firewalling before the packet socket hooks?
I'm interested in filtering packets before the packet socket gets a copy of them, and after the packet socket writes them but before it gets to the device.
Would it be sufficient to add a new NF_HOOK call (for PF_PACKET/NF_PACKET_PRE_ROUTING or something similar) in netif_receive_skb() to handle the incoming side?
Is there anything else required to allow me to create a module to bind in at that hook and do my filtering?
In my personal case, I'm trying to filter the traffic going into my vmware session, and it seems to use a packet socket to do networking, which means that the normal iptables stuff doesn't affect it at all. I'm sure there would be other uses for this kind of thing.
Thanks,
Chris
Quoted 11 lines · Chris Friesen
I'm interested in filtering packets before the packet socket gets a copy of them, and after the packet socket writes them but before it gets to the device.
Would it be sufficient to add a new
NF_HOOKcall (for PF_PACKET/NF_PACKET_PRE_ROUTING or something similar) innetif_receive_skb()to handle the incoming side?Is there anything else required to allow me to create a module to bind in at that hook and do my filtering?
Sure, you can certainly do that. However, you can not just attach an iptable to your newly created PF_PACKET hook... PF_PACKET hooks receive all kinds of packets (not just IP)... and iptables is something ipv4 only.
Quoted 2 lines
Thanks,
Chris
Signature · 5 lines
- Harald Welte <[email protected]> http://www.netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
Quoted 7 lines · Harald Welte
Quoted 1 line · Chris Friesen
Is there anything else required to allow me to create a module to bind in at that hook and do my filtering?
Sure, you can certainly do that. However, you can not just attach an
iptable to your newly createdPF_PACKEThook...PF_PACKEThooks
receive all kinds of packets (not just IP)... and iptables is something ipv4 only.
Sure, I realize it wouldn't be just for iptables. I was expecting to write my own netfilter module to bind in to the hook.
However, I tried this and must have missed some locking or something, since the machine livelocked as soon as I loaded my module.
Anyways, I may take another look at it. I'm kind of surprised that nobody has done this before, unless there has been a convention that packet sockets are allowed to receive everything that the system sees.
Chris