From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Liping Zhang <zlpnobody@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Patrick McHardy <kaber@trash.net>,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
"David S. Miller" <davem@davemloft.net>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq
Date: Mon, 4 Jul 2016 08:14:52 +0200 [thread overview]
Message-ID: <bb18da60-bd09-05e0-0244-49942abbd1bd@c-s.fr> (raw)
In-Reply-To: <CAML_gOdB=SjFyXosSb4MtaEymsAGV3beQwQqZMyhbezy=yDgxQ@mail.gmail.com>
Le 04/07/2016 à 07:48, Liping Zhang a écrit :
> 2016-07-01 17:48 GMT+08:00 Christophe Leroy <christophe.leroy@c-s.fr>:
>> Do not drop packet when CSeq is 0 as 0 is also a valid value for CSeq.
>>
>> --- a/net/netfilter/nf_conntrack_sip.c
>> +++ b/net/netfilter/nf_conntrack_sip.c
>> @@ -1368,6 +1368,7 @@ static int process_sip_response(struct sk_buff *skb, unsigned int protoff,
>> struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
>> unsigned int matchoff, matchlen, matchend;
>> unsigned int code, cseq, i;
>> + char buf[21];
>>
>> if (*datalen < strlen("SIP/2.0 200"))
>> return NF_ACCEPT;
>> @@ -1382,8 +1383,13 @@ static int process_sip_response(struct sk_buff *skb, unsigned int protoff,
>> nf_ct_helper_log(skb, ct, "cannot parse cseq");
>> return NF_DROP;
>> }
>> - cseq = simple_strtoul(*dptr + matchoff, NULL, 10);
>> - if (!cseq) {
>
> I think there is no need to convert simple_strtoul to kstrtouint, add
> a further check seems better?
> Like this:
> - if (!cseq) {
> + if (!cseq && *(*dptr + matchoff) != '0') {
>
And what about an invalid CSeq that would look like CSeq: 0abzk852 ?
Should we check it is 0 + space instead ?
>> + if (matchlen > sizeof(buf) - 1) {
>> + nf_ct_helper_log(skb, ct, "cannot parse cseq (too big)");
>> + return NF_DROP;
>> + }
>> + memcpy(buf, *dptr + matchoff, matchlen);
>> + buf[matchlen] = 0;
>> + if (kstrtouint(buf, 10, &cseq)) {
>> nf_ct_helper_log(skb, ct, "cannot get cseq");
>> return NF_DROP;
>> }
next prev parent reply other threads:[~2016-07-04 6:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-01 9:48 Christophe Leroy
2016-07-04 5:48 ` Liping Zhang
2016-07-04 6:14 ` Christophe Leroy [this message]
2016-07-04 11:43 ` Liping Zhang
-- strict thread matches above, loose matches on Subject: below --
2016-07-01 9:45 chleroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb18da60-bd09-05e0-0244-49942abbd1bd@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=kadlec@blackhole.kfki.hu \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=zlpnobody@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®