From iservice@atlas.tsnetworks.ca  Wed Oct  8 08:20:23 2003
Return-Path: <iservice@atlas.tsnetworks.ca>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4D71716A4BF
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  8 Oct 2003 08:20:23 -0700 (PDT)
Received: from atlas.tsnetworks.ca (atlas.tsnetworks.ca [216.185.66.221])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6ABBD43FF2
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  8 Oct 2003 08:20:12 -0700 (PDT)
	(envelope-from iservice@atlas.tsnetworks.ca)
Received: from atlas.tsnetworks.ca (localhost [127.0.0.1])
	by atlas.tsnetworks.ca (8.12.9/8.12.9) with ESMTP id h98FKA3E075584;
	Wed, 8 Oct 2003 11:20:10 -0400 (EDT)
	(envelope-from iservice@atlas.tsnetworks.ca)
Received: (from root@localhost)
	by atlas.tsnetworks.ca (8.12.9/8.12.9/Submit) id h98FKAoo075583;
	Wed, 8 Oct 2003 11:20:10 -0400 (EDT)
Message-Id: <200310081520.h98FKAoo075583@atlas.tsnetworks.ca>
Date: Wed, 8 Oct 2003 11:20:10 -0400 (EDT)
From: Ian Service <iservice@tsnetworks.ca>
Reply-To: Ian Service <iservice@tsnetworks.ca>
To: FreeBSD-gnats-submit@freebsd.org
Cc: iservice@tsnetworks.ca
Subject: [patch] rc.network doesn't allow for -a in natd_flags if interface specified
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         57748
>Category:       conf
>Synopsis:       [patch] rc.network doesn't allow for -a in natd_flags if interface specified
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 08 08:30:13 PDT 2003
>Closed-Date:    Wed Feb 22 02:36:30 GMT 2006
>Last-Modified:  Wed Feb 22 02:36:30 GMT 2006
>Originator:     Ian Service
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Tweaked Solutions Inc.
>Environment:
System: FreeBSD jolt.landscapeontario.com 4.8-STABLE FreeBSD 4.8-STABLE #0: Wed May 21 21:06:47 EDT 2003 iservice@newjolt.landscapeontario.com:/usr/obj/usr/src/sys/NEWJOLTKERNEL i386



>Description:
        By default if you natd_interface="out0" into your rc.conf it makes the
ipfw rule if natd_enable="YES" and then it makes the natd flag -n out0
this is good but if you want to make another IP the nat IP, you have to
make natd_interface="192.168.0.1" or whatever, but if that's not your
external interface, the ipfw rule is wrong and doesn't work.  I have an
aliased IP that I want my nat traffic to leave as so, I set the
natd_flags="-a 192.168.0.2" and my natd_interface="out0" and then I needed
to edit /etc/rc.network, to look for that and not reduntantly
set -n to out0 as well as -a to 192.168.0.2

>How-To-Repeat:
>Fix:
See Patch

--- rc.network.2003100800.patch begins here ---
--- /root/rc.network	Thu Apr  3 03:55:40 2003
+++ /etc/rc.network	Wed Oct  8 09:09:20 2003
@@ -338,7 +338,10 @@
 				case ${natd_enable} in
 				[Yy][Ee][Ss])
 					if [ -n "${natd_interface}" ]; then
-						if echo ${natd_interface} | \
+						if echo ${natd_flags} | \
+							grep -q -E '^\-a\ [0-9]+(\.[0-9]+){0,3}'; then
+							# there's already a -a flag in natd_flags
+						elif echo ${natd_interface} | \
 							grep -q -E '^[0-9]+(\.[0-9]+){0,3}$'; then
 							natd_flags="$natd_flags -a ${natd_interface}"
 						else
--- rc.network.2003100800.patch ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: dougb 
State-Changed-When: Wed Feb 22 02:18:32 UTC 2006 
State-Changed-Why:  

rc.network is long gone in modern FreeBSD, is this issue 
still a problem for you? 


Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Wed Feb 22 02:18:32 UTC 2006 
Responsible-Changed-Why:  

I'll handle the feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57748 
State-Changed-From-To: feedback->closed 
State-Changed-By: dougb 
State-Changed-When: Wed Feb 22 02:36:09 UTC 2006 
State-Changed-Why:  

Originator reports that this is no longer a problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57748 
>Unformatted:
