Bring in some miscellaneous changes from OpenBSD and point to an
[dragonfly/port-amd64.git] / etc / rc.d / ppp-user
blob81be1096a6ac5057ae656309a8fea8a86907e426
1 #!/bin/sh
3 # $FreeBSD: src/etc/rc.d/ppp-user,v 1.4 2003/04/18 17:55:05 mtm Exp $
4 # $DragonFly: src/etc/rc.d/ppp-user,v 1.4 2005/11/19 21:47:32 swildner Exp $
7 # PROVIDE: ppp-user
8 # REQUIRE: netif isdnd
10 . /etc/rc.subr
12 name="ppp"
13 rcvar="ppp_enable"
14 start_cmd="ppp_start"
15 stop_cmd="ppp_stop"
17 ppp_start()
19 # Establish ppp mode.
21 if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \
22 -a "${ppp_mode}" != "dedicated" \
23 -a "${ppp_mode}" != "background" ]; then
24 ppp_mode="auto"
27 ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
29 # Switch on NAT mode?
31 case ${ppp_nat} in
32 [Yy][Ee][Ss])
33 ppp_command="${ppp_command} -nat"
35 esac
37 ppp_command="${ppp_command} ${ppp_profile}"
39 echo "Starting ppp as \"${ppp_user}\""
40 su -m ${ppp_user} -c "exec ${ppp_command}"
42 # Re-Sync ipfilter so it picks up any new network interfaces
44 /etc/rc.d/ipfilter resync
47 ppp_stop()
49 pids=`check_process /usr/sbin/ppp`
50 if [ -n "${pids}" ]; then
51 for pid in ${pids}; do
52 kill -TERM ${pid}
53 done
54 wait_for_pids ${pids}
56 /etc/rc.d/ipfilter resync
59 load_rc_config $name
60 run_rc_command "$1"