mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 22:19:23 +01:00
netdev: Track SET_INTERFACE events
And set the interface type based on the event rather than the command callback. This allows us to track interface type changes even if they come from outside iwd (which shouldn't happen.)
This commit is contained in:
parent
d42549e46d
commit
7a2719f314
47
src/netdev.c
47
src/netdev.c
@ -4873,6 +4873,43 @@ static int netdev_cqm_rssi_update(struct netdev *netdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void netdev_set_interface_event(struct l_genl_msg *msg,
|
||||||
|
struct netdev *netdev)
|
||||||
|
{
|
||||||
|
uint32_t iftype;
|
||||||
|
|
||||||
|
if (nl80211_parse_attrs(msg, NL80211_ATTR_IFTYPE, &iftype,
|
||||||
|
NL80211_ATTR_UNSPEC) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (iftype == netdev->type)
|
||||||
|
return;
|
||||||
|
|
||||||
|
l_debug("Interface type changed from %s to %s",
|
||||||
|
netdev_iftype_to_string(netdev->type),
|
||||||
|
netdev_iftype_to_string(iftype));
|
||||||
|
netdev->type = iftype;
|
||||||
|
|
||||||
|
/* Set RSSI threshold for CQM notifications */
|
||||||
|
if (netdev->type == NL80211_IFTYPE_STATION)
|
||||||
|
netdev_cqm_rssi_update(netdev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void netdev_config_notify(struct l_genl_msg *msg, void *user_data)
|
||||||
|
{
|
||||||
|
struct netdev *netdev;
|
||||||
|
|
||||||
|
netdev = netdev_from_message(msg);
|
||||||
|
if (!netdev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (l_genl_msg_get_command(msg)) {
|
||||||
|
case NL80211_CMD_SET_INTERFACE:
|
||||||
|
netdev_set_interface_event(msg, netdev);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static struct l_genl_msg *netdev_build_cmd_set_interface(struct netdev *netdev,
|
static struct l_genl_msg *netdev_build_cmd_set_interface(struct netdev *netdev,
|
||||||
uint32_t iftype)
|
uint32_t iftype)
|
||||||
{
|
{
|
||||||
@ -4933,12 +4970,6 @@ static void netdev_set_iftype_cb(struct l_genl_msg *msg, void *user_data)
|
|||||||
if (error != 0)
|
if (error != 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
netdev->type = req->pending_type;
|
|
||||||
|
|
||||||
/* Set RSSI threshold for CQM notifications */
|
|
||||||
if (netdev->type == NL80211_IFTYPE_STATION)
|
|
||||||
netdev_cqm_rssi_update(netdev);
|
|
||||||
|
|
||||||
/* If the netdev was down originally, we're done */
|
/* If the netdev was down originally, we're done */
|
||||||
if (!req->bring_up)
|
if (!req->bring_up)
|
||||||
goto done;
|
goto done;
|
||||||
@ -5641,6 +5672,10 @@ static int netdev_init(void)
|
|||||||
NULL, NULL))
|
NULL, NULL))
|
||||||
l_error("Registering for scan notifications failed");
|
l_error("Registering for scan notifications failed");
|
||||||
|
|
||||||
|
if (!l_genl_family_register(nl80211, "config", netdev_config_notify,
|
||||||
|
NULL, NULL))
|
||||||
|
l_error("Registering for config notifications failed");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail_netlink:
|
fail_netlink:
|
||||||
|
Loading…
Reference in New Issue
Block a user