mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
netfilter: contrack: Adding check for SIP/2.0
Packets arriving at SIP port will now be checked for SIP/2.0 before getting tagged as SIP packet. Added helper functions strnstr and strnstrn for checking substring in a string in case of non null termination. Change-Id: Ia7d6a3ac5dd1e5f0ce97ee9f6d0c13f16d9dd7f2 Acked-by: Vinisha Varre <vvarre@qti.qualcomm.com> Signed-off-by: Paras Singh Jain <parassin@codeaurora.org>
This commit is contained in:
parent
aa860b5b17
commit
4870530f13
1 changed files with 9 additions and 0 deletions
|
|
@ -1989,6 +1989,11 @@ static int sip_help_tcp(struct sk_buff *skb, unsigned int protoff,
|
|||
datalen = skb->len - dataoff;
|
||||
if (datalen < strlen("SIP/2.0 200"))
|
||||
return NF_ACCEPT;
|
||||
|
||||
/* Check if the header contains SIP version */
|
||||
if (!strnstr(dptr, "SIP/2.0", datalen))
|
||||
return NF_ACCEPT;
|
||||
|
||||
#ifdef CONFIG_NF_CONNTRACK_SIP_SEGMENTATION
|
||||
/* here we save the original datalength and data offset of the skb, this
|
||||
* is needed later to split combined skbs
|
||||
|
|
@ -2125,6 +2130,10 @@ static int sip_help_udp(struct sk_buff *skb, unsigned int protoff,
|
|||
if (datalen < strlen("SIP/2.0 200"))
|
||||
return NF_ACCEPT;
|
||||
|
||||
/* Check if the header contains SIP version */
|
||||
if (!strnstr(dptr, "SIP/2.0", datalen))
|
||||
return NF_ACCEPT;
|
||||
|
||||
return process_sip_msg(skb, ct, protoff, dataoff, &dptr, &datalen);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue