From owner-freebsd-bugs Thu Feb 27 14:50: 6 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 33EF237B401 for ; Thu, 27 Feb 2003 14:50:05 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE27943FBF for ; Thu, 27 Feb 2003 14:50:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1RMo4NS099612 for ; Thu, 27 Feb 2003 14:50:04 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1RMo4Su099611; Thu, 27 Feb 2003 14:50:04 -0800 (PST) Date: Thu, 27 Feb 2003 14:50:04 -0800 (PST) Message-Id: <200302272250.h1RMo4Su099611@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Alex Popa Subject: Re: kern/48717: ipfw2 probability is wrong Reply-To: Alex Popa Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/48717; it has been noted by GNATS. From: Alex Popa To: Maxim Konovalov Cc: bug-followup@freebsd.org Subject: Re: kern/48717: ipfw2 probability is wrong Date: Fri, 28 Feb 2003 00:49:41 +0200 This solves the issue I am seeing. Thank you. Alex On Thu, Feb 27, 2003 at 04:53:05PM +0300, Maxim Konovalov wrote: > > Please try a patch below instead. > > Index: ipfw/ipfw2.c > =================================================================== > RCS file: /home/ncvs/src/sbin/ipfw/ipfw2.c,v > retrieving revision 1.4.2.10 > diff -u -r1.4.2.10 ipfw2.c > --- ipfw/ipfw2.c 14 Jan 2003 19:15:59 -0000 1.4.2.10 > +++ ipfw/ipfw2.c 27 Feb 2003 13:47:57 -0000 > @@ -865,7 +865,7 @@ > ipfw_insn_u32 *p = (ipfw_insn_u32 *)cmd; > double d = 1.0 * p->d[0]; > > - d = 1 - (d / 0x7fffffff); > + d = d / 0x7fffffff; > printf("prob %f ", d); > } > break; > @@ -2521,8 +2521,7 @@ > if (d != 1) { /* 1 means always match */ > action->opcode = O_PROB; > action->len = 2; > - *((int32_t *)(action+1)) = > - (int32_t)((1 - d) * 0x7fffffff); > + *((int32_t *)(action+1)) = (int32_t)(d * 0x7fffffff); > action += action->len; > } > av += 2; ac -= 2; > > %%% > > -- > Maxim Konovalov, maxim@macomnet.ru, maxim@FreeBSD.org ------------+------------------------------------------------------- Alex Popa, | "Computer science is no more about computers than razor@ldc.ro| astronomy is about telescopes" -- E. W. Dijkstra ------------+------------------------------------------------------ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message