[LEDE-DEV] [PATCH] ppp: add the peerdns option to ppp interface protocol

Gianluca Anzolin gianluca at sottospazio.it
Wed Dec 14 05:31:48 PST 2016


Add the peerdns option to the ppp interface protocol in the network
configuration file.

When not explicitly set, the variable defaults to '1' which means that
the ppp daemon will get the dns server addresses via the PPP protocol. A
value of '0' disables the feature for users who want to override the dns
addresses set by their provider.

Signed-off-by: Gianluca Anzolin <gianluca at sottospazio.it>
---
 package/network/services/ppp/files/ppp.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/package/network/services/ppp/files/ppp.sh b/package/network/services/ppp/files/ppp.sh
index 91452b4..151a4ec 100755
--- a/package/network/services/ppp/files/ppp.sh
+++ b/package/network/services/ppp/files/ppp.sh
@@ -88,7 +88,7 @@ ppp_generic_setup() {
 	local config="$1"; shift
 	local localip
 
-	json_get_vars ipv6 demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff
+	json_get_vars ipv6 demand keepalive keepalive_adaptive username password pppd_options pppname unnumbered persist maxfail holdoff peerdns
 	if [ "$ipv6" = 0 ]; then
 		ipv6=""
 	elif [ -z "$ipv6" -o "$ipv6" = auto ]; then
@@ -129,6 +129,9 @@ ppp_generic_setup() {
 	[ -n "$connect" ] || json_get_var connect connect
 	[ -n "$disconnect" ] || json_get_var disconnect disconnect
 
+	local usepeerdns="usepeerdns"
+	[ "${peerdns:-1}" -lt 1 ] && usepeerdns=""
+
 	proto_run_command "$config" /usr/sbin/pppd \
 		nodetach ipparam "$config" \
 		ifname "$pppname" \
@@ -137,7 +140,7 @@ ppp_generic_setup() {
 		${ipv6:++ipv6} \
 		${autoipv6:+set AUTOIPV6=1} \
 		nodefaultroute \
-		usepeerdns \
+		$usepeerdns \
 		$demand $persist maxfail $maxfail \
 		${holdoff:+holdoff "$holdoff"} \
 		${username:+user "$username" password "$password"} \
-- 
2.10.2




More information about the Lede-dev mailing list