aboutsummaryrefslogtreecommitdiff
path: root/net/xl2tpd
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2015-08-11 11:54:12 +0800
committerYousong Zhou <yszhou4tech@gmail.com>2015-08-14 12:16:27 +0800
commit27aafeb96a3e048a54130d12ae31c3e905a026c1 (patch)
tree70a9629fa74fa8cd5bbea33ab7e4c6fe08a6b575 /net/xl2tpd
parent23feea5814965aedc0d15e5af6d24cb2bcf2ddec (diff)
xl2tpd: tweak generating pppoptfile.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'net/xl2tpd')
-rw-r--r--net/xl2tpd/files/l2tp.sh37
1 files changed, 22 insertions, 15 deletions
diff --git a/net/xl2tpd/files/l2tp.sh b/net/xl2tpd/files/l2tp.sh
index be6b61dcc..45fd39865 100644
--- a/net/xl2tpd/files/l2tp.sh
+++ b/net/xl2tpd/files/l2tp.sh
@@ -67,22 +67,29 @@ proto_l2tp_setup() {
local interval="${keepalive##*[, ]}"
[ "$interval" != "$keepalive" ] || interval=5
- mkdir -p /tmp/l2tp
+ keepalive="${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}}"
+ username="${username:+user \"$username\" password \"$password\"}"
+ ipv6="${ipv6:++ipv6}"
+ mtu="${mtu:+mtu $mtu mru $mtu}"
- echo "${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}}" > "${optfile}"
- echo "usepeerdns" >> "${optfile}"
- echo "nodefaultroute" >> "${optfile}"
- echo "${username:+user \"$username\" password \"$password\"}" >> "${optfile}"
- echo "ipparam \"$interface\"" >> "${optfile}"
- echo "ifname \"l2tp-$interface\"" >> "${optfile}"
- echo "ip-up-script /lib/netifd/ppp-up" >> "${optfile}"
- echo "ipv6-up-script /lib/netifd/ppp-up" >> "${optfile}"
- echo "ip-down-script /lib/netifd/ppp-down" >> "${optfile}"
- echo "ipv6-down-script /lib/netifd/ppp-down" >> "${optfile}"
- # Don't wait for LCP term responses; exit immediately when killed.
- echo "lcp-max-terminate 0" >> "${optfile}"
- echo "${ipv6:++ipv6} ${pppd_options}" >> "${optfile}"
- echo "${mtu:+mtu $mtu mru $mtu}" >> "${optfile}"
+ mkdir -p /tmp/l2tp
+ cat <<EOF >"$optfile"
+usepeerdns
+nodefaultroute
+ipparam "$interface"
+ifname "l2tp-$interface"
+ip-up-script /lib/netifd/ppp-up
+ipv6-up-script /lib/netifd/ppp-up
+ip-down-script /lib/netifd/ppp-down
+ipv6-down-script /lib/netifd/ppp-down
+# Don't wait for LCP term responses; exit immediately when killed.
+lcp-max-terminate 0
+$keepalive
+$username
+$ipv6
+$mtu
+$pppd_options
+EOF
xl2tpd-control add l2tp-${interface} pppoptfile=${optfile} lns=${server} || {
echo "xl2tpd-control: Add l2tp-$interface failed" >&2