aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-03-25 23:09:51 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-25 23:09:51 -0400
commit3d244121d88cd9b0baa12c25ff25561e7b4f71cd (patch)
tree5a8eba8517b481c1ae37d97764f0b01012dfe1af /net/ipv4
parentb8beedd25d3913d45b8330a08ab88fdf90eb54b8 (diff)
[NETFILTER]: nf_nat_sip: fix NAT setup order
We need to set up the destination NAT mapping before the source NAT mapping, so the NAT core gets to see the final tuple and can decide whether the source port needs to be remapped. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c
index b4c8d4968bb2..84d8b4982cdf 100644
--- a/net/ipv4/netfilter/nf_nat_sip.c
+++ b/net/ipv4/netfilter/nf_nat_sip.c
@@ -224,17 +224,17 @@ static void ip_nat_sdp_expect(struct nf_conn *ct,
224 /* This must be a fresh one. */ 224 /* This must be a fresh one. */
225 BUG_ON(ct->status & IPS_NAT_DONE_MASK); 225 BUG_ON(ct->status & IPS_NAT_DONE_MASK);
226 226
227 /* Change src to where master sends to */
228 range.flags = IP_NAT_RANGE_MAP_IPS;
229 range.min_ip = range.max_ip
230 = ct->master->tuplehash[!exp->dir].tuple.dst.u3.ip;
231 nf_nat_setup_info(ct, &range, IP_NAT_MANIP_SRC);
232
233 /* For DST manip, map port here to where it's expected. */ 227 /* For DST manip, map port here to where it's expected. */
234 range.flags = (IP_NAT_RANGE_MAP_IPS | IP_NAT_RANGE_PROTO_SPECIFIED); 228 range.flags = (IP_NAT_RANGE_MAP_IPS | IP_NAT_RANGE_PROTO_SPECIFIED);
235 range.min = range.max = exp->saved_proto; 229 range.min = range.max = exp->saved_proto;
236 range.min_ip = range.max_ip = exp->saved_ip; 230 range.min_ip = range.max_ip = exp->saved_ip;
237 nf_nat_setup_info(ct, &range, IP_NAT_MANIP_DST); 231 nf_nat_setup_info(ct, &range, IP_NAT_MANIP_DST);
232
233 /* Change src to where master sends to */
234 range.flags = IP_NAT_RANGE_MAP_IPS;
235 range.min_ip = range.max_ip
236 = ct->master->tuplehash[!exp->dir].tuple.dst.u3.ip;
237 nf_nat_setup_info(ct, &range, IP_NAT_MANIP_SRC);
238} 238}
239 239
240/* So, this packet has hit the connection tracking matching code. 240/* So, this packet has hit the connection tracking matching code.