openresolv-discuss

Re: Using openresolv with udhcpc?

Roy Marples

Tue Jul 09 14:17:08 2019

Hi Einar

On 08/07/2019 13:33, Einar Jón wrote:
Hello

I just discovered openresolv, and I'm trying to get resolvconf to work
with udhcpc

Openresolv doesn't seem to like the format udhcpc uses:
$ cat /etc/resolv.conf
search xxxxxxxx.com # eth0
nameserver 192.168.2.xx # eth0
nameserver 62.140.1xx.xx # wwan0
nameserver 62.140.1xx.xx # wwan0
----
WIth this:comments at the end of a line become a "nameserver #" and
:"nameserver eth0":

This silly little script below seems to work, if I also add resolvconf
scripts to
/etc/network/if-up.d and /etc/network/if-down.d/
But I find it silly to write /etc/resolv.conf twice in a non-atomic
way. (first udhcpc and then resolvconf)
What is the recommended approach? I'd like to keep
/usr/share/udhcpc/default.script as is, if possible...

$ cat  /usr/share/udhcpc/default.script.d/resolvconf
#!/bin/bash

# Make udhcpc changes to resolv.conf readable for resolvconf

[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_DIR=/var/run/resolvconf/interfaces/

case "$1" in
     renew|bound)
         mkdir -p $RESOLV_DIR
         grep $interface /etc/resolv.conf | sed -e "s/#.*//"   >
$RESOLV_DIR/$interface.udhcpc
         ;;
esac

exit 0

This should be fixed here:
https://roy.marples.name/cgit/openresolv.git/commit/?id=e39a20cdc3c55993120714dd50cd201b70dbc4b3

Can you test that please? If it works, I'll make a new release.

Roy

Follow-Ups:
Re: Using openresolv with udhcpc?Einar Jón
References:
Using openresolv with udhcpc?Einar Jón
Archive administrator: postmaster@marples.name