p2p: Stop discovery after GO Negotiation Req error

If we were in discovery only to be able to receive the target peer's
GO Negotiation Request (i.e. we have no users requesting discovery)
and we've received the frame and decided that the connection has
failed, exit discovery.
This commit is contained in:
Andrew Zaborowski 2020-07-11 03:00:36 +02:00 committed by Denis Kenzior
parent 5f7b28d501
commit 122ea7a8aa
1 changed files with 16 additions and 0 deletions

View File

@ -1403,6 +1403,10 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu,
l_error("GO Negotiation Request parse error %s (%i)",
strerror(-r), -r);
p2p_connect_failed(dev);
if (l_queue_isempty(dev->discovery_users))
p2p_device_discovery_stop(dev);
status = P2P_STATUS_FAIL_INVALID_PARAMS;
goto respond;
}
@ -1420,6 +1424,10 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu,
}
p2p_connect_failed(dev);
if (l_queue_isempty(dev->discovery_users))
p2p_device_discovery_stop(dev);
status = P2P_STATUS_FAIL_INCOMPATIBLE_PARAMS;
goto p2p_free;
}
@ -1435,6 +1443,10 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu,
p2p_connect_failed(dev);
l_error("Persistent groups not supported");
if (l_queue_isempty(dev->discovery_users))
p2p_device_discovery_stop(dev);
status = P2P_STATUS_FAIL_INCOMPATIBLE_PARAMS;
goto p2p_free;
}
@ -1442,6 +1454,10 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu,
if (req_info.device_password_id != dev->conn_password_id) {
p2p_connect_failed(dev);
l_error("Incompatible Password ID in the GO Negotiation Req");
if (l_queue_isempty(dev->discovery_users))
p2p_device_discovery_stop(dev);
status = P2P_STATUS_FAIL_INCOMPATIBLE_PROVISIONING;
goto p2p_free;
}