From durian@fever.boogie.com  Mon Jul 23 18:39:08 2001
Return-Path: <durian@fever.boogie.com>
Received: from fever.boogie.com (cpe-66-87-52-132.co.sprintbbd.net [66.87.52.132])
	by hub.freebsd.org (Postfix) with ESMTP id 316AC37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Jul 2001 18:39:07 -0700 (PDT)
	(envelope-from durian@fever.boogie.com)
Received: (from durian@localhost)
	by fever.boogie.com (8.11.4/8.11.4) id f6O1fu402243;
	Mon, 23 Jul 2001 19:41:56 -0600 (MDT)
	(envelope-from durian)
Message-Id: <200107240141.f6O1fu402243@fever.boogie.com>
Date: Mon, 23 Jul 2001 19:41:56 -0600 (MDT)
From: Mike Durian <durian@boogie.com>
Reply-To: Mike Durian <durian@boogie.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ipfw doesn't confirm icmptypes correctly
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         29185
>Category:       bin
>Synopsis:       ipfw doesn't confirm icmptypes correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 23 18:40:01 PDT 2001
>Closed-Date:    Mon Aug 6 05:59:34 PDT 2001
>Last-Modified:  Mon Aug 06 06:00:02 PDT 2001
>Originator:     Mike Durian
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD fever.boogie.com 5.0-CURRENT FreeBSD 5.0-CURRENT #10: Mon Jul 23 17:22:26 MDT 2001 root@fever.boogie.com:/usr/obj/usr/src/sys/BOOGIE i386


>Description:
	When you add an ipfw rule that contains an icmptypes constraint,
	ipfw does not echo the icmptype value correctly.  Instead,
	it echo's the index of the unsigned integer containing the bit
	mask.  It should instead echo (index * sizeof(unsigned) * 8) +
	bit offset.

	I believe the rule itself is being instantiated correctly.

>How-To-Repeat:
	ipfw add allow icmp from any to any icmptypes 0,8
>Fix:
*** ipfw.c.orig	Mon Jul 23 18:21:54 2001
--- ipfw.c	Mon Jul 23 18:22:54 2001
***************
*** 545,551 ****
  		for (i = 0; i < IP_FW_ICMPTYPES_DIM; ++i)
  			for (j = 0; j < sizeof(unsigned) * 8; ++j)
  				if (chain->fw_uar.fw_icmptypes[i] & (1 << j)) {
! 					printf("%c%d", first ? ' ' : ',', i);
  					first = 0;
  				}
  	}
--- 545,552 ----
  		for (i = 0; i < IP_FW_ICMPTYPES_DIM; ++i)
  			for (j = 0; j < sizeof(unsigned) * 8; ++j)
  				if (chain->fw_uar.fw_icmptypes[i] & (1 << j)) {
! 					printf("%c%d", first ? ' ' : ',',
! 					    i * sizeof(unsigned) * 8 + j);
  					first = 0;
  				}
  	}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Mon Aug 6 05:59:34 PDT 2001 
State-Changed-Why:  
Applied, thanks! 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Mon Aug 6 05:59:34 PDT 2001 
Responsible-Changed-Why:  

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=29185 
>Unformatted:
