[Resolvconf-devel] Bug#783596: /sbin/resolvconf: Re: /e/n/i dns-* option only works in last of homonymous iface def'ns

Scott Moser smoser at ubuntu.com
Tue Apr 11 19:59:05 UTC 2017

Package: resolvconf
Version: 1.79ubuntu4
Followup-For: Bug #783596

We've hit this bug in Ubuntu and it was filed under bug 1675571 [1].

The solution that I've come up with is to allow the author of /e/n/i to
provide a name for each interface definition stanza in the setting
dns-iface-name.  If that is set, it will be used instead of 'inet' or
'inet6' as the 'PROG' portion of 'resolvconf -a IFACE.PROG' when
invoking resolvconf.

The patch is attached, and I have a Ubuntu review up at [2].  I'm
interested in upstream/debian feedback.


[1] https://bugs.launchpad.net/debian/+source/resolvconf/+bug/1675571
[2] https://code.launchpad.net/~smoser/ubuntu/+source/resolvconf/+git/resolvconf/+merge/321203

-- System Information:
Debian Release: stretch/sid
  APT prefers zesty-updates
  APT policy: (500, 'zesty-updates'), (500, 'zesty-security'), (500, 'zesty')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-15-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages resolvconf depends on:
ii  debconf [debconf-2.0]  1.5.59ubuntu1
ii  ifupdown               0.8.16ubuntu1
ii  init-system-helpers    1.47
ii  lsb-base               9.20160110ubuntu5

resolvconf recommends no packages.

resolvconf suggests no packages.

-- debconf information:
  resolvconf/linkify-resolvconf: true
  resolvconf/link-tail-to-original: false
-------------- next part --------------
commit 4c6b3e659ee1148bdcb36a29414487a11253ee04 (HEAD -> lpusip/debian/sid)
Author: Scott Moser <smoser at brickies.net>
Date:   Tue Mar 28 12:41:27 2017 -0400

    allow setting of program name via dns-iface-name option in interfaces(5).
    When ifupdown has multiple addresses for a given interface, integration
    with resolvconf is broken.  This is because resolvconf is called for each
    stanza, but the scripts in /etc/network/if-*.d/ invoke
      resolvconf -a IFACE.PROG
      resolvconf -d IFACE.PROG
    with IFACE being the interface name, and PROG set to ADDRFAM, where
    ADDRFAM is only 'inet' or 'inet6'.
    The solution here is to allow the author of interfaces(5) to provide
    the program name via option 'dns-iface-name'.
    As an example:
     auto eth0
     iface eth0 inet static
        dns-iface-name public0
     iface eth0 inet static
        dns-iface-name local
    LP: #1675571

diff --git a/debian/resolvconf.000resolvconf.if-up b/debian/resolvconf.000resolvconf.if-up
index f799371..498c97e 100755
--- a/debian/resolvconf.000resolvconf.if-up
+++ b/debian/resolvconf.000resolvconf.if-up
@@ -7,10 +7,15 @@
 [ -x /sbin/resolvconf ] || exit 0
-case "$ADDRFAM" in
-  inet|inet6) : ;;
-  *) exit 0 ;;
+if [ -n "${IF_DNS_IFACE_NAME}" ]; then
+  case "$ADDRFAM" in
+    inet|inet6) : ;;
+    *) exit 0 ;;
+  esac
 if [ "$IF_DNS_DOMAIN" ] ; then
@@ -43,5 +48,5 @@ for OPT in $IF_DNS_NAMESERVER ; do
-echo -n "$R" | /sbin/resolvconf -a "${IFACE}.${ADDRFAM}" || :
+echo -n "$R" | /sbin/resolvconf -a "${IFACE_NAME}" || :
diff --git a/debian/resolvconf.000resolvconf.ppp.ip-down b/debian/resolvconf.000resolvconf.ppp.ip-down
index 561ef41..a0458fd 100755
--- a/debian/resolvconf.000resolvconf.ppp.ip-down
+++ b/debian/resolvconf.000resolvconf.ppp.ip-down
@@ -17,5 +17,5 @@ case "$6" in
-/sbin/resolvconf -d "${PPP_IFACE}.pppd"
+/sbin/resolvconf -d "${IF_DNS_IFACE_NAME:-${PPP_IFACE}.pppd}"
diff --git a/debian/resolvconf.000resolvconf.ppp.ip-up b/debian/resolvconf.000resolvconf.ppp.ip-up
index c83ea18..5090123 100755
--- a/debian/resolvconf.000resolvconf.ppp.ip-up
+++ b/debian/resolvconf.000resolvconf.ppp.ip-up
@@ -29,5 +29,5 @@ if [ "$DNS2" ] ; then
-echo -n "$R" | /sbin/resolvconf -a "${PPP_IFACE}.pppd"
+echo -n "$R" | /sbin/resolvconf -a "${IF_DNS_IFACE_NAME:-${PPP_IFACE}.pppd}"
diff --git a/debian/resolvconf.resolvconf.if-down b/debian/resolvconf.resolvconf.if-down
index 66e3a9f..1883261 100755
--- a/debian/resolvconf.resolvconf.if-down
+++ b/debian/resolvconf.resolvconf.if-down
@@ -7,10 +7,15 @@
 [ -x /sbin/resolvconf ] || exit 0
-case "$ADDRFAM" in
-  inet|inet6) :      ;;
-  *)          exit 0 ;;
+if [ -n "${IF_DNS_IFACE_NAME}" ]; then
+  case "$ADDRFAM" in
+    inet|inet6) :      ;;
+    *)          exit 0 ;;
+  esac
-/sbin/resolvconf -d "${IFACE}.${ADDRFAM}" || :
+/sbin/resolvconf -d "${IFACE_NAME}" || :
diff --git a/man/resolvconf.8 b/man/resolvconf.8
index cbdb6b1..5813e2a 100644
--- a/man/resolvconf.8
+++ b/man/resolvconf.8
@@ -114,6 +114,17 @@ option is also accepted and, unlike
 can be given multiple arguments,
 separated by spaces.
+.B dns-iface-name
+option controls what interface name will be given to resolvconf
+when it is invoked by the
+.IR ifup.d
+.IR ifdown.d
+scripts.  No value is required.  The default depends
+on how the device is configured.  This is useful if you have multiple
+addresses configured for a single device with separate stanzas.
 .B dns\-domain
 option is deprecated in favor of
@@ -130,6 +141,7 @@ The resulting stanza might look like the following example.
         dns\-search foo.org bar.com
+        dns\-iface\-name eth0.foobar
 N.B.: On a machine where resolvconf

More information about the Resolvconf-devel mailing list