Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion hello-packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ unsigned int my_hook(unsigned int hooknum,
return NF_ACCEPT;
}

unsigned int my_hook_kernel_v4(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state) {
struct sock *sk = skb->sk;
printk("Hello packet!");
return NF_ACCEPT;
}

static int init_filter_if(void)
{
nfho.hook = my_hook;
nfho.hook = my_hook_kernel_v4;
nfho.hooknum = 0 ; //NF_IP_PRE_ROUTING;
nfho.pf = PF_INET;
nfho.priority = NF_IP_PRI_FIRST;
Expand Down