I’m writing a simple kernel-space firewall and I capture a packet in pre_routing hook point.
I have a python function that is always running and listens on port 800. When receiving a packet it will write to /sys/…/packet_recieved.
I want the kernel module to accept or drop the packet according to what is written in packet_recieved.
Is it possible for me to do so?
I’m not sure what happens first, the listener receives the packet and runs the continued python code, or the kernel module first capture the packet so the listener wont have time to go over it (if the module drops the packet).
Will the answer changed if the netfilter hook point is the post_routing hook?
I tried lookin for answer on the net but sadly did not find.