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

netdev: ensure proper iftype on connect/disconnect

Now that the device mode can be changed, netdev must check that
the iftype is correct before starting a connection or disconnecting.
netdev_connect, netdev_connect_wsc, and netdev_disconnect now check
that the iftype is station before continuing.
This commit is contained in:
James Prestwood 2018-07-17 14:15:58 -07:00 committed by Denis Kenzior
parent 515985afed
commit e10d79b53f

View File

@ -2331,6 +2331,9 @@ int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
struct eapol_sm *sm = NULL;
bool is_rsn = hs->own_ie != NULL;
if (netdev->type != NL80211_IFTYPE_STATION)
return -ENOTSUP;
if (netdev->connected)
return -EISCONN;
@ -2360,6 +2363,9 @@ int netdev_connect_wsc(struct netdev *netdev, struct scan_bss *bss,
size_t ie_len;
struct eapol_sm *sm;
if (netdev->type != NL80211_IFTYPE_STATION)
return -ENOTSUP;
if (netdev->connected)
return -EISCONN;
@ -2400,6 +2406,9 @@ int netdev_disconnect(struct netdev *netdev,
{
struct l_genl_msg *disconnect;
if (netdev->type != NL80211_IFTYPE_STATION)
return -ENOTSUP;
if (!netdev->connected)
return -ENOTCONN;