ppp: don't start ppp with IPv6 support if ipv6 is not supported
authorRosy Song <rosysong@rosinson.com>
Thu, 4 Oct 2018 06:46:40 +0000 (14:46 +0800)
committerHans Dedecker <dedeckeh@gmail.com>
Tue, 16 Oct 2018 12:31:45 +0000 (14:31 +0200)
Signed-off-by: Rosy Song <rosysong@rosinson.com>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
package/network/services/ppp/Makefile
package/network/services/ppp/files/ppp.sh

index 9fbee90f12de3fdf9bd25fd31261fe0f3220dd2c..b1f1f6895042fa4a7ce9e4b170ccfb5a31057e7a 100644 (file)
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=ppp
 PKG_VERSION:=2.4.7
-PKG_RELEASE:=13
+PKG_RELEASE:=14
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://download.samba.org/pub/ppp/
index 99d5e4939f0e9cab9599e10d46bb2561a84947d1..2d9ca6d284838a7575c0732b1d4c13435fe71b0b 100755 (executable)
@@ -74,7 +74,7 @@ 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_string ipv6
+       [ -e /proc/sys/net/ipv6 ] && proto_config_add_string ipv6
        proto_config_add_boolean authfail
        proto_config_add_int mtu
        proto_config_add_string pppname
@@ -88,7 +88,10 @@ ppp_generic_setup() {
        local config="$1"; shift
        local localip
 
-       json_get_vars ipv6 ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff peerdns
+       json_get_vars ip6table demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff peerdns
+
+       [ ! -e /proc/sys/net/ipv6 ] && ipv6=0 || json_get_var ipv6 ipv6
+
        if [ "$ipv6" = 0 ]; then
                ipv6=""
        elif [ -z "$ipv6" -o "$ipv6" = auto ]; then
@@ -148,9 +151,9 @@ ppp_generic_setup() {
                ${connect:+connect "$connect"} \
                ${disconnect:+disconnect "$disconnect"} \
                ip-up-script /lib/netifd/ppp-up \
-               ipv6-up-script /lib/netifd/ppp6-up \
+               ${ipv6:+ipv6-up-script /lib/netifd/ppp6-up} \
                ip-down-script /lib/netifd/ppp-down \
-               ipv6-down-script /lib/netifd/ppp-down \
+               ${ipv6:+ipv6-down-script /lib/netifd/ppp-down} \
                ${mtu:+mtu $mtu mru $mtu} \
                "$@" $pppd_options
 }