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;
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
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)
19 struct ip_ct_rtsp_expect expinfo;
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");
30 @@ -420,7 +420,7 @@ static int help(struct sk_buff *skb, uns
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);
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
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
53 #include <linux/module.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>
62 #include <linux/inet.h>
63 #include <linux/ctype.h>
64 @@ -102,8 +102,8 @@ get_skb_tcpdata(struct sk_buff* skb, cha
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)
75 @@ -256,7 +256,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
76 if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun))
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,
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.
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))
92 /* mangle failed, all we can do is bail */
93 @@ -351,7 +351,7 @@ rtsp_mangle_tran(enum ip_conntrack_info
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)
102 @@ -389,7 +389,7 @@ help_out(struct sk_buff *skb, enum ip_co
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))
109 pr_debug("hdr: Transport mangle failed");
111 @@ -407,7 +407,7 @@ help_out(struct sk_buff *skb, enum ip_co
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)
120 @@ -417,7 +417,7 @@ help(struct sk_buff *skb, enum ip_conntr
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);
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
131 static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp)
133 - struct nf_nat_ipv4_multi_range_compat mr;
134 + struct nf_nat_range nr;
135 u_int32_t newdstip, newsrcip, newip;
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);
143 + memset(&nr, 0, sizeof(nr));
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;
151 - nf_nat_setup_info(ct, &mr.range[0], NF_NAT_MANIP_DST);
152 + nf_nat_setup_info(ct, &nr, NF_NAT_MANIP_DST);