Is possible to use netfilter to hook all ethernet packets?
I can just get packet from ipv4 or ipv6.
EDit:
The above code is my kernel module. I want to get all packets that arrives to one ethernet interface re-direct to another interface.This module just print the name of the device where the packet arrived (just for testing). WIth this hook i just get packets witch type is ipv4, but i want to get all types.
I searched on web but i didn't find how to configure my hook to get all the packet's that bypass the ethernet interface.
Best Regards
static struct nf_hook_ops nfho;
int hook_func(struct sk_buff * skb)
{ struct ethhdr *eth;
printk("Device: %s\n,skb->dev->name);
}
int init_module() {
printk("Hook Module online!\n");nfho.hook =(nf_hookfn *)hook_func;
nfho.hooknum = NF_IP_PRE_ROUTING;
nfho.pf = PF_INET; nfho.priority =NF_IP_PRI_FIRST;nf_register_hook(&nfho);
return 0; }
/* Cleanup routine */ void cleanup_module() {
printk("Over and Out!\n"); nf_unregister_hook(&nfho); }