- 论坛徽章:
- 0
|
unsigned int checksum(unsigned int hooknum,
struct sk_buff *__skb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
struct sk_buff *skb;
struct iphdr *iph;
struct ts_state state;
struct ts_config *ts_conf;
int rst = 0;
skb = __skb;
if(skb == NULL) return NF_ACCEPT;
iph = ip_hdr(skb);
if(iph == NULL) return NF_ACCEPT;
memset(&state, 0, sizeof(struct ts_state));
ts_conf = textsearch_prepare("kmp", "taobao", 6, GFP_KERNEL, TS_AUTOLOAD);
if(IS_ERR(ts_conf))
{
printk("limeng,conf err\n");
return NF_ACCEPT;
}
rst = skb_find_text((struct sk_buff *)skb, 0, strlen(__skb), ts_conf, &state);
if(UINT_MAX != rst)
{
printk("limeng,skb_find\n");
textsearch_destroy(ts_conf);
return NF_DROP;
}
rst = textsearch_find_continuous(ts_conf, &state, __skb, strlen(__skb));
if(UINT_MAX != rst)
{
printk("limeng,textsearch\n");
textsearch_destroy(ts_conf);
return NF_DROP;
}
textsearch_destroy(ts_conf);
return NF_ACCEPT;
} |
|