BLE 인증 전 NUS 명령 실행 방지
- GAP 연결 시 PROD 모드에서 ble_connection_st 조기 활성화 제거(보안 인증 후 활성화) - nus_data_handler()에 인증 상태 검증 가드 추가(ble_connection_st가 0인 경우 받지 않고 즉시 리턴)
This commit is contained in:
@@ -573,6 +573,11 @@ static void nus_data_handler(ble_nus_evt_t * p_evt)
|
||||
{
|
||||
if (p_evt->type == BLE_NUS_EVT_RX_DATA)
|
||||
{
|
||||
if (!ble_connection_st)
|
||||
{
|
||||
return; /* Reject command before security is established */
|
||||
}
|
||||
|
||||
cmd_type_t = CMD_BLE;
|
||||
ble_got_new_data = true;
|
||||
|
||||
@@ -1048,11 +1053,14 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_CONNECTED:
|
||||
DBG_PRINTF("[BLE] Connected\r\n");
|
||||
DBG_PRINTF("[BLE] GAP Connected\r\n");
|
||||
|
||||
#if FEATURE_SECURE_CONNECTION
|
||||
ble_connection_st = 1;
|
||||
battery_timer_start();
|
||||
if (BLE_DEV_MODE)
|
||||
{
|
||||
ble_connection_st = 1;
|
||||
battery_timer_start();
|
||||
}
|
||||
#endif
|
||||
|
||||
m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
|
||||
|
||||
Reference in New Issue
Block a user