netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KOVACS Krisztian <hidden@balabit.hu>
To: netfilter-devel@lists.netfilter.org
Cc: Patrick McHardy <kaber@trash.net>,
	Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: PANIC: divide by zero in xt_connbytes
Date: Thu, 18 Jan 2007 15:22:37 +0100	[thread overview]
Message-ID: <200701181522.37984@nienna> (raw)
In-Reply-To: <45AF7861.5000201@outerspace.dyndns.org>


  Hi,

On Thursday 18 January 2007 14:38, Jonas Berlin wrote:
> | Better check that divisor must be != 0 inside div64_64.
>
> I initially suggested that too and would have renamed the function to
> div64_64_safe() or similar in the same go.. but Hidden (on irc) thought
> it was up to the caller to do the checking, and I felt he probably
> knows the kernel way of thinking better than me and succumbed. :) I
> think it's up to Patrick, I'm really only concerned with that it gets
> fixed :) If Patrick so requests, I'll redo it the other way..

  Not that it matters a lot, but I thought determining what to do if there 
have been no packets yet does not belong to the division routine 
logically. For me at least, it would introduce some kind of obscurity: at 
a first glance you won't be able to see what happens if packets==0, 
you'll have to scroll up to the div() function. Choosing zero as the 
average packet length in the corner case is appropriate only because 
that's whay usually makes sense in your ruleset. (For example if you use 
connbytes to classify traffic into bulk and interactive categories based 
on the average packet length, 0 as the "fallback" value is OK because it 
means that a brand new connection is considered interactive.)

  I guess this is a matter of personal preference: one way it's less code, 
the other way it's easier to read -- at least for me. Of course the only 
thing that matters is having this bug fixed, as it's quite ugly indeed.

-- 
 Regards,
  Krisztian Kovacs

  reply	other threads:[~2007-01-18 14:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-18 10:59 PANIC: divide by zero in xt_connbytes Jonas Berlin
2007-01-18 11:56 ` Bugzilla webserver misconfigured? (was: Re: PANIC: divide by zero in xt_connbytes) Maximilian Wilhelm
2007-01-19  2:43   ` Bugzilla webserver misconfigured? Jonas Berlin
2007-01-18 13:28 ` PANIC: divide by zero in xt_connbytes Pablo Neira Ayuso
2007-01-18 13:38   ` Jonas Berlin
2007-01-18 14:22     ` KOVACS Krisztian [this message]
2007-01-22  8:52       ` KOVACS Krisztian
2007-01-26 17:24       ` Patrick McHardy
2007-01-26 20:11         ` KOVACS Krisztian
2007-01-27 16:36           ` Patrick McHardy

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=200701181522.37984@nienna \
    --to=hidden@balabit.hu \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=pablo@netfilter.org \
    /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;
as well as URLs for NNTP newsgroup(s).