|
@@ -67,22 +67,29 @@ proto_l2tp_setup() {
|
67
|
67
|
local interval="${keepalive##*[, ]}"
|
68
|
68
|
[ "$interval" != "$keepalive" ] || interval=5
|
69
|
69
|
|
70
|
|
- mkdir -p /tmp/l2tp
|
|
70
|
+ keepalive="${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}}"
|
|
71
|
+ username="${username:+user \"$username\" password \"$password\"}"
|
|
72
|
+ ipv6="${ipv6:++ipv6}"
|
|
73
|
+ mtu="${mtu:+mtu $mtu mru $mtu}"
|
71
|
74
|
|
72
|
|
- echo "${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}}" > "${optfile}"
|
73
|
|
- echo "usepeerdns" >> "${optfile}"
|
74
|
|
- echo "nodefaultroute" >> "${optfile}"
|
75
|
|
- echo "${username:+user \"$username\" password \"$password\"}" >> "${optfile}"
|
76
|
|
- echo "ipparam \"$interface\"" >> "${optfile}"
|
77
|
|
- echo "ifname \"l2tp-$interface\"" >> "${optfile}"
|
78
|
|
- echo "ip-up-script /lib/netifd/ppp-up" >> "${optfile}"
|
79
|
|
- echo "ipv6-up-script /lib/netifd/ppp-up" >> "${optfile}"
|
80
|
|
- echo "ip-down-script /lib/netifd/ppp-down" >> "${optfile}"
|
81
|
|
- echo "ipv6-down-script /lib/netifd/ppp-down" >> "${optfile}"
|
82
|
|
-
|
83
|
|
- echo "lcp-max-terminate 0" >> "${optfile}"
|
84
|
|
- echo "${ipv6:++ipv6} ${pppd_options}" >> "${optfile}"
|
85
|
|
- echo "${mtu:+mtu $mtu mru $mtu}" >> "${optfile}"
|
|
75
|
+ mkdir -p /tmp/l2tp
|
|
76
|
+ cat <<EOF >"$optfile"
|
|
77
|
+usepeerdns
|
|
78
|
+nodefaultroute
|
|
79
|
+ipparam "$interface"
|
|
80
|
+ifname "l2tp-$interface"
|
|
81
|
+ip-up-script /lib/netifd/ppp-up
|
|
82
|
+ipv6-up-script /lib/netifd/ppp-up
|
|
83
|
+ip-down-script /lib/netifd/ppp-down
|
|
84
|
+ipv6-down-script /lib/netifd/ppp-down
|
|
85
|
+
|
|
86
|
+lcp-max-terminate 0
|
|
87
|
+$keepalive
|
|
88
|
+$username
|
|
89
|
+$ipv6
|
|
90
|
+$mtu
|
|
91
|
+$pppd_options
|
|
92
|
+EOF
|
86
|
93
|
|
87
|
94
|
xl2tpd-control add l2tp-${interface} pppoptfile=${optfile} lns=${server} || {
|
88
|
95
|
echo "xl2tpd-control: Add l2tp-$interface failed" >&2
|