xtables-addons: update to v2.1, fix compilation against Linux 3.7.2, refresh patches
[openwrt/svn-archive/archive.git] / net / xtables-addons / patches / 102-rtsp-linux-3.7-compat.patch
1 --- a/extensions/rtsp/nf_conntrack_rtsp.c
2 +++ b/extensions/rtsp/nf_conntrack_rtsp.c
3 @@ -73,7 +73,7 @@ static DEFINE_SPINLOCK(rtsp_buffer_lock)
4 static struct nf_conntrack_expect_policy rtsp_exp_policy;
5
6 unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
7 - enum ip_conntrack_info ctinfo,
8 + enum ip_conntrack_info ctinfo, unsigned int protoff,
9 unsigned int matchoff, unsigned int matchlen,struct ip_ct_rtsp_expect* prtspexp,
10 struct nf_conntrack_expect *exp);
11 void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
12 @@ -269,7 +269,7 @@ void expected(struct nf_conn *ct, struct
13
14 static inline int
15 help_out(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen,
16 - struct nf_conn *ct, enum ip_conntrack_info ctinfo)
17 + struct nf_conn *ct, enum ip_conntrack_info ctinfo, unsigned int protoff)
18 {
19 struct ip_ct_rtsp_expect expinfo;
20
21 @@ -353,7 +353,7 @@ help_out(struct sk_buff *skb, unsigned c
22 nf_nat_rtsp = rcu_dereference(nf_nat_rtsp_hook);
23 if (nf_nat_rtsp && ct->status & IPS_NAT_MASK)
24 /* pass the request off to the nat helper */
25 - ret = nf_nat_rtsp(skb, ctinfo, hdrsoff, hdrslen, &expinfo, exp);
26 + ret = nf_nat_rtsp(skb, ctinfo, protoff, hdrsoff, hdrslen, &expinfo, exp);
27 else if (nf_ct_expect_related(exp) != 0) {
28 pr_info("nf_conntrack_expect_related failed\n");
29 ret = NF_DROP;
30 @@ -420,7 +420,7 @@ static int help(struct sk_buff *skb, uns
31
32 switch (CTINFO2DIR(ctinfo)) {
33 case IP_CT_DIR_ORIGINAL:
34 - ret = help_out(skb, rb_ptr, datalen, ct, ctinfo);
35 + ret = help_out(skb, rb_ptr, datalen, ct, ctinfo, protoff);
36 break;
37 case IP_CT_DIR_REPLY:
38 pr_debug("IP_CT_DIR_REPLY\n");
39 --- a/extensions/rtsp/nf_conntrack_rtsp.h
40 +++ b/extensions/rtsp/nf_conntrack_rtsp.h
41 @@ -50,6 +50,7 @@ struct ip_ct_rtsp_expect
42
43 extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
44 enum ip_conntrack_info ctinfo,
45 + unsigned int protoff,
46 unsigned int matchoff, unsigned int matchlen,
47 struct ip_ct_rtsp_expect *prtspexp,
48 struct nf_conntrack_expect *exp);
49 --- a/extensions/rtsp/nf_nat_rtsp.c
50 +++ b/extensions/rtsp/nf_nat_rtsp.c
51 @@ -32,10 +32,10 @@
52
53 #include <linux/module.h>
54 #include <net/tcp.h>
55 +#include <net/netfilter/nf_conntrack_expect.h>
56 #include <net/netfilter/nf_nat_helper.h>
57 -#include <net/netfilter/nf_nat_rule.h>
58 +#include <net/netfilter/nf_nat.h>
59 #include "nf_conntrack_rtsp.h"
60 -#include <net/netfilter/nf_conntrack_expect.h>
61
62 #include <linux/inet.h>
63 #include <linux/ctype.h>
64 @@ -102,8 +102,8 @@ get_skb_tcpdata(struct sk_buff* skb, cha
65 static int
66 rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
67 struct nf_conntrack_expect* exp,
68 - struct ip_ct_rtsp_expect* prtspexp,
69 - struct sk_buff* skb, uint tranoff, uint tranlen)
70 + struct ip_ct_rtsp_expect* prtspexp,
71 + struct sk_buff* skb, uint protoff, uint tranoff, uint tranlen)
72 {
73 char* ptcp;
74 uint tcplen;
75 @@ -256,7 +256,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
76 if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun))
77 {
78 diff = nextfieldoff-off;
79 - if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
80 + if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
81 off, diff, NULL, 0))
82 {
83 /* mangle failed, all we can do is bail */
84 @@ -326,7 +326,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
85 * parameter 4 below is offset from start of tcp data.
86 */
87 diff = origlen-rbuflen;
88 - if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
89 + if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
90 origoff, origlen, rbuf, rbuflen))
91 {
92 /* mangle failed, all we can do is bail */
93 @@ -351,7 +351,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
94 }
95
96 static uint
97 -help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo,
98 +help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo, unsigned int protoff,
99 unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp,
100 struct nf_conntrack_expect* exp)
101 {
102 @@ -389,7 +389,7 @@ help_out(struct sk_buff *skb, enum ip_co
103 {
104 uint oldtcplen = tcplen;
105 pr_debug("hdr: Transport\n");
106 - if (!rtsp_mangle_tran(ctinfo, exp, prtspexp, skb, lineoff, linelen))
107 + if (!rtsp_mangle_tran(ctinfo, exp, prtspexp, skb, protoff, lineoff, linelen))
108 {
109 pr_debug("hdr: Transport mangle failed");
110 break;
111 @@ -407,7 +407,7 @@ help_out(struct sk_buff *skb, enum ip_co
112 }
113
114 static unsigned int
115 -help(struct sk_buff *skb, enum ip_conntrack_info ctinfo,
116 +help(struct sk_buff *skb, enum ip_conntrack_info ctinfo, unsigned int protoff,
117 unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp,
118 struct nf_conntrack_expect* exp)
119 {
120 @@ -417,7 +417,7 @@ help(struct sk_buff *skb, enum ip_conntr
121 switch (dir)
122 {
123 case IP_CT_DIR_ORIGINAL:
124 - rc = help_out(skb, ctinfo, matchoff, matchlen, prtspexp, exp);
125 + rc = help_out(skb, ctinfo, protoff, matchoff, matchlen, prtspexp, exp);
126 break;
127 case IP_CT_DIR_REPLY:
128 pr_debug("unmangle ! %u\n", ctinfo);
129 @@ -432,7 +432,7 @@ help(struct sk_buff *skb, enum ip_conntr
130
131 static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp)
132 {
133 - struct nf_nat_ipv4_multi_range_compat mr;
134 + struct nf_nat_range nr;
135 u_int32_t newdstip, newsrcip, newip;
136
137 struct nf_conn *master = ct->master;
138 @@ -446,12 +446,13 @@ static void expected(struct nf_conn* ct,
139 pr_debug("newsrcip=%pI4, newdstip=%pI4, newip=%pI4\n",
140 &newsrcip, &newdstip, &newip);
141
142 - mr.rangesize = 1;
143 + memset(&nr, 0, sizeof(nr));
144 +
145 // We don't want to manip the per-protocol, just the IPs.
146 - mr.range[0].flags = NF_NAT_RANGE_MAP_IPS;
147 - mr.range[0].min_ip = mr.range[0].max_ip = newip;
148 + nr.flags = NF_NAT_RANGE_MAP_IPS;
149 + nr.min_addr.ip = nr.max_addr.ip = newip;
150
151 - nf_nat_setup_info(ct, &mr.range[0], NF_NAT_MANIP_DST);
152 + nf_nat_setup_info(ct, &nr, NF_NAT_MANIP_DST);
153 }
154
155