ppp: add unconditional autoipv6-trigger
[openwrt/staging/chunkeey.git] / package / network / services / ppp / files / ppp.sh
index 882440900b7a02f196c4f64714f82621dbf1a952..0456fda5d97e1231f755e6b1b6cd3916138ba05e 100755 (executable)
@@ -16,23 +16,31 @@ ppp_generic_init_config() {
        proto_config_add_string pppd_options
        proto_config_add_string 'connect:file'
        proto_config_add_string 'disconnect:file'
-       proto_config_add_boolean ipv6
+       proto_config_add_string ipv6
        proto_config_add_boolean authfail
        proto_config_add_int mtu
+       proto_config_add_string pppname
 }
 
 ppp_generic_setup() {
        local config="$1"; shift
 
-       json_get_vars ipv6 demand keepalive username password pppd_options
-       [ "$ipv6" = 1 ] || ipv6=""
+       json_get_vars ipv6 demand keepalive username password pppd_options pppname
+       if [ "$ipv6" = 0 ]; then
+               ipv6=""
+       elif [ -z "$ipv6" -o "$ipv6" = auto ]; then
+               ipv6=1
+               proto_export "AUTOIPV6=1"
+       fi
+
        if [ "${demand:-0}" -gt 0 ]; then
                demand="precompiled-active-filter /etc/ppp/filter demand idle $demand"
        else
                demand="persist"
        fi
-
+       [ "${keepalive:-0}" -lt 1 ] && keepalive=""
        [ -n "$mtu" ] || json_get_var mtu mtu
+       [ -n "$pppname" ] || pppname="${proto:-ppp}-$config"
 
        local interval="${keepalive##*[, ]}"
        [ "$interval" != "$keepalive" ] || interval=5
@@ -41,7 +49,7 @@ ppp_generic_setup() {
 
        proto_run_command "$config" /usr/sbin/pppd \
                nodetach ipparam "$config" \
-               ifname "${proto:-ppp}-$config" \
+               ifname "$pppname" \
                ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[, ]*}} \
                ${ipv6:++ipv6} \
                nodefaultroute \