Merge "msm: netfilter: changes to handle contact address modification in SIP ALG"

This commit is contained in:
qctecmdr 2020-10-09 23:26:53 -07:00 • committed by Gerrit - the friendly Code Review server
commit 3ac04f8508

View file

@ -113,13 +113,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);
}