diff options
| author | Jeremy Bicha <jeremy.bicha@canonical.com> | 2022-08-18 08:31:29 -0400 |
|---|---|---|
| committer | Jeremy Bicha <jeremy.bicha@canonical.com> | 2022-08-18 08:31:29 -0400 |
| commit | b0887dd4d035acc0d84aa859748d36891548eaaf (patch) | |
| tree | c4dc0dae50954f3c8fb600aa9e7cfaabeb80deb0 /src/core/supplicant/nm-supplicant-interface.c | |
| parent | 1a62dcfdc0470be37743914da69fe0b0677c6bfb (diff) | |
| parent | 4741f1a52215c7ba466140912084d6906185bef3 (diff) | |
Merge branch 'debian/master' into ubuntu/master
Diffstat (limited to 'src/core/supplicant/nm-supplicant-interface.c')
| -rw-r--r-- | src/core/supplicant/nm-supplicant-interface.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/core/supplicant/nm-supplicant-interface.c b/src/core/supplicant/nm-supplicant-interface.c index e502ae85..fa8b4e37 100644 --- a/src/core/supplicant/nm-supplicant-interface.c +++ b/src/core/supplicant/nm-supplicant-interface.c @@ -21,6 +21,7 @@ #include "nm-supplicant-manager.h" #define DBUS_TIMEOUT_MSEC 20000 +#define PMK_LIFETIME_SEC (3600 * 24 * 7) /*****************************************************************************/ @@ -1249,6 +1250,7 @@ parse_capabilities(NMSupplicantInterface *self, GVariant *capabilities) break; } } + g_free(array); } priv->iface_capabilities = NM_SUPPL_CAP_MASK_SET(priv->iface_capabilities, @@ -2451,6 +2453,32 @@ assoc_set_ap_scan_cb(GVariant *ret, GError *error, gpointer user_data) add_network(self); } +static void +assoc_set_pmk_lifetime(GVariant *ret, GError *error, gpointer user_data) +{ + NMSupplicantInterface *self; + NMSupplicantInterfacePrivate *priv; + + if (nm_utils_error_is_cancelled(error)) + return; + + self = NM_SUPPLICANT_INTERFACE(user_data); + priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE(self); + + if (error) { + assoc_return(self, error, "failure to set PMK lifetime"); + return; + } + + _LOGT("assoc[" NM_HASH_OBFUSCATE_PTR_FMT "]: interface PMK lifetime set to %u", + NM_HASH_OBFUSCATE_PTR(priv->assoc_data), + PMK_LIFETIME_SEC); + + nm_assert(priv->assoc_data->calls_left > 0); + if (--priv->assoc_data->calls_left == 0) + add_network(self); +} + static gboolean assoc_fail_on_idle_cb(gpointer user_data) { @@ -2534,6 +2562,21 @@ nm_supplicant_interface_assoc(NMSupplicantInterface *self, assoc_set_ap_scan_cb, self); + /* Set the PMK lifetime to a longer interval (1 week) instead of + * the default one (12 hours) that would trigger a WPA-EAP + * reauthentication after only 8:24 hours (70% of the lifetime). */ + assoc_data->calls_left++; + nm_dbus_connection_call_set(priv->dbus_connection, + priv->name_owner->str, + priv->object_path->str, + NM_WPAS_DBUS_IFACE_INTERFACE, + "Dot11RSNAConfigPMKLifetime", + g_variant_new_take_string(g_strdup_printf("%u", PMK_LIFETIME_SEC)), + DBUS_TIMEOUT_MSEC, + assoc_data->cancellable, + assoc_set_pmk_lifetime, + self); + ap_isolation = nm_supplicant_config_get_ap_isolation(priv->assoc_data->cfg); if (!priv->ap_isolate_supported) { if (ap_isolation) { @@ -3131,7 +3174,7 @@ _signal_handle(NMSupplicantInterface *self, _set_p2p_assigned_addr(iface, addr_data, - nm_utils_ip4_netmask_to_prefix(netmask)); + _nm_utils_ip4_netmask_to_prefix(netmask)); } else { _LOGW("P2P: GroupStarted signaled invalid IP Address information"); } |