netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq
@ 2016-08-03 10:41 Christophe Leroy
  2016-08-08 11:10 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2016-08-03 10:41 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik, David S. Miller
  Cc: netfilter-devel, coreteam, netdev, linux-kernel

Do not drop packet when CSeq is 0 as 0 is also a valid value for CSeq.

simple_strtoul() will return 0 either when all digits are 0
or if there are no digits at all. Therefore when simple_strtoul()
returns 0 we check if first character is digit 0 or not.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 v2: not using kstrtouint() anymore, as it required to use a temp buffer

 net/netfilter/nf_conntrack_sip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 8d9db9d..7d77217 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -1383,7 +1383,7 @@ static int process_sip_response(struct sk_buff *skb, unsigned int protoff,
 		return NF_DROP;
 	}
 	cseq = simple_strtoul(*dptr + matchoff, NULL, 10);
-	if (!cseq) {
+	if (!cseq && *(*dptr + matchoff) != '0') {
 		nf_ct_helper_log(skb, ct, "cannot get cseq");
 		return NF_DROP;
 	}
@@ -1446,7 +1446,7 @@ static int process_sip_request(struct sk_buff *skb, unsigned int protoff,
 			return NF_DROP;
 		}
 		cseq = simple_strtoul(*dptr + matchoff, NULL, 10);
-		if (!cseq) {
+		if (!cseq && *(*dptr + matchoff) != '0') {
 			nf_ct_helper_log(skb, ct, "cannot get cseq");
 			return NF_DROP;
 		}
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq
  2016-08-03 10:41 [PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq Christophe Leroy
@ 2016-08-08 11:10 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-08-08 11:10 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller,
	netfilter-devel, coreteam, netdev, linux-kernel

On Wed, Aug 03, 2016 at 12:41:40PM +0200, Christophe Leroy wrote:
> Do not drop packet when CSeq is 0 as 0 is also a valid value for CSeq.
> 
> simple_strtoul() will return 0 either when all digits are 0
> or if there are no digits at all. Therefore when simple_strtoul()
> returns 0 we check if first character is digit 0 or not.

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-08 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-03 10:41 [PATCH v2] netfilter: nf_conntrack_sip: CSeq 0 is a valid CSeq Christophe Leroy
2016-08-08 11:10 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).