Thanks for your attention to my question. When I get a packet in post-routing step, the packet has no src/dst mac addresses and after this step, src/dst mac addresses will set according to the route tables. I want to hook a packet with its correct src/dst mac addresses.
In my project, I want to get all receiving/sending packets from/to the NIC and send them to the userspace app (with NETLINK) and drop thems. So all receiving packets from NIC should be received by my kernel module and after calling my kernel module the receive packet should be droped. Also when a packet is ready for sending to NIC, my kernel module should hook and drop them. In my kernel module a copy of packet (sk_buff) is sent to an userspace app with NETLINK.
In userspace app I should do some special works on the received sk_buff from kernel module with its direction.
I think there is no way to hook a packet after port-routing step of netfilter with its src/dst mac addresses. I think I should rewrite and customize the dev_queue_xmit function.
|