Package: openresolv
Version: 3.8.0-1
Severity: normal

The documentation for the -m options says:

  Set the metric of the interface when adding it, default of 0.  Lower metrics 
take precedence.

However, if you assign any metric to an interface, it will actually take
precedence over any interface which doesn't have a metric defined and isn't
in the interface_order or dynamic_order. Hence, the default metric is
actually one more than 9999999. For example:

# /sbin/resolvconf -i
lo.unbound wlan0

# cat myvpn_resolvconf | /sbin/resolvconf -m 99 -a myvpn
 
# /sbin/resolvconf -i
lo.unbound myvpn wlan0

# find /run/resolvconf/ -type f
/run/resolvconf/interfaces/myvpn
/run/resolvconf/interfaces/lo.unbound
/run/resolvconf/interfaces/wlan0
/run/resolvconf/metrics/0000099 myvpn

I'm attaching a trivial patch that fixes this behaviour.

-- System Information:
Debian Release: 9.6
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 
'proposed-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-0.bpo.1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_CA.utf8, LC_CTYPE=en_CA.utf8 (charmap=UTF-8), LANGUAGE=en_CA:en 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
--- /sbin/resolvconf    2016-04-20 13:30:01.000000000 -0600
+++ resolvconf  2018-11-12 17:04:16.296605415 -0700
@@ -404,13 +404,15 @@
                                fi
                        done
                done
+               for i in *; do
+                       [ ! -e "$METRICDIR/"*" $i" ] && list="$list $i"
+               done
                if [ -d "$METRICDIR" ]; then
                        cd "$METRICDIR"
                        for i in *; do
                                [ -f "$i" ] && list="$list ${i#* }"
                        done
                fi
-               list="$list *"
        fi
 
        cd "$IFACEDIR"

Reply via email to