Skip to content

Commit f4a607b

Browse files
Jerome BorsboomDavid S. Miller
authored andcommitted
[NETFILTER]: nf_nat_sip: only perform RTP DNAT if SIP session was SNATed
DNAT of the the RTP session is only necessary if the SIP session has been SNATed. Signed-off-by: Jerome Borsboom <[email protected]> Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c4e36b commit f4a607b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/ipv4/netfilter/nf_nat_sip.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ static unsigned int ip_nat_sdp(struct sk_buff **pskb,
260260
DEBUGP("ip_nat_sdp():\n");
261261

262262
/* Connection will come from reply */
263-
newip = ct->tuplehash[!dir].tuple.dst.u3.ip;
263+
if (ct->tuplehash[dir].tuple.src.u3.ip ==
264+
ct->tuplehash[!dir].tuple.dst.u3.ip)
265+
newip = exp->tuple.dst.u3.ip;
266+
else
267+
newip = ct->tuplehash[!dir].tuple.dst.u3.ip;
264268

265269
exp->saved_ip = exp->tuple.dst.u3.ip;
266270
exp->tuple.dst.u3.ip = newip;

0 commit comments

Comments
 (0)