[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
Hi,
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.
Thanks.
--
[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
resolvconf/downup-interfaces:
resolvconf/reboot-recommended-after-removal:
-------------- 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
or
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
address 138.197.98.102/20
gateway 138.197.96.1
dns-nameservers 8.8.8.8
dns-iface-name public0
iface eth0 inet static
address 10.17.0.11/16
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 ;;
-esac
+if [ -n "${IF_DNS_IFACE_NAME}" ]; then
+ IFACE_NAME="${IF_DNS_IFACE_NAME}"
+else
+ case "$ADDRFAM" in
+ inet|inet6) : ;;
+ *) exit 0 ;;
+ esac
+ IFACE_NAME="${IFACE}.${ADDRFAM}"
+fi
R=""
if [ "$IF_DNS_DOMAIN" ] ; then
@@ -43,5 +48,5 @@ for OPT in $IF_DNS_NAMESERVER ; do
done
IFS="$STANDARD_IFS"
-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
;;
esac
-/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
"
fi
-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 ;;
-esac
+if [ -n "${IF_DNS_IFACE_NAME}" ]; then
+ IFACE_NAME="${IF_DNS_IFACE_NAME}"
+else
+ case "$ADDRFAM" in
+ inet|inet6) : ;;
+ *) exit 0 ;;
+ esac
+ IFACE_NAME="${IFACE}.${ADDRFAM}"
+fi
-/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.
.PP
+The
+.B dns-iface-name
+option controls what interface name will be given to resolvconf
+when it is invoked by the
+.IR ifup.d
+or
+.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.
+.PP
The
.B dns\-domain
option is deprecated in favor of
@@ -130,6 +141,7 @@ The resulting stanza might look like the following example.
dns\-nameserver 192.168.1.254
dns\-nameserver 8.8.8.8
dns\-search foo.org bar.com
+ dns\-iface\-name eth0.foobar
.EE
.PP
N.B.: On a machine where resolvconf
More information about the Resolvconf-devel
mailing list