From tony@lava.net  Tue Nov 15 10:36:38 2005
Return-Path: <tony@lava.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4919E16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Nov 2005 10:36:38 +0000 (GMT)
	(envelope-from tony@lava.net)
Received: from gau.lava.net (gau.lava.net [64.65.64.28])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1374343D45
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Nov 2005 10:36:37 +0000 (GMT)
	(envelope-from tony@lava.net)
Received: from _HOSTNAME_ (cust11798.lava.net [64.65.78.22])
	by gau.lava.net (Postfix) with SMTP id 229B7355C7
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Nov 2005 00:36:37 -1000 (HST)
Received: by _HOSTNAME_ (sSMTP sendmail emulation); Tue, 15 Nov 2005 00:36:33 -1000
Message-Id: <20051115103637.229B7355C7@gau.lava.net>
Date: Tue, 15 Nov 2005 00:36:33 -1000
From: "Antonio Querubin" <tony@lava.net>
Reply-To: Antonio Querubin <tony@lava.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: IPv6 6to4 auto-configuration enhancement
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         89061
>Category:       conf
>Synopsis:       [patch] IPv6 6to4 auto-configuration enhancement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 15 10:40:15 GMT 2005
>Closed-Date:    Fri Oct 07 02:26:12 UTC 2011
>Last-Modified:  Fri Oct 07 02:26:12 UTC 2011
>Originator:     Antonio Querubin <tony@lava.net>
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
none
>Environment:
System: FreeBSD pavilion 5.4-STABLE FreeBSD 5.4-STABLE #1: Tue Aug 16 00:43:55 HST 2005 root@pavilion:/usr/obj/usr/src/sys/GENERIC i386


>Description:

	When IPv6 is enabled in /etc/rc.conf but there is no native IPv6 
	routing, 6to4 can be enabled with some reasonable defaults to 
	provide IPv6 connectivity via the nearest 6to4 anycast router (RFC 
	3068).  This patch enhances the IPv6 startup script to 
	automatically setup the stf interface address and the IPv6 default 
	gateway properly if 'auto6to4_enable=YES' is added to /etc/rc.conf 
	to enable this feature.  This provides a simple, working IPv6 
	configuration for a large majority of workstations still on 
	IPv4-only networks.  This is similar to the default 6to4 
	behaviour in Linux and MS Windows XP.

>How-To-Repeat:

	With IPv6 enabled ('ipv6_enable=YES' added to /etc/rc.conf) in a 
	non-IPv6 network, attempt to ping a IPv6 host.

	example:  ping6 www.isc.org

	The ping6 attempt should fail as there is no IPv6 route to the 
	host.

	Install the patch below and add 'auto6to4_enable=YES' to 
	/etc/rc.conf and reboot.  ping6 and traceroute6 should now work 
	to a number of IPv6 hosts.

>Fix:

--- /usr/src/etc/rc.d/network_ipv6	Sun Oct 17 11:00:07 2004
+++ /etc/rc.d/network_ipv6	Sat Nov 12 09:16:54 2005
@@ -100,6 +100,25 @@
 	fi
 
 	# Setup IPv6 to IPv4 mapping
+	if checkyesno auto6to4_enable; then
+		# Determine the interface of the IPv4 default route.
+		ipv4_default_if=`route get default \
+			| awk '/interface:/ {print $NF}'`
+		# Define the 6to4 tunnel's IPv4 address to match the first 
+		# IPv4 address of the IPv4 default interface.
+		stf_interface_ipv4addr=`ifconfig ${ipv4_default_if} inet \
+			| awk '/inet/ {print $2}' \
+			| head -1`
+		# If no IPv6 default gateway is defined, use the RFC 3068 
+		# anycast address.
+		case ${ipv6_defaultrouter} in
+		[Nn][Oo] | '')
+			ipv6_defaultrouter="2002:c058:6301::"
+			;;
+		*)
+			;;
+		esac
+	fi
 	network6_stf_setup
 
 	# Install the "default interface" to kernel, which will be used


>Release-Note:
>Audit-Trail:

From: Florent Thoumie <flz@FreeBSD.org>
To: bug-followup@freebsd.org
Cc: Antonio Querubin <tony@lava.net>
Subject: Re: conf/89061
Date: Tue, 18 Apr 2006 11:49:36 +0100

 --=-lONufvTlCX9diJb+kVbP
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 You can't rely on awk being available at this stage of the boot process,
 awk being in /usr/bin and /usr might only be available after
 mountcritremote.
 
 I haven't looked at the patch carefully though, will do.
 
 --=20
 Florent Thoumie
 flz@FreeBSD.org
 FreeBSD Committer
 
 --=-lONufvTlCX9diJb+kVbP
 Content-Type: application/pgp-signature; name=signature.asc
 Content-Description: This is a digitally signed message part
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.3 (FreeBSD)
 
 iD8DBQBERMRAMxEkbVFH3PQRAnh2AJ4qwfRb7EWt4sT0xlay4xCuUSR13QCeMxA5
 YNLQDa+Aa1Ae6AooQpZ7o40=
 =Skxi
 -----END PGP SIGNATURE-----
 
 --=-lONufvTlCX9diJb+kVbP--
 
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Jun 29 00:26:04 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer(s). 

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

From: Antonio Querubin <tony@lava.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/89061: IPv6 6to4 auto-configuration enhancement
Date: Fri, 29 Dec 2006 20:15:57 -1000 (HST)

 Here's an updated patch that doesn't require /usr.
 
 --- /usr/src/etc/rc.d/network_ipv6	Thu Oct  7 03:55:26 2004
 +++ /etc/rc.d/network_ipv6	Fri Dec 29 18:49:32 2006
 @@ -100,6 +100,38 @@
   	fi
 
   	# Setup IPv6 to IPv4 mapping
 +	if checkyesno auto6to4_enable; then
 +		# Determine the interface of the IPv4 default route.
 +		ipv4_default_if=`route get default \
 +			| while read name val ; do
 +				case ${name} in
 +				interface:)
 +					echo $val
 +					break
 +					;;
 +				esac
 +			done`
 +		# Define the 6to4 tunnel's IPv4 address to match the first
 +		# IPv4 address of the IPv4 default interface.
 +		stf_interface_ipv4addr=`ifconfig ${ipv4_default_if} inet \
 +			| while read family addr junk ; do
 +				case ${family} in
 +				inet)
 +					echo $addr
 +					break
 +					;;
 +				esac
 +			done`
 +		# If no IPv6 default gateway is defined, use the RFC 3068 
 +		# anycast address.
 +		case ${ipv6_defaultrouter} in
 +		[Nn][Oo] | '')
 +			ipv6_defaultrouter="2002:c058:6301::"
 +			;;
 +		*)
 +			;;
 +		esac
 +	fi
   	network6_stf_setup
 
   	# Install the "default interface" to kernel, which will be used
 
 ----------------
 
 Antonio Querubin
 tony@lava.net
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Fri Oct 7 02:25:05 UTC 2011 
State-Changed-Why:  

As of RFC 6343 6to4 is deprecated. 


Responsible-Changed-From-To: freebsd-rc->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Fri Oct 7 02:25:05 UTC 2011 
Responsible-Changed-Why:  

I closed it. 

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