/* Register the PSM with L2CAP */
if (transport == BT_TRANSPORT_BR_EDR) {
- p_ccb->psm = L2CA_Register(psm, &conn.reg_info, false /* enable_snoop */,
- &p_ccb->ertm_info, L2CAP_MTU_SIZE);
+ p_ccb->psm = L2CA_Register2(psm, &conn.reg_info, false /* enable_snoop */,
+ &p_ccb->ertm_info, L2CAP_MTU_SIZE, security);
if (p_ccb->psm == 0) {
LOG(ERROR) << StringPrintf("%s: Failure registering PSM 0x%04x", __func__,
psm);
}
if (transport == BT_TRANSPORT_LE) {
- p_ccb->psm = L2CA_RegisterLECoc(psm, (tL2CAP_APPL_INFO*)&conn.reg_info);
+ p_ccb->psm =
+ L2CA_RegisterLECoc(psm, (tL2CAP_APPL_INFO*)&conn.reg_info, security);
if (p_ccb->psm == 0) {
LOG(ERROR) << StringPrintf("%s: Failure registering PSM 0x%04x", __func__,
psm);
}
}
- /* Register with Security Manager for the specific security level */
- if (!BTM_SetSecurityLevel((uint8_t)!is_server, p_serv_name, p_ccb->service_id,
- security, p_ccb->psm, 0, 0)) {
- LOG(ERROR) << "GAP_CONN - Security Error";
- gap_release_ccb(p_ccb);
- return (GAP_INVALID_HANDLE);
- }
-
/* optional FCR channel modes */
if (ertm_info != NULL) {
p_ccb->ertm_info.allowed_modes =
/* Check if L2CAP started the connection process */
if (p_rem_bda && (transport == BT_TRANSPORT_BR_EDR)) {
- cid = L2CA_ErtmConnectReq(p_ccb->psm, *p_rem_bda, &p_ccb->ertm_info);
+ cid = L2CA_ErtmConnectReq2(p_ccb->psm, *p_rem_bda, &p_ccb->ertm_info,
+ security);
if (cid != 0) {
p_ccb->connection_id = cid;
return (p_ccb->gap_handle);
}
if (p_rem_bda && (transport == BT_TRANSPORT_LE)) {
- cid = L2CA_ConnectLECocReq(p_ccb->psm, *p_rem_bda, &p_ccb->local_coc_cfg);
+ cid = L2CA_ConnectLECocReq(p_ccb->psm, *p_rem_bda, &p_ccb->local_coc_cfg,
+ security);
if (cid != 0) {
p_ccb->connection_id = cid;
return (p_ccb->gap_handle);
* and BTM_SetSecurityLevel().
*
******************************************************************************/
-extern uint16_t L2CA_RegisterLECoc(uint16_t psm, tL2CAP_APPL_INFO* p_cb_info);
+extern uint16_t L2CA_RegisterLECoc(uint16_t psm, tL2CAP_APPL_INFO* p_cb_info,
+ uint16_t sec_level);
/*******************************************************************************
*
*
******************************************************************************/
extern uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
- tL2CAP_LE_CFG_INFO* p_cfg);
+ tL2CAP_LE_CFG_INFO* p_cfg,
+ uint16_t sec_level);
/*******************************************************************************
*
* and L2CA_DeregisterLECoc()
*
******************************************************************************/
-uint16_t L2CA_RegisterLECoc(uint16_t psm, tL2CAP_APPL_INFO* p_cb_info) {
+uint16_t L2CA_RegisterLECoc(uint16_t psm, tL2CAP_APPL_INFO* p_cb_info,
+ uint16_t sec_level) {
if (bluetooth::shim::is_gd_shim_enabled()) {
return bluetooth::shim::L2CA_RegisterLECoc(psm, p_cb_info);
}
+ BTM_SetSecurityLevel(false, "", 0, sec_level, psm, 0, 0);
L2CAP_TRACE_API("%s called for LE PSM: 0x%04x", __func__, psm);
/* Verify that the required callback info has been filled in
*
******************************************************************************/
uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
- tL2CAP_LE_CFG_INFO* p_cfg) {
+ tL2CAP_LE_CFG_INFO* p_cfg, uint16_t sec_level) {
if (bluetooth::shim::is_gd_shim_enabled()) {
return bluetooth::shim::L2CA_ConnectLECocReq(psm, p_bd_addr, p_cfg);
}
+ BTM_SetSecurityLevel(true, "", 0, sec_level, psm, 0, 0);
+
VLOG(1) << __func__ << " BDA: " << p_bd_addr
<< StringPrintf(" PSM: 0x%04x", psm);