3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 11:52:34 +01:00

netdev: React to removed netdevs

This commit is contained in:
Denis Kenzior 2016-07-01 14:49:34 -05:00
parent 0cffac45d4
commit e421af2a58

View File

@ -1115,6 +1115,18 @@ static void netdev_newlink_notify(const struct ifinfomsg *ifi, int bytes)
l_queue_foreach(netdev->watches, netdev_watch_notify, netdev);
}
static void netdev_dellink_notify(const struct ifinfomsg *ifi, int bytes)
{
struct netdev *netdev;
netdev = l_queue_remove_if(netdev_list, netdev_match,
L_UINT_TO_PTR(ifi->ifi_index));
if (!netdev)
return;
netdev_free(netdev);
}
static void netdev_getlink_cb(int error, uint16_t type, const void *data,
uint32_t len, void *user_data)
{
@ -1355,6 +1367,9 @@ static void netdev_link_notify(uint16_t type, const void *data, uint32_t len,
case RTM_NEWLINK:
netdev_newlink_notify(ifi, bytes);
break;
case RTM_DELLINK:
netdev_dellink_notify(ifi, bytes);
break;
}
}