From nobody@FreeBSD.org  Sat Apr 14 07:03:05 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2CE5016A400
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Apr 2007 07:03:05 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 16E7713C44B
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Apr 2007 07:03:05 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l3E734Uv059648
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Apr 2007 07:03:04 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l3E6w3Wa059109;
	Sat, 14 Apr 2007 06:58:03 GMT
	(envelope-from nobody)
Message-Id: <200704140658.l3E6w3Wa059109@www.freebsd.org>
Date: Sat, 14 Apr 2007 06:58:03 GMT
From: "Eugene M. Zheganin"<emz@norma.perm.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: link1 flag doesn't work as intended when specified in startup scripts
X-Send-Pr-Version: www-3.0

>Number:         111558
>Category:       conf
>Synopsis:       link1 flag doesn't work as intended when specified in startup scripts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 14 07:10:02 GMT 2007
>Closed-Date:    Sat Apr 14 08:27:20 GMT 2007
>Last-Modified:  Sat Apr 14 08:27:20 GMT 2007
>Originator:     Eugene M. Zheganin
>Release:        6.2-RELEASE
>Organization:
Norma JSC.
>Environment:
FreeBSD bsd.niiums.perm.ru 6.2-RELEASE FreeBSD 6.2-RELEASE #2: Thu Jan 25 16:13:06 YEKT 2007     emz@bsd.niiums.perm.ru:
/usr/obj/usr/src/sys/NIIUMS  i386
>Description:
'link1' flag doesn't work as intended when configured for gre tunnel using main system config files:

- when configured via ifconfig_gre0="" with all appropriate parameters the interface does appear with 'LINK1' flag, but requires an additional 'ifconfig gre link1' command for the tunnel to start working;

- when configured via 'start_if.gre0' script with all additional parameters, for example

===Cut===
#!/bin/sh

/sbin/ifconfig gre0 192.168.1.1 192.168.1.2 netmask 255.255.255.255 10.10.10.1 10.10.10.5 mtu 1480
# even when sleep 10
sleep 10
/sbin/ifconfig gre0 link1
===Cut==

the system still requires 'ifconfig gre0 link1' for the tunnel to start working;
>How-To-Repeat:
Create a gre tunnel with link1 set in configuration files; in rc.conf or even in start_if.gre0.
Reboot the machine.
Try to ping remote.
>Fix:
echo gre_enable="YES" >> /etc/rc.conf
echo gre_flags="greX link1" >> /etc/rc.conf

(according to your configuration)

and place the following script to /usr/local/etc/rc.d/:

#!/bin/sh
#

#
# gre startup script by drookie, 14/04/2007 12:38
# to avoid link1 bug when it is configured in earlier scripts :/
#
# PROVIDE: gre
# REQUIRE: LOGIN NETWORKING
#
#

name=gre
command=/sbin/ifconfig
gre_enable=${gre_enable:-"NO"}

. /etc/rc.subr
rcvar=`set_rcvar`
load_rc_config ${name}

run_rc_command "$1"
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Sat Apr 14 08:26:57 UTC 2007 
State-Changed-Why:  
Duplicate of conf/111557. 

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