3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 05:39:24 +01:00

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.
This commit is contained in:
Andrew Zaborowski 2019-10-21 15:55:02 +02:00 committed by Denis Kenzior
parent cd47834d6c
commit 1d29221ef0

View File

@ -1467,12 +1467,14 @@ void netdev_handshake_failed(struct handshake_state *hs, uint16_t reason_code)
switch (netdev->type) { switch (netdev->type) {
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_P2P_CLIENT:
msg = netdev_build_cmd_disconnect(netdev, reason_code); msg = netdev_build_cmd_disconnect(netdev, reason_code);
netdev->disconnect_cmd_id = l_genl_family_send(nl80211, msg, netdev->disconnect_cmd_id = l_genl_family_send(nl80211, msg,
netdev_disconnect_cb, netdev_disconnect_cb,
netdev, NULL); netdev, NULL);
break; break;
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
msg = netdev_build_cmd_del_station(netdev, nhs->super.spa, msg = netdev_build_cmd_del_station(netdev, nhs->super.spa,
reason_code, false); reason_code, false);
if (!l_genl_family_send(nl80211, msg, NULL, NULL, NULL)) 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; struct eapol_sm *sm = NULL;
bool is_rsn = hs->supplicant_ie != 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; return -ENOTSUP;
if (netdev->connected) if (netdev->connected)
@ -2518,7 +2521,8 @@ int netdev_connect_wsc(struct netdev *netdev, struct scan_bss *bss,
size_t ie_len; size_t ie_len;
struct eapol_sm *sm; struct eapol_sm *sm;
if (netdev->type != NL80211_IFTYPE_STATION) if (netdev->type != NL80211_IFTYPE_STATION &&
netdev->type != NL80211_IFTYPE_P2P_CLIENT)
return -ENOTSUP; return -ENOTSUP;
if (netdev->connected) if (netdev->connected)
@ -2561,7 +2565,8 @@ int netdev_disconnect(struct netdev *netdev,
{ {
struct l_genl_msg *disconnect; 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; return -ENOTSUP;
if (!netdev->connected) if (!netdev->connected)
@ -3438,10 +3443,8 @@ static void netdev_mlme_notify(struct l_genl_msg *msg, void *user_data)
} }
} }
if (!netdev) { if (!netdev)
l_warn("MLME notification is missing ifindex attribute");
return; return;
}
switch (cmd) { switch (cmd) {
case NL80211_CMD_AUTHENTICATE: 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); 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. * 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 * Otherwise, if we need to set a random mac, do so. If not, just