3 Experimental Netfilter Crap
4 Copyright (C) 2006 Jonathan Zarate
7 #include <linux/module.h>
8 #include <linux/skbuff.h>
9 #include <linux/version.h>
10 #include <linux/file.h>
13 #include <linux/netfilter_ipv4/ip_tables.h>
14 #include <linux/netfilter_ipv4/ipt_exp.h>
15 #include "../../bridge/br_private.h"
18 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
23 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
24 match(const struct sk_buff
*skb
, const struct net_device
*in
, const struct net_device
*out
,
25 const struct xt_match
*match
, const void *matchinfo
, int offset
,
26 unsigned int protoff
, int *hotdrop
)
27 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) */
28 match(const struct sk_buff
*skb
, const struct xt_match_param
*par
)
31 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
32 // const struct ipt_exp_info *info = matchinfo;
34 // const struct ipt_exp_info *info = par->matchinfo;
37 if ((skb_mac_header(skb
) >= skb
->head
) && ((skb_mac_header(skb
) + ETH_HLEN
) <= skb
->data
)) {
38 printk(KERN_INFO
"exp src=%02X:%02X:%02X:%02X:%02X:%02X dst=%02X:%02X:%02X:%02X:%02X:%02X\n",
39 eth_hdr(skb
)->h_source
[0], eth_hdr(skb
)->h_source
[1], eth_hdr(skb
)->h_source
[2],
40 eth_hdr(skb
)->h_source
[3], eth_hdr(skb
)->h_source
[4], eth_hdr(skb
)->h_source
[5],
41 eth_hdr(skb
)->h_dest
[0], eth_hdr(skb
)->h_dest
[1], eth_hdr(skb
)->h_dest
[2],
42 eth_hdr(skb
)->h_dest
[3], eth_hdr(skb
)->h_dest
[4], eth_hdr(skb
)->h_dest
[5]);
45 printk(KERN_INFO
"exp mac=%p head=%p in=%p\n", skb_mac_header(skb
), skb
->head
, in
);
49 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
54 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
55 checkentry(const char *tablename
, const void *inf
, const struct xt_match
*match
,
56 void *matchinfo
, unsigned int hook_mask
)
58 checkentry(const struct xt_mtchk_param
*par
)
64 static struct xt_match exp_match
= {
68 .matchsize
= sizeof(struct ipt_exp_info
),
69 .checkentry
= &checkentry
,
74 static int __init
init(void)
76 printk(KERN_INFO
"exp init " __DATE__
" " __TIME__
"\n");
77 return xt_register_match(&exp_match
);
80 static void __exit
fini(void)
82 printk(KERN_INFO
"exp fini\n");
83 xt_unregister_match(&exp_match
);
88 MODULE_LICENSE("GPL");