All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Essen <lee.essen@nowonline.co.uk>
To: buildroot@busybox.net
Subject: [Buildroot] pppd makefile moves /etc/PPP/resolv.conf
Date: Mon, 26 Jan 2015 19:52:49 +0400	[thread overview]
Message-ID: <229B9DED-2639-4EE5-91DC-242BA40B3239@nowonline.co.uk> (raw)
In-Reply-To: <54C64A9B.5050602@zacarias.com.ar>


> On 26 Jan 2015, at 18:09, Gustavo Zacarias <gustavo@zacarias.com.ar> wrote:
> 
> On 01/26/2015 10:27 AM, Lee Essen wrote:
> 
>> Hi Gustavo,
>> 
>> OK, makes sense, however doesn?t make it easy to do anything clever with resolv.conf.
>> 
>> In the standard DHCP client it?s actually the script and not the binary that creates resolv.conf so it?s really easy to control behaviour.
>> 
>> The problem with pppd is that if you don?t specify usepeerdns then you don?t get any information (and no env vars for the script) and you if you specify usepeerdns then it writes /etc/resolv.conf without a care!
>> 
>> The more I think about it, the more I think the problem is actually with pppd, and your ?multiple-pppd? example is another good use case that breaks, even with an unmodified pppd.
>> 
>> The best solution I can come up with is the use of a ?noresolv? option for ppp that says ?don?t create a resolve.conf file? ? then I don?t care where it points, it doesn?t write anything at all, yet the DNS vars are available to ppp-up. The default case also doesn?t break existing behaviour.
>> 
>> It?s a trivial patch that I?m happy to share if anyone is interested, otherwise I?ll just keep it in my tree.
>> 
>> Thanks,
>> 
>> Lee.
> 
> Hi again.
> A quick fix might be to throw in an ip-up script that makes
> /etc/resolv.conf (using $DNS1, $DNS2 and $USEPEERDNS i think) in the
> pppd package, and make the binary write resolv.conf to some no-op like
> /dev/null.
> This way we still got the benefit of PnP-like dns configuration that can
> be easily disabled by removing said script.
> Regards.

Yep, that would work ok, but the below feels nicer to me and doesn?t require extra scripts, plus it?s something that could probably be suggested upstream ? the default behaviour is entirely unchanged (providing you keep the path change that?s there currently) so everything should work as is unless you add the config option.

diff -Naur pppd-orig/pppd/ipcp.c pppd-2.4.7/pppd/ipcp.c
--- pppd-orig/pppd/ipcp.c	2014-08-09 13:31:39.000000000 +0100
+++ pppd-2.4.7/pppd/ipcp.c	2015-01-26 07:27:04.758264172 +0000
@@ -91,6 +91,7 @@
 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 noresolv;			/* Don't write resolv.conf */
 static int ipcp_is_up;			/* have called np_up() */
 static int ipcp_is_open;		/* haven't called np_finished() */
 static bool ask_for_local;		/* request our address from peer */
@@ -209,6 +210,8 @@
 
     { "usepeerdns", o_bool, &usepeerdns,
       "Ask peer for DNS address(es)", 1 },
+    { "noresolv", o_bool, &noresolv,
+      "disable creation of the resolv.conf file", 1 },
 
     { "netmask", o_special, (void *)setnetmask,
       "set netmask", OPT_PRIO | OPT_A2STRVAL | OPT_STATIC, netmask_str },
@@ -1827,6 +1830,7 @@
 	script_setenv("DNS2", ip_ntoa(go->dnsaddr[1]), 0);
     if (usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
 	script_setenv("USEPEERDNS", "1", 0);
+	if (!noresolv)
 	create_resolv(go->dnsaddr[0], go->dnsaddr[1]);
     }



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20150126/a18d7b3e/attachment.html>

  reply	other threads:[~2015-01-26 15:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26  6:49 [Buildroot] pppd makefile moves /etc/PPP/resolv.conf Lee Essen
2015-01-26 10:33 ` Gustavo Zacarias
2015-01-26 13:27   ` Lee Essen
2015-01-26 14:09     ` Gustavo Zacarias
2015-01-26 15:52       ` Lee Essen [this message]
2015-01-26 16:07         ` Gustavo Zacarias

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=229B9DED-2639-4EE5-91DC-242BA40B3239@nowonline.co.uk \
    --to=lee.essen@nowonline.co.uk \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.