Re: Using openresolv with udhcpc?
Roy Marples
Wed Jul 17 12:09:35 2019
Hi Einar
On 17/07/2019 11:19, Einar Jón wrote:
Hi Roy
This mostly works for me. I do need extra stuff to make resolv.conf
run, but given the files below, my resolv.conf looks like this:
# Generated by resolvconf
nameserver 3.3.3.3 # /etc/resolvconf/resolv.conf.d/head
search xxxxxx.com
nameserver 192.168.2.xx
nameserver 62.140.138.233
nameserver 62.140.140.251
nameserver 8.8.8.8
nameserver 2.2.2.2 # /etc/resolvconf/resolv.conf.d/tail
Bugs:
1) Comments are still weird.
- Stripped in /var/run/resolvconf/interfaces/*.udhcpc files
- Untouched in /etc/resolvconf/resolv.conf.d/head and tail
The head and tail files are added verbatim - not processed at all.
However, the resolv.conf files added to resolfconf are not stripped exactly.
$ resolvconf -l
# resolv.conf from foo
nameserver 8.8.8.8 #This is a comment
But they ARE stripped when sent to the subscribers. You can see this here:
$ resolvconf -v
DOMAIN=''
SEARCH=''
NAMESERVERS='8.8.8.8'
LOCALNAMESERVERS=''
DOMAINS=''
There are many reasons for this, but the most prevalent is this - what
do we write if more than one entry has a comment?
$ resolvconf -l
# resolv.conf from foo
nameserver 8.8.8.8 #This is a comment
# resolv.conf from bar
nameserver 8.8.8.8 #This is a different comment
Which comment should be written to /etc/resolv.conf for the single
nameserver entry from different sources?
- "#text" and "#" is skipped in dns-nameservers lines of
/etc/network/interfaces, but the rest is added as a nameserver
2) the last one means that I can't have a space after the # in
dns-nameservers 8.8.8.8 #/etc/network/interfaces.d/wwan0
Or I will get a separate
nameserver /etc/network/interfaces.d/wwan0
Also " dns-nameservers 8.8.8.8 #This is a comment" throws away "#This", but adds
nameserver 8.8.8.8
nameserver is
nameserver a
nameserver comment
What shell exactly is /bin/sh for you?
I tested my fix with recent versions of dash, bash, BSD sh and it seems
to work fine?
Not bugs, but extra steps needed for this to work:
3) I need to create the /var/run/resolvconf/interfaces/*.udhcpc files
myself (in a /usr/share/udhcpc/default.script.d/resolvconf) script
You're supposed to pipe the resolv.conf file it would have made to
resolvconf. The Gentoo netifrc pacakge has a good udhcpc script here:
https://github.com/gentoo/netifrc/blob/master/sh/udhcpc-hook.sh.in
4) I need to borrow the /etc/network/if-down.d/resolvconf
/etc/network/if-up.d/000resolvconf files from the ubuntu package.
It's possible that the comment bug you are seeing is here.
What is the output of:
resolvconf -l
Roy
Archive administrator: postmaster@marples.name