Lines 2-10
Link Here
|
2 |
#include <linux/modversions.h> |
2 |
#include <linux/modversions.h> |
3 |
#endif |
3 |
#endif |
4 |
#include <linux/module.h> |
4 |
#include <linux/module.h> |
5 |
#include <linux/netfilter_ipv4/ip_tables.h> |
|
|
6 |
#include <linux/version.h> |
5 |
#include <linux/version.h> |
|
|
6 |
|
7 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) |
8 |
# include <linux/netfilter/x_tables.h> |
9 |
# define ipt_register_match xt_register_match |
10 |
# define ipt_unregister_match xt_unregister_match |
11 |
# define ipt_match xt_match |
12 |
#else |
13 |
# include <linux/netfilter_ipv4/ip_tables.h> |
7 |
//#include <linux/netfilter_ipv4/ipt_ipp2p.h> |
14 |
//#include <linux/netfilter_ipv4/ipt_ipp2p.h> |
|
|
15 |
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) */ |
16 |
|
8 |
#include "ipt_ipp2p.h" |
17 |
#include "ipt_ipp2p.h" |
9 |
#include <net/tcp.h> |
18 |
#include <net/tcp.h> |
10 |
#include <net/udp.h> |
19 |
#include <net/udp.h> |
Lines 831-837
Link Here
|
831 |
const struct ipt_ip *ip, |
840 |
const struct ipt_ip *ip, |
832 |
#endif |
841 |
#endif |
833 |
void *matchinfo, |
842 |
void *matchinfo, |
|
|
843 |
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18) |
834 |
unsigned int matchsize, |
844 |
unsigned int matchsize, |
|
|
845 |
#endif |
835 |
unsigned int hook_mask) |
846 |
unsigned int hook_mask) |
836 |
{ |
847 |
{ |
837 |
/* Must specify -p tcp */ |
848 |
/* Must specify -p tcp */ |
Lines 843-857
Link Here
|
843 |
} |
854 |
} |
844 |
|
855 |
|
845 |
|
856 |
|
846 |
// TODO: find out what this structure is for (scheme taken |
|
|
847 |
// from kernel sources) |
848 |
// content seems to have a length of 8 bytes |
849 |
// (at least on my x86 machine) |
850 |
struct ipp2p_match_info { |
851 |
long int dunno_what_this_is_for; |
852 |
long int i_also_dunno_what_this_is_for; |
853 |
}; |
854 |
|
855 |
static struct ipt_match ipp2p_match = { |
857 |
static struct ipt_match ipp2p_match = { |
856 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) |
858 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) |
857 |
{ NULL, NULL }, |
859 |
{ NULL, NULL }, |
Lines 860-876
Link Here
|
860 |
&checkentry, |
862 |
&checkentry, |
861 |
NULL, |
863 |
NULL, |
862 |
THIS_MODULE |
864 |
THIS_MODULE |
863 |
#endif |
865 |
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) |
864 |
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)) |
|
|
865 |
.name = "ipp2p", |
866 |
.name = "ipp2p", |
866 |
.match = &match, |
867 |
.match = &match, |
867 |
.checkentry = &checkentry, |
868 |
.checkentry = &checkentry, |
868 |
.me = THIS_MODULE, |
869 |
.me = THIS_MODULE, |
869 |
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) |
870 |
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) */ |
870 |
.name = "ipp2p", |
871 |
.name = "ipp2p", |
871 |
.match = &match, |
872 |
.match = &match, |
872 |
.family = AF_INET, |
873 |
.family = AF_INET, |
873 |
.matchsize = sizeof(struct ipp2p_match_info), |
874 |
.matchsize = XT_ALIGN(sizeof(struct ipt_p2p_info)), |
874 |
.checkentry = &checkentry, |
875 |
.checkentry = &checkentry, |
875 |
.me = THIS_MODULE, |
876 |
.me = THIS_MODULE, |
876 |
#endif |
877 |
#endif |