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:

committed by
Thomas Haller

parent
6c3174f6e0
commit
6ea0cd1300
@@ -3442,8 +3442,6 @@ typedef struct {
|
||||
|
||||
int is_handling;
|
||||
} delayed_action;
|
||||
|
||||
int wireguard_family_id;
|
||||
} NMLinuxPlatformPrivate;
|
||||
|
||||
struct _NMLinuxPlatform {
|
||||
@@ -6524,10 +6522,10 @@ _wireguard_get_link_properties (NMPlatform *platform, const NMPlatformLink *link
|
||||
};
|
||||
guint i, j;
|
||||
|
||||
if (!priv->wireguard_family_id)
|
||||
priv->wireguard_family_id = _support_genl_family (priv->genl, "wireguard");
|
||||
if (!obj->_link.wireguard_family_id)
|
||||
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);
|
||||
goto err;
|
||||
}
|
||||
@@ -6536,7 +6534,7 @@ _wireguard_get_link_properties (NMPlatform *platform, const NMPlatformLink *link
|
||||
if (!msg)
|
||||
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))
|
||||
goto err;
|
||||
|
||||
|
Reference in New Issue
Block a user