[Buildroot] [PATCH] pppd: Do not overwrite /etc/resolv.conf

Arnout Vandecappelle arnout at mind.be
Mon Aug 28 20:28:08 UTC 2017



On 28-08-17 17:56, Jeroen Roovers wrote:
> With option usepeerdns, pppd by default writes to /etc/ppp/resolv.conf,
> which is not very useful and might be impossible. However, when more
> than one interface can be used for DNS resolution, pppd will overwrite
> any existing entries when /etc/resolv.conf is used instead, which is
> bad. 

 I agree that this is bad.

> Fix this by setting the path to a place we assume is always
> writeable, /tmp/ppp-resolv.conf, and which does not interfere with other
> mechanisms that write DNS resolver configurations.

 However, this is a regression. People who currently have ppp as their only
interface, or who never have ppp and ethernet running at the same time,
currently have a fully working solution. With this change, DNS doesn't work
anymore over ppp unless you add some script to merge /tmp/ppp-resolv.conf with
/tmp/resolv.conf

 So I think this patch should be combined with a /etc/ppp/ip-up (and ip-down)
script that updates /etc/resolv.conf, similar like how udhcpc.script does it.

 I guess you must have something like that anyway, otherwise you would never
have DNS over ppp, right?

 Regards,
 Arnout

> ---
>  package/pppd/pppd.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/pppd/pppd.mk b/package/pppd/pppd.mk
> index 6139c5b085..47937730d5 100644
> --- a/package/pppd/pppd.mk
> +++ b/package/pppd/pppd.mk
> @@ -36,10 +36,10 @@ PPPD_POST_EXTRACT_HOOKS += PPPD_DROP_INTERNAL_IF_PPOL2TP_H
>  
>  # pppd defaults to /etc/ppp/resolv.conf, which not be writable and is
>  # definitely not useful since the C library only uses
> -# /etc/resolv.conf. Therefore, we change pppd to use /etc/resolv.conf
> +# /etc/resolv.conf. Therefore, we change pppd to use /tmp/ppp-resolv.conf
>  # instead.
>  define PPPD_SET_RESOLV_CONF
> -	$(SED) 's,ppp/resolv.conf,resolv.conf,' $(@D)/pppd/pathnames.h
> +	$(SED) 's,/etc/ppp/resolv.conf,/tmp/ppp-resolv.conf,' $(@D)/pppd/pathnames.h
>  endef
>  PPPD_POST_EXTRACT_HOOKS += PPPD_SET_RESOLV_CONF
>  
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF



More information about the buildroot mailing list