BLE 보안 실패 시 자동 재페어링 및 버그 3건 수정
- 앱과 기기 사이 키가 불일치하는 경우 새로운 키 생성 요청(재페어링 허용) - main.c: PM_EVT_CONN_SEC_CONFIG_REQ 중복 핸들러 제거 - main.c: DEV 모드에서 pm_peers_delete() 이중 호출 방지 - main.c: 활성 연결 중 advertising 재시작 방지(m_conn_handle 체크) - ble_quick_security: 보안 실패 시 bond 삭제 + 자동 재페어링 시도 - ble_quick_security: allow_repairing = true (항상 재페어링 허용)
This commit is contained in:
@@ -126,15 +126,23 @@ void ble_security_quick_pm_handler(pm_evt_t const *p_evt)
|
||||
pm_handler_disconnect_on_sec_failure(p_evt);
|
||||
}
|
||||
} else {
|
||||
// 기타 보안 실패 → disconnect
|
||||
pm_handler_disconnect_on_sec_failure(p_evt);
|
||||
// 기타 보안 실패 → bond 삭제 후 재페어링 시도
|
||||
pm_peer_id_t peer_id;
|
||||
if (pm_peer_id_get(p_evt->conn_handle, &peer_id) == NRF_SUCCESS
|
||||
&& peer_id != PM_PEER_ID_INVALID) {
|
||||
pm_peer_delete(peer_id);
|
||||
}
|
||||
err_code = pm_conn_secure(p_evt->conn_handle, true);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
pm_handler_disconnect_on_sec_failure(p_evt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_EVT_CONN_SEC_CONFIG_REQ:
|
||||
{
|
||||
pm_conn_sec_config_t config = {
|
||||
.allow_repairing = m_state.dev_mode
|
||||
.allow_repairing = true
|
||||
};
|
||||
pm_conn_sec_config_reply(p_evt->conn_handle, &config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user