updated on Thu Jan 19 16:10:29 UTC 2012
[aur-mirror.git] / ipp2p / ipp2p-0.8.2-kernel-2.6.22.patch
blob8d5b0531b1044738ba06ca8ae021cc0b8725d390
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
4 @@ -2,9 +2,18 @@
5 #include <linux/modversions.h>
6 #endif
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
16 +#else
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"
22 #include <net/tcp.h>
23 #include <net/udp.h>
24 @@ -725,7 +734,11 @@
28 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
29 +static bool
30 +#else
31 static int
32 +#endif
33 match(const struct sk_buff *skb,
34 const struct net_device *in,
35 const struct net_device *out,
36 @@ -744,11 +757,19 @@
37 u_int16_t datalen,
38 #endif
40 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
41 + bool *hotdrop)
42 +#else
43 int *hotdrop)
44 +#endif
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);
50 +#else
51 struct iphdr *ip = skb->nh.iph;
52 +#endif
53 int p2p_result = 0, i = 0;
54 // int head_len;
55 int hlen = ntohs(ip->tot_len)-(ip->ihl*4); /*hlen = packet-data length*/
56 @@ -822,7 +843,11 @@
60 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
61 +static bool
62 +#else
63 static int
64 +#endif
65 checkentry(const char *tablename,
66 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
67 const void *ip,
68 @@ -831,7 +856,9 @@
69 const struct ipt_ip *ip,
70 #endif
71 void *matchinfo,
72 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
73 unsigned int matchsize,
74 +#endif
75 unsigned int hook_mask)
77 /* Must specify -p tcp */
78 @@ -843,15 +870,6 @@
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;
89 -};
91 static struct ipt_match ipp2p_match = {
92 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
93 { NULL, NULL },
94 @@ -860,17 +878,16 @@
95 &checkentry,
96 NULL,
97 THIS_MODULE
98 -#endif
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)
101 .name = "ipp2p",
102 .match = &match,
103 .checkentry = &checkentry,
104 .me = THIS_MODULE,
105 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
106 +#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) */
107 .name = "ipp2p",
108 .match = &match,
109 .family = AF_INET,
110 - .matchsize = sizeof(struct ipp2p_match_info),
111 + .matchsize = XT_ALIGN(sizeof(struct ipt_p2p_info)),
112 .checkentry = &checkentry,
113 .me = THIS_MODULE,
114 #endif