1#!/bin/sh
2#
3# $NetBSD: ppp,v 1.11 2013/01/13 18:47:58 prlw1 Exp $
4#
5
6# PROVIDE: ppp
7# REQUIRE: mountcritremote syslogd
8# BEFORE:  SERVERS
9#
10#         Note that this means that syslogd will not be listening on
11#         any PPP addresses.  This is considered a feature.
12#
13
14$_rc_subr_loaded . /etc/rc.subr
15
16name="ppp"
17rcvar=$name
18start_cmd="ppp_start"
19stop_cmd="ppp_stop"
20sig_stop="-INT"
21sig_hup="-HUP"
22hup_cmd="ppp_hup"
23extra_commands="hup"
24
25ppp_start()
26{
27          #         /etc/ppp/peers and $ppp_peers contain boot configuration
28          #         information for pppd.  each value in $ppp_peers that has a
29          #         file in /etc/ppp/peers of the same name, will be run as
30          #         `pppd call <peer>'.
31          #
32          if [ -n "$ppp_peers" ]; then
33                    set -- $ppp_peers
34                    echo -n "Starting pppd:"
35                    while [ $# -ge 1 ]; do
36                              peer=$1
37                              shift
38                              if [ -f /etc/ppp/peers/$peer ]; then
39                                        pppd call $peer
40                                        echo -n " $peer"
41                              fi
42                    done
43                    echo "."
44          fi
45}
46
47ppp_hup()
48{
49          pids="$(check_process pppd)"
50          if [ -n "$pids" ]; then
51                    for pid in $pids; do
52                              kill $sig_hup $pid
53                    done
54          fi
55}
56
57ppp_stop()
58{
59          pids="$(check_process pppd)"
60          if [ -n "$pids" ]; then
61                    for pid in $pids; do
62                              kill $sig_stop $pid
63                    done
64          fi
65}
66
67load_rc_config $name
68run_rc_command "$1"
69