From nectar@bone.nectar.com  Sun Jun 14 09:04:16 1998
Received: from bone.nectar.com (bone.nectar.com [204.27.67.93])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA19206
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Jun 1998 09:04:15 -0700 (PDT)
          (envelope-from nectar@bone.nectar.com)
Received: (from nectar@localhost)
	by bone.nectar.com (8.9.0/8.9.0) id LAA26889;
	Sun, 14 Jun 1998 11:03:44 -0500 (CDT)
Message-Id: <199806141603.LAA26889@bone.nectar.com>
Date: Sun, 14 Jun 1998 11:03:44 -0500 (CDT)
From: Jacques Vidrine <nectar@NECTAR.COM>
Reply-To: nectar@NECTAR.COM
To: FreeBSD-gnats-submit@freebsd.org
Subject: allow ip address for natd_interface in rc.conf/rc.network
X-Send-Pr-Version: 3.2

>Number:         6947
>Category:       conf
>Synopsis:       allow ip address for natd_interface in rc.conf/rc.network
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 14 09:10:01 PDT 1998
>Closed-Date:    Wed Jul 8 08:52:15 PDT 1998
>Last-Modified:  Wed Jul  8 08:53:25 PDT 1998
>Originator:     Jacques Vidrine
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
>Environment:

	3.0-CURRENT

>Description:

	natd must be started with either ``-n [interface name]'' or
	``-a [ip address]''.  Both flags are used to tell natd which
	interface and IP address to use for aliasing.

	Currently, rc.network is hard-coded to use ``-n
	${natd_interface}''.  I propose changing the behavior
	such that if ${natd_interface} looks like an IP address,
	use ``-a ${natd_interface}'', otherwise use ``-n
	${natd_interface}''.

	This will allow users who need the behavior of -a to
	use our config files to start natd.

>How-To-Repeat:

	Attempt to find a way to start natd with the -a flag using
	our existing configuration scripts.

>Fix:

Note that this patch will only apply if the bug reported in conf/6946
has been applied first.  If it has not, it is not hard to apply the
patch by hand instead.

--- rc.network.orig     Sun Jun 14 10:48:21 1998
+++ rc.network  Sun Jun 14 10:55:11 1998
@@ -269,10 +269,16 @@
     fi

     # Network Address Translation daemon
-    if [ "X${natd_enable}" = X"YES" -a "X${natd_interface}" != X"" \
-       -a "X${firewall_enable}" = X"YES" ]; then
-           echo -n ' natd'; natd ${natd_flags} -n ${natd_interface}
-    fi
+       if [ "X${natd_enable}" = X"YES" -a X"${natd_interface}" != X"" \
+               -a X"${firewall_enable}" = X"YES" ]; then
+               if echo ${natd_interface} | \
+                       grep -q -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
+                       natd_ifarg="-a ${natd_interface}"
+               else
+                       natd_ifarg="-n ${natd_interface}"
+               fi
+               echo -n ' natd'; natd ${natd_flags} ${natd_ifarg}
+       fi

     echo '.'
     network_pass3_done=YES 

>Release-Note:
>Audit-Trail:

From: Jacques Vidrine <n@nectar.com>
To: freebsd-gnats-submit@freebsd.org, nectar@nectar.com
Cc:  Subject: Re: conf/6947: allow ip address for natd_interface in rc.conf/rc.network
Date: Sun, 21 Jun 1998 13:08:05 -0500

 conf/6946 was committed, so this PR can be committed anytime
 -- 
 Jacques Vidrine <n@nectar.com>
State-Changed-From-To: open->closed 
State-Changed-By: nectar 
State-Changed-When: Wed Jul 8 08:52:15 PDT 1998 
State-Changed-Why:  
patch committed in revision 1.28 
>Unformatted:
