hfp/goep_client/avdtp/a2dp: return SDP_SERVICE_NOT_FOUND if no suitable SDP record is found

This commit is contained in:
Matthias Ringwald 2020-12-14 11:39:43 +01:00
parent 8580489cbd
commit cc92f22bee
4 changed files with 16 additions and 15 deletions

View File

@ -16,6 +16,9 @@ HFP AG/HSP AG: avoid connecting to remote service with same role
### Fixed
L2CAP: fix packet size check for incoming classic basic channels (regression introduced in v1.2.1)
### Changed
HFP/GOEP Client/AVDTP/A2DP: return `SDP_SERVICE_NOT_FOUND` if no suitable SDP record is found
## Release v1.2.1
### Fixed

View File

@ -623,12 +623,8 @@ static void avdtp_handle_sdp_client_query_result(uint8_t packet_type, uint16_t c
case SDP_EVENT_QUERY_COMPLETE:
status = sdp_event_query_complete_get_status(packet);
if (status != ERROR_CODE_SUCCESS) break;
if (!connection->sink_supported) {
status = ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
break;
}
if (connection->avdtp_l2cap_psm == 0) {
status = ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
if (!connection->sink_supported || (connection->avdtp_l2cap_psm == 0)) {
status = SDP_SERVICE_NOT_FOUND;
break;
}
break;
@ -645,12 +641,8 @@ static void avdtp_handle_sdp_client_query_result(uint8_t packet_type, uint16_t c
case SDP_EVENT_QUERY_COMPLETE:
status = sdp_event_query_complete_get_status(packet);
if (status != ERROR_CODE_SUCCESS) break;
if (!connection->source_supported) {
status = ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
break;
}
if (connection->avdtp_l2cap_psm == 0) {
status = ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
if (!connection->source_supported || (connection->avdtp_l2cap_psm == 0)) {
status = SDP_SERVICE_NOT_FOUND;
break;
}
break;
@ -666,6 +658,7 @@ static void avdtp_handle_sdp_client_query_result(uint8_t packet_type, uint16_t c
avdtp_handle_sdp_client_query_attribute_value(connection, packet);
return;
case SDP_EVENT_QUERY_COMPLETE:
// without suitable SDP Record, avdtp version v0.0 is assumed
status = sdp_event_query_complete_get_status(packet);
break;
default:

View File

@ -326,7 +326,7 @@ static void goep_client_handle_sdp_query_event(uint8_t packet_type, uint16_t cha
if ((context->rfcomm_port == 0) && (context->l2cap_psm == 0)){
log_info("No GOEP RFCOMM or L2CAP server found");
context->state = GOEP_INIT;
goep_client_emit_connected_event(goep_client, ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE);
goep_client_emit_connected_event(goep_client, SDP_SERVICE_NOT_FOUND);
break;
}
#ifdef ENABLE_GOEP_L2CAP

View File

@ -612,8 +612,13 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint16_t channel, uin
} else {
hfp_connection->state = HFP_IDLE;
hfp_emit_slc_connection_event(hfp_connection, sdp_event_query_complete_get_status(packet), HCI_CON_HANDLE_INVALID, hfp_connection->remote_addr);
log_info("rfcomm service not found, status 0x%02x", sdp_event_query_complete_get_status(packet));
uint8_t status = sdp_event_query_complete_get_status(packet);
if (status == ERROR_CODE_SUCCESS){
// report service not found
status = SDP_SERVICE_NOT_FOUND;
}
hfp_emit_slc_connection_event(hfp_connection, status, HCI_CON_HANDLE_INVALID, hfp_connection->remote_addr);
log_info("rfcomm service not found, status 0x%02x", status);
}
// register the SDP Query request to check if there is another connection waiting for the query