Get the App
SLTechnology News&Howtos  ›  Network Security  › 

NetFilter

Shulou Source: shulou.com Published: 2022-06-01 06:53:13 10月03日 Update

Typedef unsigned int nf_hookfn (unsigned int hooknum

Struct sk_buff * skb

Const struct net_device * in

Const struct net_device * out

Int (* okfn) (struct sk_buff *))

/ * handle the return value of the function * /

# define NF_DROP 0 / * drop the packet, don't continue traversal * /

# define NF_ACCEPT 1 / * continue traversal as normal * /

# define NF_STOLEN 2 / * I've taken over the packet, don't continue traversal * /

# define NF_QUEUE 3 / * queue the packet (usually for userspace handling) * /

# define NF_REPEAT 4 / * call this hook again * /

# define NF_STOP 5

# define NF_MAX_VERDICT NF_STOP

When using Netfilter, you need to define an instance of nf_hook_ops.

Struct nf_hook_ops {

Struct list_head list

/ * User fills in from here down. , /

Nf_hookfn * hook; / * Hook function to be registered * /

Struct module * owner

U_int8_t pf; / * Protocol Type * /

Unsigned int hooknum; / * which Diaoyutai * /

/ * Hooks are ordered in asending priority. , /

The lower the int priority; / * value, the higher the priority * /

}

Typedef _ _ u8 u_int8_t

Tags: Function priority instance value type hook Diaoyutai processing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information MySQL Linux Redmi