platform: put wireguard_family_id in NMPObjectLink

Limit the lifetime of the cached genl family ID to the lifetime of the
interface so we correctly handle module reloads.

https://github.com/NetworkManager/NetworkManager/pull/161
This commit is contained in:
Javier Arteaga
2018-07-01 15:13:25 +02:00
committed by Thomas Haller
parent 6c3174f6e0
commit 6ea0cd1300
2 changed files with 6 additions and 6 deletions

View File

@@ -3442,8 +3442,6 @@ typedef struct {
int is_handling; int is_handling;
} delayed_action; } delayed_action;
int wireguard_family_id;
} NMLinuxPlatformPrivate; } NMLinuxPlatformPrivate;
struct _NMLinuxPlatform { struct _NMLinuxPlatform {
@@ -6524,10 +6522,10 @@ _wireguard_get_link_properties (NMPlatform *platform, const NMPlatformLink *link
}; };
guint i, j; guint i, j;
if (!priv->wireguard_family_id) if (!obj->_link.wireguard_family_id)
priv->wireguard_family_id = _support_genl_family (priv->genl, "wireguard"); obj->_link.wireguard_family_id = _support_genl_family (priv->genl, "wireguard");
if (!priv->wireguard_family_id) { if (!obj->_link.wireguard_family_id) {
_LOGD ("wireguard: kernel support not available for wireguard link %s", link->name); _LOGD ("wireguard: kernel support not available for wireguard link %s", link->name);
goto err; goto err;
} }
@@ -6536,7 +6534,7 @@ _wireguard_get_link_properties (NMPlatform *platform, const NMPlatformLink *link
if (!msg) if (!msg)
goto err; goto err;
if (!genlmsg_put (msg, NL_AUTO_PORT, NL_AUTO_SEQ, priv->wireguard_family_id, if (!genlmsg_put (msg, NL_AUTO_PORT, NL_AUTO_SEQ, obj->_link.wireguard_family_id,
0, NLM_F_DUMP, WG_CMD_GET_DEVICE, 1)) 0, NLM_F_DUMP, WG_CMD_GET_DEVICE, 1))
goto err; goto err;

View File

@@ -167,6 +167,8 @@ typedef struct {
/* Auxiliary data object for Wi-Fi and WPAN */ /* Auxiliary data object for Wi-Fi and WPAN */
GObject *ext_data; GObject *ext_data;
int wireguard_family_id;
} NMPObjectLink; } NMPObjectLink;
typedef struct { typedef struct {