1 diff -Nru ipp2p-0.8.2.orig/ipt_ipp2p.c ipp2p-0.8.2/ipt_ipp2p.c
2 --- ipp2p-0.8.2.orig/ipt_ipp2p.c 2007-12-04 07:50:55.000000000 +0200
3 +++ ipp2p-0.8.2/ipt_ipp2p.c 2007-12-04 07:50:43.000000000 +0200
5 #include <linux/modversions.h>
7 #include <linux/module.h>
8 -#include <linux/netfilter_ipv4/ip_tables.h>
9 #include <linux/version.h>
11 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
12 +# include <linux/netfilter/x_tables.h>
13 +# define ipt_register_match xt_register_match
14 +# define ipt_unregister_match xt_unregister_match
15 +# define ipt_match xt_match
17 +# include <linux/netfilter_ipv4/ip_tables.h>
18 //#include <linux/netfilter_ipv4/ipt_ipp2p.h>
19 +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) */
21 #include "ipt_ipp2p.h"
28 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
33 match(const struct sk_buff *skb,
34 const struct net_device *in,
35 const struct net_device *out,
40 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
46 const struct ipt_p2p_info *info = matchinfo;
47 unsigned char *haystack;
48 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
49 + struct iphdr *ip = ip_hdr(skb);
51 struct iphdr *ip = skb->nh.iph;
53 int p2p_result = 0, i = 0;
55 int hlen = ntohs(ip->tot_len)-(ip->ihl*4); /*hlen = packet-data length*/
60 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
65 checkentry(const char *tablename,
66 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
69 const struct ipt_ip *ip,
72 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
73 unsigned int matchsize,
75 unsigned int hook_mask)
77 /* Must specify -p tcp */
82 -// TODO: find out what this structure is for (scheme taken
83 -// from kernel sources)
84 -// content seems to have a length of 8 bytes
85 -// (at least on my x86 machine)
86 -struct ipp2p_match_info {
87 - long int dunno_what_this_is_for;
88 - long int i_also_dunno_what_this_is_for;
91 static struct ipt_match ipp2p_match = {
92 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
99 -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
100 +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
103 .checkentry = &checkentry,
105 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
106 +#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) */
110 - .matchsize = sizeof(struct ipp2p_match_info),
111 + .matchsize = XT_ALIGN(sizeof(struct ipt_p2p_info)),
112 .checkentry = &checkentry,