** Also affects: resolvconf (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Also affects: wireguard (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Also affects: resolvconf (Ubuntu Plucky)
   Importance: Undecided
       Status: New

** Also affects: wireguard (Ubuntu Plucky)
   Importance: Undecided
       Status: New

** Changed in: wireguard (Ubuntu Noble)
       Status: New => Incomplete

** Changed in: wireguard (Ubuntu)
       Status: Incomplete => Fix Committed

** Changed in: wireguard (Ubuntu)
     Assignee: (unassigned) => Lukas Märdian (slyon)

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to resolvconf in Ubuntu.
https://bugs.launchpad.net/bugs/2119260

Title:
  Bug: resolvconf_iface_prefix returns incorrect prefix for all
  interfaces

Status in resolvconf package in Ubuntu:
  Invalid
Status in wireguard package in Ubuntu:
  Fix Committed
Status in resolvconf source package in Noble:
  New
Status in wireguard source package in Noble:
  Incomplete
Status in resolvconf source package in Plucky:
  New
Status in wireguard source package in Plucky:
  New

Bug description:
  ### systemd version the issue has been seen with

  systemd 255 (255.4-1ubuntu8.10)

  ### Used distribution

  Ubuntu Desktop 24.03

  ### Linux kernel version used

  6.8.0-71-generic

  ### CPU architectures issue was seen on

  x86_64

  ### Component

  resolvectl

  ### Expected behaviour you didn't see

  WG should work even with DNS set

  ### Unexpected behaviour you saw

  The `resolvconf_iface_prefix()` function in wg-quick returns the first
  matching pattern from `/etc/resolvconf/interface-order` without
  checking if the interface actually matches that pattern.

  ## Current broken code:

  ```bash
  resolvconf_iface_prefix() {
      [[ -f /etc/resolvconf/interface-order ]] || return 0
      local iface
      while read -r iface; do
          [[ $iface =~ ^([A-Za-z0-9-]+)\*$ ]] || continue
          echo "${BASH_REMATCH[1]}." && return 0
      done < /etc/resolvconf/interface-order
  }
  ````

  ## Impact

  Returns "tun." for ALL interfaces when "tun*" is in interface-order
  Causes DNS setup to fail for WireGuard interfaces
  Affects any interface that doesn't match early patterns

  ### Steps to reproduce the problem

  1. Run WG with DNS set

  ### Additional program output to the terminal or log subsystem
  illustrating the issue

  **Proposed fix**

  ```sh
  resolvconf_iface_prefix() {
      [[ -f /etc/resolvconf/interface-order ]] || return 0
      local iface
      while read -r iface; do
          [[ $iface =~ ^#.*$ ]] && continue
          if [[ $iface =~ ^([A-Za-z0-9-]+)\*$ ]]; then
              local prefix="${BASH_REMATCH[1]}"
              if [[ $INTERFACE == ${prefix}* ]]; then
                  echo "${prefix}."
                  return 0
              fi
          elif [[ $INTERFACE =~ $iface ]]; then
              echo "$iface/"
              return 0
          fi
      done < /etc/resolvconf/interface-order
  }
  ```
   
  Also added wg* to `/etc/resolvconf/interface-order`

  ```
  # interface-order(5)
  lo.inet6
  lo.inet
  lo.@(dnsmasq|pdnsd)
  lo.!(pdns|pdns-recursor)
  lo
  tun*
  tap*
  hso*
  vpn*
  em+([0-9])?(_+([0-9]))*
  p+([0-9])p+([0-9])?(_+([0-9]))*
  en+([bcosxpP])*([^.]).inet6
  en+([bcosxpP])*([^.]).ip6.@(dhclient|dhcpcd|pump|udhcpc)
  en+([bcosxpP])*([^.]).inet
  en+([bcosxpP])*([^.]).@(dhclient|dhcpcd|pump|udhcpc)
  en+([bcosxpP])*
  @(br|eth)*([^.]).inet6
  @(br|eth)*([^.]).ip6.@(dhclient|dhcpcd|pump|udhcpc)
  @(br|eth)*([^.]).inet
  @(br|eth)*([^.]).@(dhclient|dhcpcd|pump|udhcpc)
  @(br|eth)*
  wl+([bcosxpP])*([^.]).inet6
  wl+([bcosxpP])*([^.]).ip6.@(dhclient|dhcpcd|pump|udhcpc)
  wl+([bcosxpP])*([^.]).inet
  wl+([bcosxpP])*([^.]).@(dhclient|dhcpcd|pump|udhcpc)
  wl+([bcosxpP])*
  @(ath|wifi|wlan)*([^.]).inet6
  @(ath|wifi|wlan)*([^.]).ip6.@(dhclient|dhcpcd|pump|udhcpc)
  @(ath|wifi|wlan)*([^.]).inet
  @(ath|wifi|wlan)*([^.]).@(dhclient|dhcpcd|pump|udhcpc)
  @(ath|wifi|wlan)*
  ppp*
  wg* <----------------------
  *
  ```

  ProblemType: Bug
  DistroRelease: Ubuntu 24.04
  Package: wireguard-tools 1.0.20210914-1ubuntu4 [modified: usr/bin/wg-quick]
  ProcVersionSignature: Ubuntu 6.8.0-71.71-generic 6.8.12
  Uname: Linux 6.8.0-71-generic x86_64
  NonfreeKernelModules: zfs
  ApportVersion: 2.28.1-0ubuntu3.8
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Fri Aug  1 00:48:34 2025
  InstallationDate: Installed on 2022-05-05 (1183 days ago)
  InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - Release amd64 
(20220419)
  SourcePackage: wireguard
  UpgradeStatus: Upgraded to noble on 2025-07-17 (14 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/2119260/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to