From root@gabby.gsicomp.on.ca  Thu May  3 16:04:25 2001
Return-Path: <root@gabby.gsicomp.on.ca>
Received: from skippyii.compar.com (mail.compar.com [216.208.38.130])
	by hub.freebsd.org (Postfix) with ESMTP id 5537437B422
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  3 May 2001 16:04:24 -0700 (PDT)
	(envelope-from root@gabby.gsicomp.on.ca)
Received: from gabby.gsicomp.on.ca (HSE-Toronto-ppp213450.sympatico.ca [64.228.153.241])
	by skippyii.compar.com (8.11.3/8.11.3) with ESMTP id f43N9O251928
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 3 May 2001 19:09:24 -0400 (EDT)
	(envelope-from root@gabby.gsicomp.on.ca)
Received: (from root@localhost)
	by gabby.gsicomp.on.ca (8.11.1/8.9.3) id f43MveN45424;
	Thu, 3 May 2001 18:57:40 -0400 (EDT)
	(envelope-from root)
Message-Id: <200105032257.f43MveN45424@gabby.gsicomp.on.ca>
Date: Thu, 3 May 2001 18:57:40 -0400 (EDT)
From: matt@gsicomp.on.ca
Reply-To: matt@gsicomp.on.ca
To: FreeBSD-gnats-submit@freebsd.org
Subject: Add ppp delay ability in rc.network
X-Send-Pr-Version: 3.2

>Number:         27069
>Category:       bin
>Synopsis:       ppp links may not be up before natd is started, causing natd to fail
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 03 16:10:03 PDT 2001
>Closed-Date:    Fri May 4 03:02:18 PDT 2001
>Last-Modified:  Fri May 04 03:06:31 PDT 2001
>Originator:     Matt Emmerton
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
GSI Computer Services
>Environment:

gabby.gsicomp.on.ca 4.3-RC FreeBSD 4.3-RC #1: Wed Apr 11 00:54:11 EDT 2001

>Description:

	In certain situations, /sbin/natd must be used instead of ppp's built-in
	nat.  If a ppp link is being started from rc.network (via ppp_enable),
	it may not be up and have IPs assigned before natd is started.  This
	causes natd to abort, and forces an admin to start natd by hand.

	This is especially important for PPPoE links, which are usually up
	quick enough to not cause this problem, but the odd time can be slow
	and cause this problem to manifest.

>How-To-Repeat:

	Configure rc.conf with a ppp link (ppp_enable, ppp_mode, ppp_profile)
	Enable NAT with natd_interface=tun0.

	When the machine is booted, if the ppp link is slow to init, then natd
	will fail to initialize.

>Fix:

Add a parameter called ppp_delay, which is set to an appropriate delay.
This will allow ppp to fully init the interface before natd is started.

Suggested value of ppp_delay for etc/defaults/rc.conf: 5 seconds?
(Adequate for PPPoE links, would need to be upped to 30/45/60 for dialup)

--- etc/rc.network.orig	Thu May  3 18:43:36 2001
+++ etc/rc.network	Thu May  3 18:43:25 2001
@@ -161,6 +161,10 @@
 		esac
 
 		echo -n 'Starting ppp: '; ppp ${ppp_command} -quiet ${ppp_profile}
+
+		if [ "x${ppp_delay}" != "x" ]; then
+			sleep ${ppp_delay}
+		fi
 		;;
 	esac
 
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Fri May 4 03:02:18 PDT 2001 
State-Changed-Why:  
I don't believe the suggested fix is appropriate. 

I would suggest setting ppp_mode=background in ppp.conf and adding 
a ``set mode auto'' (or whatever) to your ppp config instead.  You 
may also need to muck about with ``set redial''. 

The thing that concerns me is why you say it's sometimes necessary 
to use natd instead of ppp's -nat switch (or ``nat enable yes''). 
Under what circumstances is this necessary ? 

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