3 [ -x /usr
/sbin
/pppd
] ||
exit 0
5 [ -n "$INCLUDE_ONLY" ] ||
{
11 ppp_generic_init_config
() {
12 proto_config_add_string
"username"
13 proto_config_add_string
"password"
14 proto_config_add_string
"keepalive"
15 proto_config_add_int
"demand"
16 proto_config_add_string
"pppd_options"
17 proto_config_add_string
"connect"
18 proto_config_add_string
"disconnect"
19 proto_config_add_boolean
"defaultroute"
20 proto_config_add_boolean
"peerdns"
21 proto_config_add_boolean
"ipv6"
22 proto_config_add_int
"mtu"
26 local config
="$1"; shift
28 json_get_var ipv6 ipv6
29 [ "$ipv6" = 1 ] || ipv6
=""
31 json_get_var peerdns peerdns
32 [ "$peerdns" = 0 ] && peerdns
="" || peerdns
="1"
34 json_get_var defaultroute defaultroute
35 if [ "$defaultroute" = 1 ]; then
36 defaultroute
="defaultroute replacedefaultroute";
38 defaultroute
="nodefaultroute"
41 json_get_var demand demand
42 if [ "${demand:-0}" -gt 0 ]; then
43 demand
="precompiled-active-filter /etc/ppp/filter demand idle $demand"
48 [ -n "$mtu" ] || json_get_var mtu mtu
50 json_get_var keepalive keepalive
51 local interval
="${keepalive##*[, ]}"
52 [ "$interval" != "$keepalive" ] || interval
=5
54 json_get_var username username
55 json_get_var password password
57 [ -n "$connect" ] || json_get_var connect connect
58 [ -n "$disconnect" ] || json_get_var disconnect disconnect
59 json_get_var pppd_options pppd_options
61 proto_run_command
"$config" /usr
/sbin
/pppd \
62 nodetach ipparam
"$config" \
63 ifname
"${proto:-ppp}-$config" \
64 ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
65 ${ipv6:++ipv6} $defaultroute \
66 ${peerdns:+usepeerdns} \
68 ${username:+user "$username" password "$password"} \
69 ${connect:+connect "$connect"} \
70 ${disconnect:+disconnect "$disconnect"} \
71 ip-up-script
/lib
/netifd
/ppp-up \
72 ipv6-up-script
/lib
/netifd
/ppp-up \
73 ip-down-script
/lib
/netifd
/ppp-down \
74 ipv6-down-script
/lib
/netifd
/ppp-down \
75 ${mtu:+mtu $mtu mru $mtu} \
79 ppp_generic_teardown
() {
84 proto_notify_error
"$interface" AUTH_FAILED
85 proto_block_restart
"$interface"
88 proto_kill_command
"$interface"
91 # PPP on serial device
94 proto_config_add_string
"device"
95 ppp_generic_init_config
102 json_get_var device device
103 ppp_generic_setup
"$config" "$device"
107 ppp_generic_teardown
"$@"
114 pppoe_init_config
() {
115 ppp_generic_init_config
116 proto_config_add_string
"ac"
117 proto_config_add_string
"service"
124 for module
in slhc ppp_generic pppox pppoe
; do
125 /sbin
/insmod
$module 2>&- >&-
132 json_get_var service service
134 ppp_generic_setup
"$config" \
136 ${ac:+rp_pppoe_ac "$ac"} \
137 ${service:+rp_pppoe_service "$service"} \
142 ppp_generic_teardown
"$@"
149 pppoa_init_config
() {
150 ppp_generic_init_config
151 proto_config_add_int
"atmdev"
152 proto_config_add_int
"vci"
153 proto_config_add_int
"vpi"
154 proto_config_add_string
"encaps"
161 for module
in slhc ppp_generic pppox pppoatm
; do
162 /sbin
/insmod
$module 2>&- >&-
165 json_get_var atmdev atmdev
169 json_get_var encaps encaps
171 1|vc
) encaps
="vc-encaps" ;;
172 *) encaps
="llc-encaps" ;;
175 ppp_generic_setup
"$config" \
177 ${atmdev:+$atmdev.}${vpi:-8}.${vci:-35} \
182 ppp_generic_teardown
"$@"
189 [ -n "$INCLUDE_ONLY" ] ||
{
191 [ -f /usr
/lib
/pppd
/*/rp-pppoe.so
] && add_protocol pppoe
192 [ -f /usr
/lib
/pppd
/*/pppoatm.so
] && add_protocol pppoa