linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
To: linux-ppp@vger.kernel.org
Subject: RESEND: [PATCH] pppd: add noresolvconf option
Date: Tue, 6 Sep 2022 12:19:46 +0200	[thread overview]
Message-ID: <YxcewpV/B4ZyDxmL@x1.vandijck-laurijssen.be> (raw)

On embedded systems, it is easier to avoid the resolv.conf conflicts
than to fix them.
'noresolvconf' option on top of 'usepeerdns' lets pppd request DNS information
and forward the info to the scripts, but will not write resolv.conf.
The ip-up/ip-down scripts can then deal with the info and no conflict ever
existed.

Signed-off-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
---
 pppd/ipcp.c | 6 +++++-
 pppd/pppd.8 | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/pppd/ipcp.c b/pppd/ipcp.c
index 0dc251e..ade2064 100644
--- a/pppd/ipcp.c
+++ b/pppd/ipcp.c
@@ -93,6 +93,7 @@ struct notifier *ip_down_notifier = NULL;
 static int default_route_set[NUM_PPP];	/* Have set up a default route */
 static int proxy_arp_set[NUM_PPP];	/* Have created proxy arp entry */
 static bool usepeerdns;			/* Ask peer for DNS addrs */
+static bool resolvconf = 1;		/* deploy peer DNS addrs */
 static bool usepeerwins;		/* Ask peer for WINS addrs */
 static int ipcp_is_up;			/* have called np_up() */
 static int ipcp_is_open;		/* haven't called np_finished() */
@@ -221,6 +222,8 @@ static option_t ipcp_option_list[] = {
 
     { "usepeerdns", o_bool, &usepeerdns,
       "Ask peer for DNS address(es)", 1 },
+    { "noresolvconf", o_bool, &resolvconf,
+      "Ask for DNS but Don't deploy resolv.conf", OPT_A2CLR},
 
     { "usepeerwins", o_bool, &usepeerwins,
       "Ask peer for WINS address(es)", 1 },
@@ -1846,7 +1849,8 @@ ipcp_up(fsm *f)
 	script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
     if (usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
 	script_setenv("USEPEERDNS", "1", 0);
-	create_resolv(go->dnsaddr[0], go->dnsaddr[1]);
+	if (resolvconf)
+	    create_resolv(go->dnsaddr[0], go->dnsaddr[1]);
     }
 
     if (go->winsaddr[0])
diff --git a/pppd/pppd.8 b/pppd/pppd.8
index 79b5bea..00d2489 100644
--- a/pppd/pppd.8
+++ b/pppd/pppd.8
@@ -1190,7 +1190,10 @@ by the peer (if any) are passed to the /etc/ppp/ip\-up script in the
 environment variables DNS1 and DNS2, and the environment variable
 USEPEERDNS will be set to 1.  In addition, pppd will create an
 /etc/ppp/resolv.conf file containing one or two nameserver lines with
-the address(es) supplied by the peer.
+the address(es) supplied by the peer, unless \fBresolvconf\fB is turned off.
+.TP
+.B noresolvconf
+Do not create /etc/ppp/resolv.conf with the DNS server addresses supplied by the peer.
 .TP
 .B usepeerwins
 Ask the peer for up to 2 WINS server addresses.  The addresses supplied
-- 
2.35.1


                 reply	other threads:[~2022-09-06 10:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YxcewpV/B4ZyDxmL@x1.vandijck-laurijssen.be \
    --to=dev.kurt@vandijck-laurijssen.be \
    --cc=linux-ppp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).