mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 02:19:26 +01:00
core: Add sanity check to sync RTNL link deletion with nl80211
This commit is contained in:
parent
46b9f4a0a8
commit
b7a421673c
@ -30,6 +30,7 @@
|
||||
#include <net/if.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include "src/wiphy.h"
|
||||
#include "src/netdev.h"
|
||||
|
||||
struct netdev_data {
|
||||
@ -92,6 +93,8 @@ static void dellink_notify(const struct ifinfomsg *ifi, int bytes)
|
||||
struct netdev_data *netdev;
|
||||
uint32_t index = ifi->ifi_index;
|
||||
|
||||
wiphy_notify_dellink(index);
|
||||
|
||||
netdev = l_hashmap_remove(netdev_list, L_UINT_TO_PTR(index));
|
||||
if (!netdev)
|
||||
return;
|
||||
|
22
src/wiphy.c
22
src/wiphy.c
@ -443,3 +443,25 @@ bool wiphy_exit(void)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void wiphy_check_dellink(void *data, void *user_data)
|
||||
{
|
||||
uint32_t index = L_PTR_TO_UINT(user_data);
|
||||
struct wiphy *wiphy = data;
|
||||
struct netdev *netdev;
|
||||
|
||||
netdev = l_queue_remove_if(wiphy->netdev_list, netdev_match,
|
||||
L_UINT_TO_PTR(index));
|
||||
if (netdev) {
|
||||
l_warn("Removing leftover interface %s", netdev->name);
|
||||
netdev_free(netdev);
|
||||
}
|
||||
}
|
||||
|
||||
void wiphy_notify_dellink(uint32_t index)
|
||||
{
|
||||
if (!wiphy_list)
|
||||
return;
|
||||
|
||||
l_queue_foreach(wiphy_list, wiphy_check_dellink, L_UINT_TO_PTR(index));
|
||||
}
|
||||
|
@ -20,7 +20,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
bool wiphy_init(void);
|
||||
bool wiphy_exit(void);
|
||||
|
||||
void wiphy_notify_dellink(uint32_t index);
|
||||
|
Loading…
Reference in New Issue
Block a user