msm: netfilter: changes to handle contact address modification in SIP ALG
SIP ALG mangles contact address only when both address and port are mentioned. Some clients send only address information in which case the contact address does not get mangled an hence SIP call does not get established. Change-Id: Ie760f6fcc6dd8e269b057488414b23beff4e8fc3 Signed-off-by: Ravinder Konka <rkonka@codeaurora.org>
This commit is contained in:
parent
7d835ddeea
commit
1b12c2cf40
|
@ -110,13 +110,26 @@ static int map_addr(struct sk_buff *skb, unsigned int protoff,
|
|||
newaddr = ct->tuplehash[!dir].tuple.src.u3;
|
||||
newport = ct_sip_info->forced_dport ? :
|
||||
ct->tuplehash[!dir].tuple.src.u.udp.port;
|
||||
} else if (nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3, addr) &&
|
||||
ct->tuplehash[dir].tuple.src.u.udp.port != port) {
|
||||
newaddr = ct->tuplehash[!dir].tuple.dst.u3;
|
||||
newport = 0;
|
||||
} else if (nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.dst.u3, addr)
|
||||
&& ct->tuplehash[dir].tuple.dst.u.udp.port != port) {
|
||||
newaddr = ct->tuplehash[!dir].tuple.src.u3;
|
||||
newport = 0;
|
||||
} else
|
||||
return 1;
|
||||
|
||||
if (nf_inet_addr_cmp(&newaddr, addr) && newport == port)
|
||||
return 1;
|
||||
|
||||
buflen = sip_sprintf_addr_port(ct, buffer, &newaddr, ntohs(newport));
|
||||
if (newport == 0)
|
||||
buflen = sip_sprintf_addr(ct, buffer, &newaddr, false);
|
||||
else
|
||||
buflen = sip_sprintf_addr_port(ct, buffer, &newaddr,
|
||||
ntohs(newport));
|
||||
|
||||
return mangle_packet(skb, protoff, dataoff, dptr, datalen,
|
||||
matchoff, matchlen, buffer, buflen);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue