From fd09e251e9f5809bf4f323e4fa644f90e275146e Mon Sep 17 00:00:00 2001 From: Rosy Song Date: Thu, 4 Oct 2018 14:46:40 +0800 Subject: [PATCH] ppp: don't start ppp with IPv6 support if ipv6 is not supported Signed-off-by: Rosy Song Signed-off-by: Hans Dedecker --- package/network/services/ppp/Makefile | 2 +- package/network/services/ppp/files/ppp.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package/network/services/ppp/Makefile b/package/network/services/ppp/Makefile index 9fbee90f12..b1f1f68950 100644 --- a/package/network/services/ppp/Makefile +++ b/package/network/services/ppp/Makefile @@ -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/ diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh index 99d5e4939f..2d9ca6d284 100755 --- a/package/network/services/ppp/files/ppp.sh +++ b/package/network/services/ppp/files/ppp.sh @@ -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 }