我正在用 netfilter 的钩子编写一些内核模块。钩子函数:
uint main_hook(uint hooknum,
struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *) )
{
struct iphdr *ip;
struct udphdr *udp;
if (skb->protocol == htons(ETH_P_IP)){
ip = (struct iphdr *)skb->data;//skb_network_header(skb);
if (ip->version == 4 && ip->protocol == IPPROTO_UDP){
udp = (struct udphdr *)(skb->data + sizeof(struct iphdr));
printk("[udp-catch] packet from %d to %d\n", ntohs(udp->source), ntohs(udp->dest));
return NF_QUEUE;
}
}
return NF_ACCEPT;
}
我可以指定队列的数量吗?如果没有,我怎么能找到这个号码?