5 config_get proto
"$cfg" proto
7 local link
="$proto-$cfg"
8 SERVICE_PID_FILE
="/var/run/ppp-${link}.pid" \
9 service_stop
/usr
/sbin
/pppd
13 local lock
="/var/lock/ppp-$link"
14 [ -f "$lock" ] && lock
-u "$lock"
20 # Workaround for PPPoE service and AC name options,
21 # filter out the nic-* argument and append it as last option
24 nic-
*) nic
="$1"; shift ;;
28 config_get proto
"$cfg" proto
30 # unique link identifier
31 local link
="${proto:-ppp}-$cfg"
33 # make sure only one pppd process is started
34 lock
"/var/lock/ppp-${link}"
35 SERVICE_PID_FILE
="/var/run/ppp-${link}.pid" \
36 service_check
/usr
/sbin
/pppd
&& {
37 lock
-u "/var/lock/ppp-${link}"
41 # Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
42 # /dev/ppp fast enough to be used here
43 [ -e /dev
/ppp
] || mknod
/dev
/ppp c
108 0
46 config_get device
"$cfg" device
49 config_get username
"$cfg" username
52 config_get password
"$cfg" password
55 config_get keepalive
"$cfg" keepalive
58 config_get connect
"$cfg" connect
61 config_get disconnect
"$cfg" disconnect
64 config_get pppd_options
"$cfg" pppd_options
67 config_get_bool defaultroute
"$cfg" defaultroute
1
68 [ "$defaultroute" -eq 1 ] && \
69 defaultroute
="defaultroute replacedefaultroute" || defaultroute
="nodefaultroute"
71 local interval
="${keepalive##*[, ]}"
72 [ "$interval" != "$keepalive" ] || interval
=5
75 config_get dns
"$config" dns
85 config_get_bool peerdns
"$cfg" peerdns
$peer_default
87 [ "$peerdns" -eq 1 ] && {
95 config_get demand
"$cfg" demand
0
98 [ "$demand" -gt 0 ] && {
99 demandargs
="precompiled-active-filter /etc/ppp/filter demand idle $demand"
100 [ "$has_dns" -eq 0 ] && add_dns
"$cfg" 1.1.1.1
106 config_get_bool ipv6
"$cfg" ipv6
0
107 [ "$ipv6" -eq 1 ] && ipv6
="+ipv6" || ipv6
=""
109 SERVICE_DAEMONIZE
=1 \
110 SERVICE_WRITE_PID
=1 \
111 SERVICE_PID_FILE
="/var/run/ppp-$link.pid" \
112 service_start
/usr
/sbin
/pppd
"$@" \
113 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
117 ${username:+user "$username" password "$password"} \
120 ${connect:+connect "$connect"} \
121 ${disconnect:+disconnect "$disconnect"} \
127 lock
-u "/var/lock/ppp-${link}"
130 setup_interface_ppp
() {
135 config_get device
"$config" device
138 config_get mtu
"$config" mtu
141 start_pppd
"$config" \