commit 1d29221ef0a3d8d130f26bb07f05a726f0a58af1
parent cd47834d6ccd73dff8e579801ab076b3cb080416
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Mon, 21 Oct 2019 15:55:02 +0200
netdev: Extend checks for P2P scenarios
Extend the iftype-based checks to handle the P2P iftypes and remove a
warning that may be triggered in normal situations in the P2P scenarios.
Diffstat:
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -1467,12 +1467,14 @@ void netdev_handshake_failed(struct handshake_state *hs, uint16_t reason_code)
switch (netdev->type) {
case NL80211_IFTYPE_STATION:
+ case NL80211_IFTYPE_P2P_CLIENT:
msg = netdev_build_cmd_disconnect(netdev, reason_code);
netdev->disconnect_cmd_id = l_genl_family_send(nl80211, msg,
netdev_disconnect_cb,
netdev, NULL);
break;
case NL80211_IFTYPE_AP:
+ case NL80211_IFTYPE_P2P_GO:
msg = netdev_build_cmd_del_station(netdev, nhs->super.spa,
reason_code, false);
if (!l_genl_family_send(nl80211, msg, NULL, NULL, NULL))
@@ -2462,7 +2464,8 @@ int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
struct eapol_sm *sm = NULL;
bool is_rsn = hs->supplicant_ie != NULL;
- if (netdev->type != NL80211_IFTYPE_STATION)
+ if (netdev->type != NL80211_IFTYPE_STATION &&
+ netdev->type != NL80211_IFTYPE_P2P_CLIENT)
return -ENOTSUP;
if (netdev->connected)
@@ -2518,7 +2521,8 @@ 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)
+ if (netdev->type != NL80211_IFTYPE_STATION &&
+ netdev->type != NL80211_IFTYPE_P2P_CLIENT)
return -ENOTSUP;
if (netdev->connected)
@@ -2561,7 +2565,8 @@ int netdev_disconnect(struct netdev *netdev,
{
struct l_genl_msg *disconnect;
- if (netdev->type != NL80211_IFTYPE_STATION)
+ if (netdev->type != NL80211_IFTYPE_STATION &&
+ netdev->type != NL80211_IFTYPE_P2P_CLIENT)
return -ENOTSUP;
if (!netdev->connected)
@@ -3438,10 +3443,8 @@ static void netdev_mlme_notify(struct l_genl_msg *msg, void *user_data)
}
}
- if (!netdev) {
- l_warn("MLME notification is missing ifindex attribute");
+ if (!netdev)
return;
- }
switch (cmd) {
case NL80211_CMD_AUTHENTICATE:
@@ -4363,6 +4366,11 @@ static void netdev_getlink_cb(int error, uint16_t type, const void *data,
netdev_newlink_notify(ifi, bytes);
+ /* Don't do anything automatically for P2P interfaces */
+ if (netdev->type == NL80211_IFTYPE_P2P_CLIENT ||
+ netdev->type == NL80211_IFTYPE_P2P_GO)
+ return;
+
/*
* If the interface is UP, reset it to ensure a clean state.
* Otherwise, if we need to set a random mac, do so. If not, just