70d4ef1ea1
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
76 lines
1.4 KiB
Bash
Executable File
76 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: faith
|
|
# REQUIRE: netif routing
|
|
# KEYWORD: nojail
|
|
|
|
. /etc/rc.subr
|
|
. /etc/network.subr
|
|
|
|
name="faith"
|
|
start_cmd="faith_up"
|
|
stop_cmd="faith_down"
|
|
|
|
faith_up()
|
|
{
|
|
case ${ipv6_faith_prefix} in
|
|
[Nn][Oo] | '')
|
|
;;
|
|
*)
|
|
echo "Configuring IPv6-to-IPv4 TCP relay capturing interface:" \
|
|
" faith0."
|
|
${SYSCTL_W} net.inet6.ip6.keepfaith=1
|
|
ifconfig faith0 create >/dev/null 2>&1
|
|
ifconfig faith0 up
|
|
for prefix in ${ipv6_faith_prefix}; do
|
|
prefixlen=`expr "${prefix}" : ".*/\(.*\)"`
|
|
case ${prefixlen} in
|
|
'')
|
|
prefixlen=96
|
|
;;
|
|
*)
|
|
prefix=`expr "${prefix}" : \
|
|
"\(.*\)/${prefixlen}"`
|
|
;;
|
|
esac
|
|
route add -inet6 ${prefix} -prefixlen ${prefixlen} ::1
|
|
route change -inet6 ${prefix} -prefixlen ${prefixlen} \
|
|
-ifp faith0
|
|
done
|
|
check_startmsgs && ifconfig faith0
|
|
;;
|
|
esac
|
|
}
|
|
|
|
faith_down()
|
|
{
|
|
echo "Removing IPv6-to-IPv4 TCP relay capturing interface: faith0."
|
|
ifconfig faith0 destroy
|
|
${SYSCTL_W} net.inet6.ip6.keepfaith=0
|
|
|
|
case ${ipv6_faith_prefix} in
|
|
[Nn][Oo] | '')
|
|
;;
|
|
*)
|
|
for prefix in ${ipv6_faith_prefix}; do
|
|
prefixlen=`expr "${prefix}" : ".*/\(.*\)"`
|
|
case ${prefixlen} in
|
|
'')
|
|
prefixlen=96
|
|
;;
|
|
*)
|
|
prefix=`expr "${prefix}" : \
|
|
"\(.*\)/${prefixlen}"`
|
|
;;
|
|
esac
|
|
route delete -inet6 ${prefix} -prefixlen ${prefixlen}
|
|
done
|
|
;;
|
|
esac
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|