NetworkManager/src/libnm-client-aux-extern
Beniamino Galvani b4dde691ec nmcli: add support for managing wireguard peers
Even if WireGuard is supported since long time in NetworkManager, it
is still not possible to manage the list of peers via nmcli. The
reason is that in the past we wanted to introduce a special syntax
that would allow to manage the peer list more easily. However, this
requires heavy changes to the nmcli output formatting code, and so it
never happened.

Since perfection is the enemy of good, abandon the idea of a custom
handling of peers and treat them as any other composite property. The
property is named "wireguard.peers" and exposes the peers indexed by
public key, with optional attributes.

Example:

  $ nmcli connection modify wg0 wireguard.peers "8Wgc1a0jJX3rQULwD5NFFLKrKQnbOnTiaNoerLneG1o= preshared-key=16uGwZvROnwyNGoW6Z3pvJB5GKbd6ncYROA/FFleLQA= allowed-ips=0.0.0.0/0 persistent-keepalive=10"
  $ nmcli connection modify wg0 +wireguard.peers "fd2NSxUjkaR/Jft15+gpXU13hKSyZLoe4cp+g+feBCc= allowed-ips=192.168.40.0/24 endpoint=172.25.10.1:8888"
  $ nmcli -g wireguard.peers connection show wg0
  8Wgc1a0jJX3rQULwD5NFFLKrKQnbOnTiaNoerLneG1o= allowed-ips=0.0.0.0/0 persistent-keepalive=10, fd2NSxUjkaR/Jft15+gpXU13hKSyZLoe4cp+g+feBCc= allowed-ips=192.168.40.0/24 endpoint=172.25.10.1\:8888
  $ nmcli connection modify wg0 -wireguard.peers 8Wgc1a0jJX3rQULwD5NFFLKrKQnbOnTiaNoerLneG1o=
  $ nmcli -g wireguard.peers connection show wg0
  fd2NSxUjkaR/Jft15+gpXU13hKSyZLoe4cp+g+feBCc= allowed-ips=192.168.40.0/24 endpoint=172.25.10.1\:8888
2025-06-16 13:20:02 +02:00
..
tests nmcli: add support for managing wireguard peers 2025-06-16 13:20:02 +02:00
meson.build build/meson: cleanup libnm-client-aux-extern 2021-02-28 18:56:08 +01:00
nm-default-client.h build: move "libnm/" to "src/" and split it 2021-02-24 12:48:37 +01:00
nm-libnm-aux.c libnmc: fix bug checking VersionInfo's capabilities 2024-12-11 15:52:09 +00:00
nm-libnm-aux.h libnm: add internal nmc_client_has_{version_info_v,version_info_capability,capability}() helper 2022-12-14 17:33:56 +01:00
README.md all: add some README.md files describing the purpose of our sources 2021-08-19 17:51:11 +02:00

libnm-client-aux-extern

libnm-client-aux-extern is a static library that:

  • uses the public parts of "libnm"
  • that can also be statically linked into other users of libnm.

Basically, it is a static library with utility functions that extends libnm.

That means:

  • you can use it everywhere where you dynamically link with libnm.

Also, since libnm-client-aux-extern itself only uses public (stable) API of libnm, you theoretically can copy the sources into your own source tree.

This makes it very similar in purpose to ../libnmc-base/. The difference might be that this one is smaller and that you could easier copy+paste this to a libnm application outside this source tree.