wifi-utils: don't cache interface name
For nl80211, we don't care about the interface name and only use it when formatting error messages. For wext, an up-to-date interface name should be obtained every time to minimize the chance of race conditions when the interface is renamed.
This commit is contained in:
@@ -5503,34 +5503,17 @@ wifi_get_wifi_data (NMPlatform *platform, int ifindex)
|
||||
wifi_data = g_hash_table_lookup (priv->wifi_data, GINT_TO_POINTER (ifindex));
|
||||
pllink = nm_platform_link_get (platform, ifindex);
|
||||
|
||||
/* @wifi_data contains an interface name which is used for WEXT queries. If
|
||||
* the interface name changes we should at least replace the name in the
|
||||
* existing structure; but probably a complete reinitialization is better
|
||||
* because during the initial creation there can be race conditions while
|
||||
* the interface is renamed by udev.
|
||||
*/
|
||||
if (wifi_data && pllink) {
|
||||
if (!nm_streq (wifi_utils_get_iface (wifi_data), pllink->name)) {
|
||||
_LOGD ("wifi: interface %s renamed to %s, dropping old data for ifindex %d",
|
||||
wifi_utils_get_iface (wifi_data),
|
||||
pllink->name,
|
||||
ifindex);
|
||||
g_hash_table_remove (priv->wifi_data, GINT_TO_POINTER (ifindex));
|
||||
wifi_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!wifi_data) {
|
||||
if (pllink) {
|
||||
if (pllink->type == NM_LINK_TYPE_WIFI)
|
||||
wifi_data = wifi_utils_init (pllink->name, ifindex, TRUE);
|
||||
wifi_data = wifi_utils_init (ifindex, TRUE);
|
||||
else if (pllink->type == NM_LINK_TYPE_OLPC_MESH) {
|
||||
/* The kernel driver now uses nl80211, but we force use of WEXT because
|
||||
* the cfg80211 interactions are not quite ready to support access to
|
||||
* mesh control through nl80211 just yet.
|
||||
*/
|
||||
#if HAVE_WEXT
|
||||
wifi_data = wifi_wext_init (pllink->name, ifindex, FALSE);
|
||||
wifi_data = wifi_wext_init (ifindex, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user