head	1.7;
access;
symbols
	RELENG_9_1_0_RELEASE:1.6.2.1.4.2
	RELENG_9_1:1.6.2.1.0.4
	RELENG_9_1_BP:1.6.2.1
	RELENG_9_0_0_RELEASE:1.6.2.1.2.1
	RELENG_9_0:1.6.2.1.0.2
	RELENG_9_0_BP:1.6.2.1
	RELENG_9:1.6.0.2
	RELENG_9_BP:1.6;
locks; strict;
comment	@# @;


1.7
date	2012.11.17.01.49.05;	author svnexp;	state Exp;
branches;
next	1.6;

1.6
date	2010.05.14.04.53.57;	author dougb;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2009.10.17.21.09.15;	author dougb;	state Exp;
branches;
next	1.4;

1.4
date	2009.10.10.22.17.03;	author dougb;	state Exp;
branches;
next	1.3;

1.3
date	2009.10.02.06.19.34;	author hrs;	state Exp;
branches;
next	1.2;

1.2
date	2009.10.02.02.24.25;	author hrs;	state Exp;
branches;
next	1.1;

1.1
date	2009.09.12.22.13.41;	author hrs;	state Exp;
branches;
next	;

1.6.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.6.2.1.2.1
	1.6.2.1.4.1;
next	1.6.2.2;

1.6.2.2
date	2012.11.17.11.36.11;	author svnexp;	state Exp;
branches;
next	;

1.6.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.6.2.1.2.2;

1.6.2.1.2.2
date	2012.11.17.08.36.11;	author svnexp;	state Exp;
branches;
next	;

1.6.2.1.4.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.6.2.1.4.2;

1.6.2.1.4.2
date	2012.11.17.08.47.01;	author svnexp;	state Exp;
branches;
next	;


desc
@@


1.7
log
@Switching exporter and resync
@
text
@#!/bin/sh
# $FreeBSD: head/etc/rc.d/stf 208060 2010-05-14 04:53:57Z dougb $
#

# PROVIDE: stf
# REQUIRE: netif
# KEYWORD: nojail

. /etc/rc.subr
. /etc/network.subr

name="stf"
start_cmd="stf_up"
stop_cmd="stf_down"

stf_up()
{
	case ${stf_interface_ipv4addr} in
	[Nn][Oo] | '')
		;;
	*)
		# assign IPv6 addr and interface route for 6to4 interface
		stf_prefixlen=$((16+${stf_interface_ipv4plen:-0}))
		OIFS="$IFS"
		IFS=".$IFS"
		set ${stf_interface_ipv4addr}
		IFS="$OIFS"
		hexfrag1=`hexprint $(($1*256 + $2))`
		hexfrag2=`hexprint $(($3*256 + $4))`
		ipv4_in_hexformat="${hexfrag1}:${hexfrag2}"
		case ${stf_interface_ipv6_ifid} in
		[Aa][Uu][Tt][Oo] | '')
			for i in ${ipv6_network_interfaces}; do
				laddr=`network6_getladdr ${i}`
				case ${laddr} in
				'')
					;;
				*)
					break
					;;
				esac
			done
			stf_interface_ipv6_ifid=`expr "${laddr}" : \
						      'fe80::\(.*\)%\(.*\)'`
			case ${stf_interface_ipv6_ifid} in
			'')
				stf_interface_ipv6_ifid=0:0:0:1
				;;
			esac
			;;
		esac
		echo "Configuring 6to4 tunnel interface: stf0."
		ifconfig stf0 create >/dev/null 2>&1
		ifconfig stf0 inet6 2002:${ipv4_in_hexformat}:${stf_interface_ipv6_slaid:-0}:${stf_interface_ipv6_ifid} \
			prefixlen ${stf_prefixlen}
		check_startmsgs && /sbin/ifconfig stf0

		# disallow packets to malicious 6to4 prefix
		route add -inet6 2002:e000:: -prefixlen 20 ::1 -reject
		route add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject
		route add -inet6 2002:0000:: -prefixlen 24 ::1 -reject
		route add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject
		;;
	esac
}

stf_down()
{
	echo "Removing 6to4 tunnel interface: stf0."
	ifconfig stf0 destroy
	route delete -inet6 2002:e000:: -prefixlen 20 ::1
	route delete -inet6 2002:7f00:: -prefixlen 24 ::1
	route delete -inet6 2002:0000:: -prefixlen 24 ::1
	route delete -inet6 2002:ff00:: -prefixlen 24 ::1
}

load_rc_config $name
run_rc_command "$1"
@


1.6
log
@SVN rev 208060 on 2010-05-14 04:53:57Z by dougb

Remove trailing white space. No functional changes.
@
text
@d2 1
a2 1
# $FreeBSD$
@


1.6.2.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.6.2.2
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d2 1
a2 1
# $FreeBSD: stable/9/etc/rc.d/stf 208060 2010-05-14 04:53:57Z dougb $
@


1.6.2.1.4.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.6.2.1.4.2
log
@Switch importer
@
text
@d2 1
a2 1
# $FreeBSD: releng/9.1/etc/rc.d/stf 208060 2010-05-14 04:53:57Z dougb $
@


1.6.2.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.6.2.1.2.2
log
@Switch importer
@
text
@d2 1
a2 1
# $FreeBSD: releng/9.0/etc/rc.d/stf 208060 2010-05-14 04:53:57Z dougb $
@


1.5
log
@SVN rev 198190 on 2009-10-17 21:09:15Z by dougb

Remove a circular dependency on routing

Submitted by:	Mykola Dzham <freebsd@@levsha.org.ua>
Approved by:	hrs
@
text
@d52 1
a52 1
		echo "Configuring 6to4 tunnel interface: stf0." 
d69 1
a69 1
	echo "Removing 6to4 tunnel interface: stf0." 
@


1.4
log
@SVN rev 197947 on 2009-10-10 22:17:03Z by dougb

In regards to the "Starting foo:" type messages at boot time, create and
employ a more generic solution, and use it in the individual rc.d scripts
that also have an $rc_quiet test:

1. Add check_startmsgs() to rc.subr.
2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
variations of [ -z "$rc_quiet" ] with check_startmsgs
3. In savecore add a trailing '.' to the end of the message to make it
more consistent with other scripts.
4. In newsyslog remove a : before the terminal '.' since we do not expect
there to be anything printed out in between to make it more consistent.
5. In the following scripts change "quotes" to 'quotes' where no variables
exist in the message: savecore pf newsyslog
6. In the following scripts substitute if/then/fi for the simpler (and
more consistent) check_startmsgs &&: faith stf
7. In the following scripts separate the "Starting foo:" from the terminal
'.' to make them more consistent: moused hostname pf
8. In nfsclient move the message to its own line to avoid a style bug
9. In pf rc_quiet does not apply to the _stop method, so remove the
test there.
10. In motd add 'quotes' around the terminal '.' for consistency
@
text
@d6 1
a6 1
# REQUIRE: netif routing
@


1.3
log
@SVN rev 197701 on 2009-10-02 06:19:34Z by hrs

Revert the previous afexists() change.  Knobs configured explicitly by
the user should not be ignored if possible even if the kernel does not
support the prerequisite feature.

Discussed with:	ume
@
text
@d56 2
a57 3
		if [ -z "${rc_quiet}" ]; then
			/sbin/ifconfig stf0
		fi
@


1.2
log
@SVN rev 197697 on 2009-10-02 02:24:25Z by hrs

- Add AF_IPX and AF_NATM to afexists().

- Add afexists() check to address family specific rc.d scripts.  A
  script for an AF will be silently ignored if the kernel has no
  support for the AF.
@
text
@a17 2
	afexists inet6 || return 0

a69 2
	afexists inet6 || return 0

@


1.1
log
@SVN rev 197139 on 2009-09-12 22:13:41Z by hrs

Integrate rc.d/network_ipv6 into rc.d/netif:

- Add rc.d/stf and rc.d/faith for stf(4) and faith(4).
- Remove rc.d/auto_linklocal and rc.d/network_ipv6.
- Move rc.d/sysctl to just before FILESYSTEMS because rc.d/netif
  depends on some sysctl variables.

Reviewed by:	brooks
MFC after:	3 days
@
text
@d18 2
d72 2
@

