All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] pppd makefile moves /etc/PPP/resolv.conf
@ 2015-01-26  6:49 Lee Essen
  2015-01-26 10:33 ` Gustavo Zacarias
  0 siblings, 1 reply; 6+ messages in thread
From: Lee Essen @ 2015-01-26  6:49 UTC (permalink / raw)
  To: buildroot

Hi,

The current pppd package makefile has a post extract hook that changes the ppp generated resolv.conf from /etc/ppp/resolv.conf to /etc/resolv.conf with a comment suggesting that this is done because /etc/ppp might not be writable (and this location isn't useful because of where the c library looks.)

My assumption is that the original location provided you with flexibility to do clever things in the ppp-up script (and that's certainly what I want to do)

If you don't set usepeerdns then it looks like the server names don't get requested, so the creation of this file seems to be all or nothing - there is no way to work with just the env vars.

With the current buildroot setup your resolv.conf is overwritten with no option to do anything clever.

Wouldn't it be better to use /var/run/ppp.resolv.conf (or something similar) or even leave it as it was and include a symlink in /etc/ppp ??

Thanks,

Lee.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] pppd makefile moves /etc/PPP/resolv.conf
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Gustavo Zacarias @ 2015-01-26 10:33 UTC (permalink / raw)
  To: buildroot

On 01/26/2015 03:49 AM, Lee Essen wrote:

> Hi,
> 
> The current pppd package makefile has a post extract hook that changes the ppp generated resolv.conf from /etc/ppp/resolv.conf to /etc/resolv.conf with a comment suggesting that this is done because /etc/ppp might not be writable (and this location isn't useful because of where the c library looks.)
> 
> My assumption is that the original location provided you with flexibility to do clever things in the ppp-up script (and that's certainly what I want to do)
> 
> If you don't set usepeerdns then it looks like the server names don't get requested, so the creation of this file seems to be all or nothing - there is no way to work with just the env vars.
> 
> With the current buildroot setup your resolv.conf is overwritten with no option to do anything clever.
> 
> Wouldn't it be better to use /var/run/ppp.resolv.conf (or something similar) or even leave it as it was and include a symlink in /etc/ppp ??
> 
> Thanks,
> 
> Lee.

Hi.
I did that modification, let's see.
Actually the original location didn't provide anything useful if your
root filesystem is read-only, like in squashfs, so it's just as bad, so
it makes no sense in making it a symlink from /etc/ppp -> /var/run in
the way you say, because, well, what if you got multiple ppp instances
running?
The other problem with writing it to some other temporary file different
than /etc(tmp)/resolv.conf is that out of the box it's useless.
What if i said "i've got an advanced scenario and dhcpcd/udhcpc/other
dhcp client writes to /etc/resolv.conf unfairly"?
What dhcp clients currently do is no different than what pppd does (with
usepeerdns), and it's basically out-of-the-box simplicity, it just
works, though granted that it doesn't cater for advanced uses.
That pppd doesn't give DNS information to ip-up scripts, at least for
me, a bug, the information should be available. It's likely upstream
won't fix/change this since it would alter established behaviour and
hence breaks scripts.
So what's the solution to the sucky /etc/resolv.conf mess?
Well, openresolv (http://roy.marples.name/projects/openresolv/index).
I've mentioned it in IRC before but didn't have time to create the
package and glue it together seamlessly with the other packages (mostly
ppp, dhcp clients and so on).
Regards.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] pppd makefile moves /etc/PPP/resolv.conf
  2015-01-26 10:33 ` Gustavo Zacarias
@ 2015-01-26 13:27   ` Lee Essen
  2015-01-26 14:09     ` Gustavo Zacarias
  0 siblings, 1 reply; 6+ messages in thread
From: Lee Essen @ 2015-01-26 13:27 UTC (permalink / raw)
  To: buildroot


> On 26 Jan 2015, at 14:33, Gustavo Zacarias <gustavo@zacarias.com.ar> wrote:
> 
> On 01/26/2015 03:49 AM, Lee Essen wrote:
> 
>> Hi,
>> 
>> The current pppd package makefile has a post extract hook that changes the ppp generated resolv.conf from /etc/ppp/resolv.conf to /etc/resolv.conf with a comment suggesting that this is done because /etc/ppp might not be writable (and this location isn't useful because of where the c library looks.)
>> 
>> My assumption is that the original location provided you with flexibility to do clever things in the ppp-up script (and that's certainly what I want to do)
>> 
>> If you don't set usepeerdns then it looks like the server names don't get requested, so the creation of this file seems to be all or nothing - there is no way to work with just the env vars.
>> 
>> With the current buildroot setup your resolv.conf is overwritten with no option to do anything clever.
>> 
>> Wouldn't it be better to use /var/run/ppp.resolv.conf (or something similar) or even leave it as it was and include a symlink in /etc/ppp ??
>> 
>> Thanks,
>> 
>> Lee.
> 
> Hi.
> I did that modification, let's see.
> Actually the original location didn't provide anything useful if your
> root filesystem is read-only, like in squashfs, so it's just as bad, so
> it makes no sense in making it a symlink from /etc/ppp -> /var/run in
> the way you say, because, well, what if you got multiple ppp instances
> running?
> The other problem with writing it to some other temporary file different
> than /etc(tmp)/resolv.conf is that out of the box it's useless.
> What if i said "i've got an advanced scenario and dhcpcd/udhcpc/other
> dhcp client writes to /etc/resolv.conf unfairly"?
> What dhcp clients currently do is no different than what pppd does (with
> usepeerdns), and it's basically out-of-the-box simplicity, it just
> works, though granted that it doesn't cater for advanced uses.
> That pppd doesn't give DNS information to ip-up scripts, at least for
> me, a bug, the information should be available. It's likely upstream
> won't fix/change this since it would alter established behaviour and
> hence breaks scripts.
> So what's the solution to the sucky /etc/resolv.conf mess?
> Well, openresolv (http://roy.marples.name/projects/openresolv/index).
> I've mentioned it in IRC before but didn't have time to create the
> package and glue it together seamlessly with the other packages (mostly
> ppp, dhcp clients and so on).
> Regards.
> 

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] pppd makefile moves /etc/PPP/resolv.conf
  2015-01-26 13:27   ` Lee Essen
@ 2015-01-26 14:09     ` Gustavo Zacarias
  2015-01-26 15:52       ` Lee Essen
  0 siblings, 1 reply; 6+ messages in thread
From: Gustavo Zacarias @ 2015-01-26 14:09 UTC (permalink / raw)
  To: buildroot

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] pppd makefile moves /etc/PPP/resolv.conf
  2015-01-26 14:09     ` Gustavo Zacarias
@ 2015-01-26 15:52       ` Lee Essen
  2015-01-26 16:07         ` Gustavo Zacarias
  0 siblings, 1 reply; 6+ messages in thread
From: Lee Essen @ 2015-01-26 15:52 UTC (permalink / raw)
  To: buildroot


> 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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] pppd makefile moves /etc/PPP/resolv.conf
  2015-01-26 15:52       ` Lee Essen
@ 2015-01-26 16:07         ` Gustavo Zacarias
  0 siblings, 0 replies; 6+ messages in thread
From: Gustavo Zacarias @ 2015-01-26 16:07 UTC (permalink / raw)
  To: buildroot

On 01/26/2015 12:52 PM, Lee Essen wrote:
> 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.

If upstream is fine with that so are we.
Normally we don't take feature patches, hence if upstream rejects it
then it must be the other solution (script it).
Bear in mind that when adding support for openresolv we must script it
anyway since it's not supposed to get anything written into
/etc/resolv.conf except for itself (via the resolvconf tool, which is
also fed the DNS entries for each interface).
Regards.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-26 16:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2015-01-26 16:07         ` Gustavo Zacarias

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.