cli/wireguard: add import functionality for WireGuard

Support importing ".conf" files as `wg-quick up` supports it.

`wg-quick` parses several options under "[Interface]" and
passes the remainder to `wg setconf`.

The PreUp/PreDown/PostUp/PostDown options are of course not supported.

"Table" for the moment behaves different.

(cherry picked from commit a3a8583c31)
This commit is contained in:
Thomas Haller
2019-02-28 14:22:35 +01:00
parent 0d178a968d
commit a6ee43d1c1
6 changed files with 598 additions and 17 deletions

View File

@@ -672,6 +672,8 @@ nm_utils_parse_inaddr_prefix_bin (int addr_family,
return FALSE;
if (slash) {
/* For IPv4, `ip addr add` supports the prefix-length as a netmask. We don't
* do that. */
prefix = _nm_utils_ascii_str_to_int64 (slash + 1, 10,
0,
addr_family == AF_INET ? 32 : 128,