commit e10d79b53fecb7ef39613468e25741c669beeb91
parent 515985afed746eae567b6e2ca92854abf69c6287
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Tue, 17 Jul 2018 14:15:58 -0700
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.
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -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;