* Help in netfilter kernel module
@ 2003-10-16 2:55 Daryl ong
2003-10-16 7:25 ` Henrik Nordstrom
0 siblings, 1 reply; 4+ messages in thread
From: Daryl ong @ 2003-10-16 2:55 UTC (permalink / raw)
To: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 884 bytes --]
Hi
i am a new developer in this netfilter module. i am developing a kernel module on a rehat linux 8 and using iptables v1.2.6a. i came across a problem when i want to kfree_skb(skb). When i compile my source code with this command: gcc -march=i486 -03 -D__KERNEL__ -DLINUX -DMODULE -DMODVERSIONS -I/lib/modules/linux/build/linclude -c test.c test.o, it compiles with no error. But when i try to insmod test.o. it prompts me an error with test.o: unresolved symbol __kfree_skb.
i have try to use NF_DROP to drop the packet if it doesnt match what i want to filter away. But as netfilter currently didnt filter for PF_PACKET, my packet is able to go up to application layer. So i intended to use kfree_skb but encounter the error. Please tell me if there is any solutions. Thank you.
Regards,
Daryl
Yahoo! Photos
- A free party for the most "shiok" photo. Join now!
[-- Attachment #2: Type: text/html, Size: 1317 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help in netfilter kernel module
2003-10-16 2:55 Help in netfilter kernel module Daryl ong
@ 2003-10-16 7:25 ` Henrik Nordstrom
2003-10-16 9:26 ` Daryl ong
0 siblings, 1 reply; 4+ messages in thread
From: Henrik Nordstrom @ 2003-10-16 7:25 UTC (permalink / raw)
To: Daryl ong; +Cc: netfilter-devel
On Thu, 16 Oct 2003, Daryl ong wrote:
> i am a new developer in this netfilter module. i am developing a
> kernel module on a rehat linux 8 and using iptables v1.2.6a. i came
> across a problem when i want to kfree_skb(skb).
> i have try to use NF_DROP to drop the packet if it doesnt match what i
> want to filter away. But as netfilter currently didnt filter for
> PF_PACKET, my packet is able to go up to application layer. So i
> intended to use kfree_skb but encounter the error. Please tell me if
> there is any solutions. Thank you.
If you want to drop a packet from netfilter you MUST NF_DROP it. Freeing
it with kfree_skb won't help, and if done carelessly will really crash
things as the kernel expects the skb reference to be there.
I do not think you can filter PF_PACKET sockets using netfilter. These get
the packet very early in the processing chain while netfilter operates
at the IPv4/IPv6 layers.
In netfilter you can
a) Drop the packet via NF_DROP. This also terminates the session if you
are using conntrack.
b) Replace/modify the packet, making further processing see another
packet. See for example ipt_TCPMSS.c for a simple example of how to
replace a packet (this is a iptables module, but the same rules in how to
replace/modify a packet applies to a netfilter module)
c) Steal the packet, stopping further processing of this packet without
terminating the session. (NF_STOLEN verdict)
In all three cases I think the original packet is still sent to PF_PACKET
sockets for the reason outlined above.
Regards
Henrik
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help in netfilter kernel module
2003-10-16 7:25 ` Henrik Nordstrom
@ 2003-10-16 9:26 ` Daryl ong
2003-10-16 14:27 ` Henrik Nordstrom
0 siblings, 1 reply; 4+ messages in thread
From: Daryl ong @ 2003-10-16 9:26 UTC (permalink / raw)
To: Henrik Nordstrom; +Cc: netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]
Hi Henrik,
Thanks for replying my mail. I think you are right as i have test it with an application using PF_PACKETS. So is it any way i can go around this problem. Thank you in advance.
Regards,
Daryl
Henrik Nordstrom <hno@marasystems.com> wrote:
On Thu, 16 Oct 2003, Daryl ong wrote:
> i am a new developer in this netfilter module. i am developing a
> kernel module on a rehat linux 8 and using iptables v1.2.6a. i came
> across a problem when i want to kfree_skb(skb).
> i have try to use NF_DROP to drop the packet if it doesnt match what i
> want to filter away. But as netfilter currently didnt filter for
> PF_PACKET, my packet is able to go up to application layer. So i
> intended to use kfree_skb but encounter the error. Please tell me if
> there is any solutions. Thank you.
If you want to drop a packet from netfilter you MUST NF_DROP it. Freeing
it with kfree_skb won't help, and if done carelessly will really crash
things as the kernel expects the skb reference to be there.
I do not think you can filter PF_PACKET sockets using netfilter. These get
the packet very early in the processing chain while netfilter operates
at the IPv4/IPv6 layers.
In netfilter you can
a) Drop the packet via NF_DROP. This also terminates the session if you
are using conntrack.
b) Replace/modify the packet, making further processing see another
packet. See for example ipt_TCPMSS.c for a simple example of how to
replace a packet (this is a iptables module, but the same rules in how to
replace/modify a packet applies to a netfilter module)
c) Steal the packet, stopping further processing of this packet without
terminating the session. (NF_STOLEN verdict)
In all three cases I think the original packet is still sent to PF_PACKET
sockets for the reason outlined above.
Regards
Henrik
The New Yahoo! Search
- Now with image search!
[-- Attachment #2: Type: text/html, Size: 2570 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help in netfilter kernel module
2003-10-16 9:26 ` Daryl ong
@ 2003-10-16 14:27 ` Henrik Nordstrom
0 siblings, 0 replies; 4+ messages in thread
From: Henrik Nordstrom @ 2003-10-16 14:27 UTC (permalink / raw)
To: Daryl ong; +Cc: netfilter-devel
On Thu, 16 Oct 2003, Daryl ong wrote:
> Thanks for replying my mail. I think you are right as i have test it
> with an application using PF_PACKETS. So is it any way i can go around
> this problem. Thank you in advance.
Possibly, but most likely not by using netfilter.
Regards
Henrik
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-10-16 14:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-16 2:55 Help in netfilter kernel module Daryl ong
2003-10-16 7:25 ` Henrik Nordstrom
2003-10-16 9:26 ` Daryl ong
2003-10-16 14:27 ` Henrik Nordstrom
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.