Skip to content

[th/nmcli-import-wg-dnssearch] nmcli: fix import WireGuard profile with DNS domain and address family disabled

Thomas Haller requested to merge th/nmcli-import-wg-dnssearch into main

In NetworkManager, a profile cannot have "ipvx.dns" or "ipvx.dns-search" while the corresponding IP method is disabled. Together with the oddity that in NetworkManager DNS settings are separate per IPv4 and IPv6, this causes problems:

  $ cat wg0.conf
  [Interface]
  PrivateKey = CBXpiLxQ98TLISJ2cypEFtQb/djzYzENyy0jzhWa/UA=
  Address = 192.168.1.100
  DNS = 10.11.12.13, foobar.de

  [Peer]
  PublicKey = Wus1sBzZiQkyxr6ZitUFNvfYD7KJkwTsWlcxvJ/4SHI=
  Endpoint = 1.2.3.4:51827
  AllowedIPs = 0.0.0.0/0

  $ nmcli connection import type wireguard file wg0.conf
  Error: failed to import 'wg0.conf': Failed to create WireGuard connection: ipv6.dns-search: this property is not allowed for 'method=disabled'.

#832 (closed)

Merge request reports