From nobody@FreeBSD.org  Wed Jul 21 21:36:45 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 043391065678
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 21 Jul 2010 21:36:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id E7BEC8FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 21 Jul 2010 21:36:44 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o6LLaiSe062470
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 21 Jul 2010 21:36:44 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o6LLaiD1062469;
	Wed, 21 Jul 2010 21:36:44 GMT
	(envelope-from nobody)
Message-Id: <201007212136.o6LLaiD1062469@www.freebsd.org>
Date: Wed, 21 Jul 2010 21:36:44 GMT
From: Spil <spil.oss@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [ipfw] divert broken with in-kernel ipfw
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         148827
>Category:       kern
>Synopsis:       [ipfw] divert broken with in-kernel ipfw
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-ipfw
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 21 21:40:04 UTC 2010
>Closed-Date:    
>Last-Modified:  Thu Jul 22 18:40:01 UTC 2010
>Originator:     Spil
>Release:        8.1 Release
>Organization:
>Environment:
FreeBSD gw.example.org 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Wed Jul 21 06:55:14 CEST 2010
>Description:
Migrating from 8.0 to 8.1 using a recipe similar to http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/firewalls-ipfw.html "30.6.5.7 An Example NAT and Stateful Ruleset" breaks NAT

The culprit are the ipfw rules
   $cmd 100 divert natd ip from any to any in via $pif
   $cmd 500 divert natd ip from any to any out via $pif

This no longer results in the NATting as on 8.0
As of 8.1 it must be
   $cmd 100 divert natd ip4 from any to any in via $pif
   $cmd 500 divert natd ip4 from any to any out via $pif

man-page specifically states for proto
   ip | all    Matches any packet.
but obviously for 8.1 it doesn't (in a divert rule?)
>How-To-Repeat:
In-kernel ipfw
Usage of natd
proto 'ip' in the rule body
>Fix:
change proto from ip to ip4 in divert natd ipfw rules

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-ipfw 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Jul 21 22:11:51 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148827 

From: Spil Oss <spil.oss@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/148827: [ipfw] divert broken with in-kernel ipfw
Date: Thu, 22 Jul 2010 20:30:31 +0200

 It is only the outbound divert rule that needs to be changed from ip to ip4.
 
 # ipfw add 99 divert natd ip from any to any in via $pif
 # ipfw delete 100
 
 NATting still works
 
 # ipfw delete 500
 # ipfw add 500 divert natd ip  from any to any out via $pif
 
 NATting broken
 
 # ipfw delete 500
 # ipfw add 500 divert natd ip4 from any to any out via $pif
 
 NATting works again
>Unformatted:
