Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3587182 authored by Ravinder Konka's avatar Ravinder Konka
Browse files

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: default avatarRavinder Konka <rkonka@codeaurora.org>
parent 07179574
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -111,13 +111,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);
}