mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 05:10:09 +01:00
We use the filename of the imported .conf file for "connection.interface-name".
That follows what `wg-quick` does.
However, we also validate that the interface name is valid UTF-8
(otherwise -- as it currently is -- the setting couldn't be send via
D-Bus). As such, we have stricter requirements.
We want to fail early and tell the user when the filename is unsuitable.
Failing later gives a worse user experience, because the failure message
about invalid "connection.interface-name" wouldn't make it clear that
the filename is wrong.
Use the appropriate function to validate "connection.interface-name".
Before:
$ touch $'./a\344b.conf'
$ nmcli connection import type wireguard file $'./a\344b.conf'
Error: failed to import './a?b.conf': Failed to create WireGuard connection: connection.interface-name: 'a?b': interface name must be UTF-8 encoded.
Now:
$ nmcli connection import type wireguard file $'./a\344b.conf'
Error: failed to import './a?b.conf': The name of the WireGuard config must be a valid interface name followed by ".conf".
|
||
|---|---|---|
| .. | ||
| tests | ||
| meson.build | ||
| nm-client-utils.c | ||
| nm-client-utils.h | ||
| nm-meta-setting-access.c | ||
| nm-meta-setting-access.h | ||
| nm-meta-setting-desc.c | ||
| nm-meta-setting-desc.h | ||
| nm-polkit-listener.c | ||
| nm-polkit-listener.h | ||
| nm-secret-agent-simple.c | ||
| nm-secret-agent-simple.h | ||
| nm-vpn-helpers.c | ||
| nm-vpn-helpers.h | ||
| qrcodegen.c | ||
| qrcodegen.h | ||
| settings-docs.h.in | ||
| settings-docs.xsl | ||