Date: Thu, 27 Feb 2003 14:50:04 -0800 (PST) From: Alex Popa <razor@ldc.ro> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/48717: ipfw2 probability is wrong Message-ID: <200302272250.h1RMo4Su099611@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/48717; it has been noted by GNATS. From: Alex Popa <razor@ldc.ro> To: Maxim Konovalov <maxim@macomnet.ru> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302272250.h1RMo4Su099611>