Re: [RFC PATCH 2/2] platform: add support for WireGuard links



On Wed, 2018-03-14 at 00:03 +0000, Javier Arteaga wrote:
Add support for a new wireguard link type to the platform code. For
now
this only covers querying existing links via Generic Netlink and
parsing
them into platform objects.
---
+
+static NMPObject *
+_parse_lnk_wireguard (const char *kind, const char *ifname)
+{
+     nm_auto_nmpobj NMPObject *obj = NULL;
+     NMPObject *obj_result = NULL;
+     struct nl_sock *sock;
+     nm_auto_nlmsg struct nl_msg *msg = NULL;
+     struct nl_cb cb = {
+             .valid_cb = _wireguard_parse_getdevice,
+     };
+     static int family_id;

Hi,

all the "parsing" done here is basically requesting/querying everyhing
via genl.

It would be really nice, to only request new data when necessary, and
otherwise keep the current from the cache.

But how to notice changes?

Maybe the wireguard netlink API should expose a version id both on rtnl
and genl. Then, if we receive a new (different) version id on rtnl, we
know we need to refetch everything.

Or does the wireguard API already provide some functionality about
this? Should we instead register to signals on genl? That would be
doable, but cumbersome.


best,
Thomas

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]