Part 1
요약·해설
LPN·Friend polling, RPL 보안과 wear 절충, 전용 settings workqueue와 LE 공존 identity를 설명합니다.
LPN · Friend
RPL
Settings
BT_ID_DEFAULT
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
30F40D16F8E22EF70F94FA8EEEB8FB134640A5F59F5B4D2F54BA145B6EE03A2A
.. _bluetooth_mesh_core:
Core
####
The core provides functionality for managing the general Bluetooth Mesh
state.
.. _bluetooth_mesh_lpn:
Low Power Node
**************
The Low Power Node (LPN) role allows battery powered devices to participate in
a mesh network as a leaf node. An LPN interacts with the mesh network through
a Friend node, which is responsible for relaying any messages directed to the
LPN. The LPN saves power by keeping its radio turned off, and only wakes up to
either send messages or poll the Friend node for any incoming messages.
The radio control and polling is managed automatically by the mesh stack, but
the LPN API allows the application to trigger the polling at any time through
:c:func:`bt_mesh_lpn_poll`. The LPN operation parameters, including poll
interval, poll event timing and Friend requirements is controlled through the
:kconfig:option:`CONFIG_BT_MESH_LOW_POWER` option and related configuration options.
When using the LPN feature with logging, it is strongly recommended to only use
the :kconfig:option:`CONFIG_LOG_MODE_DEFERRED` option. Log modes other than the
deferred may cause unintended delays during processing of log messages. This in
turns will affect scheduling of the receive delay and receive window. The same
limitation applies for the :kconfig:option:`CONFIG_BT_MESH_FRIEND` option.
Replay Protection List
**********************
The Replay Protection List (RPL) is used to hold recently received sequence
numbers from elements within the mesh network to perform protection against
replay attacks.
To keep a node protected against replay attacks after reboot, it needs to store
the entire RPL in the persistent storage before it is powered off. Depending on
the amount of traffic in a mesh network, storing recently seen sequence numbers
can make flash wear out sooner or later. To mitigate this,
:kconfig:option:`CONFIG_BT_MESH_RPL_STORE_TIMEOUT` can be used. This option postpones
storing of RPL entries in the persistent storage.
This option, however, doesn't completely solve the issue as the node may
get powered off before the timer to store the RPL is fired. To ensure that
messages can not be replayed, the node can initiate storage of the pending
RPL entry (or entries) at any time (or sufficiently before power loss)
by calling :c:func:`bt_mesh_rpl_pending_store`. This is up to the node to decide,
which RPL entries are to be stored in this case.
Setting :kconfig:option:`CONFIG_BT_MESH_RPL_STORE_TIMEOUT` to -1 allows to completely
switch off the timer, which can help to significantly reduce flash wear out.
This moves the responsibility of storing RPL to the user application and
requires that sufficient power backup is available from the time this API
is called until all RPL entries are written to the flash.
Finding the right balance between :kconfig:option:`CONFIG_BT_MESH_RPL_STORE_TIMEOUT` and
calling :c:func:`bt_mesh_rpl_pending_store` may reduce a risk of security
vulnerability and flash wear out.
.. warning:
Failing to enable :kconfig:option:`CONFIG_BT_SETTINGS`, or setting
:kconfig:option:`CONFIG_BT_MESH_RPL_STORE_TIMEOUT` to -1 and not storing
the RPL between reboots, will make the device vulnerable to replay attacks
and not perform the replay protection required by the spec.
.. _bluetooth_mesh_persistent_storage:
Persistent storage
******************
The mesh stack uses the :ref:`Settings Subsystem <settings_api>` for storing the
device configuration persistently. When the stack configuration changes and
the change needs to be stored persistently, the stack schedules a work item.
The delay between scheduling the work item and submitting it to the workqueue
is defined by the :kconfig:option:`CONFIG_BT_MESH_STORE_TIMEOUT` option. Once
storing of data is scheduled, it can not be rescheduled until the work item is
processed. Exceptions are made in certain cases as described below.
When IV index, Sequence Number or CDB configuration have to be stored, the work
item is submitted to the workqueue without the delay. If the work item was
previously scheduled, it will be rescheduled without the delay.
The Replay Protection List uses the same work item to store RPL entries. If
storing of RPL entries is requested and no other configuration is pending to be
stored, the delay is set to :kconfig:option:`CONFIG_BT_MESH_RPL_STORE_TIMEOUT`.
If other stack configuration has to be stored, the delay defined by
the :kconfig:option:`CONFIG_BT_MESH_STORE_TIMEOUT` option is less than
:kconfig:option:`CONFIG_BT_MESH_RPL_STORE_TIMEOUT`, and the work item was
scheduled by the Replay Protection List, the work item will be rescheduled.
When the work item is running, the stack will store all pending configuration,
including the RPL entries.
Work item execution context
===========================
The :kconfig:option:`CONFIG_BT_MESH_SETTINGS_WORKQ` option configures the
context from which the work item is executed. This option is enabled by
default, and results in stack using a dedicated cooperative thread to
process the work item. This allows the stack to process other incoming and
outgoing messages, as well as other work items submitted to the system
workqueue, while the stack configuration is being stored.
When this option is disabled, the work item is submitted to the system workqueue.
This means that the system workqueue is blocked for the time it takes to store
the stack's configuration. It is not recommended to disable this option as this
will make the device non-responsive for a noticeable amount of time.
.. _bluetooth_mesh_adv_identity:
Advertisement identity
**********************
All mesh stack bearers advertise data with the :c:macro:`BT_ID_DEFAULT` local identity.
The value is preset in the mesh stack implementation. When Bluetooth® Low Energy (LE)
and Bluetooth Mesh coexist on the same device, the application should allocate and
configure another local identity for Bluetooth LE purposes before starting the communication.
API reference
**************
.. doxygengroup:: bt_mesh
Part 3
한국어 전문 번역
Bluetooth Mesh Core
Core API는 Bluetooth Mesh의 전반적인 상태를 관리하는 기능을 제공합니다.
Low Power Node
Low Power Node(LPN) role은 battery로 구동하는 device가 mesh network의 leaf node로 참여하도록 합니다. LPN은 자신에게 향한 message를 relay하는 Friend node를 통해 mesh network와 상호작용합니다.
LPN은 대부분의 시간에 radio를 끄고 message를 보내거나 incoming message가 있는지 Friend node를 poll할 때만 깨어나 전력을 절약합니다.
Radio 제어와 polling은 mesh stack이 자동으로 관리합니다. Application은 필요할 때 bt_mesh_lpn_poll을 호출해 즉시 polling을 trigger할 수 있습니다. Poll interval, poll event timing과 Friend 요구사항을 포함한 LPN 동작 parameter는 CONFIG_BT_MESH_LOW_POWER 및 관련 configuration option으로 제어합니다.
Logging mode 제약
LPN 기능과 logging을 함께 사용할 때는 CONFIG_LOG_MODE_DEFERRED만 사용하는 것을 강하게 권장합니다. Deferred가 아닌 log mode는 log message 처리 중 의도하지 않은 지연을 만들 수 있고 receive delay와 receive window scheduling에 영향을 줍니다. 같은 제약은 CONFIG_BT_MESH_FRIEND에도 적용됩니다.
Replay Protection List
Replay Protection List(RPL)는 mesh network의 element에서 최근 받은 sequence number를 보관해 replay attack을 방지합니다.
Reboot 이후에도 replay attack을 막으려면 전원을 끄기 전에 RPL 전체를 persistent storage에 저장해야 합니다. Mesh traffic 양에 따라 최근 sequence number를 자주 저장하면 flash가 더 빨리 마모될 수 있습니다. CONFIG_BT_MESH_RPL_STORE_TIMEOUT은 RPL entry의 persistent storage 기록을 지연해 이를 완화합니다.
하지만 저장 timer가 실행되기 전에 전원이 꺼질 수 있으므로 timeout만으로 문제를 완전히 해결하지는 못합니다. Node는 전원 손실보다 충분히 앞서 bt_mesh_rpl_pending_store를 호출해 pending RPL entry를 저장할 수 있습니다. 이때 어떤 RPL entry를 저장할지는 node가 결정합니다.
CONFIG_BT_MESH_RPL_STORE_TIMEOUT을 -1로 설정하면 timer를 완전히 끌 수 있어 flash wear를 크게 줄일 수 있습니다. 대신 RPL 저장 책임이 application으로 이동합니다. API 호출 시점부터 모든 RPL entry가 flash에 기록될 때까지 충분한 backup power를 확보해야 합니다.
CONFIG_BT_MESH_RPL_STORE_TIMEOUT 값과 bt_mesh_rpl_pending_store 호출 시점을 적절히 조합하면 security vulnerability와 flash wear 위험을 함께 줄일 수 있습니다.
Persistent storage
Mesh stack은 Settings Subsystem으로 device configuration을 영구 저장합니다. Stack configuration이 바뀌어 persistent storage에 기록해야 하면 work item을 예약합니다. Work item 예약부터 workqueue 제출까지의 지연은 CONFIG_BT_MESH_STORE_TIMEOUT으로 정합니다. 한 번 저장이 예약되면 work item이 처리될 때까지 다시 예약할 수 없지만 아래의 일부 경우는 예외입니다.
즉시 저장하는 상태
IV index, Sequence Number 또는 CDB configuration을 저장해야 하면 work item을 지연 없이 workqueue에 제출합니다. Work item이 이전에 예약되어 있었다면 지연 없는 실행으로 다시 예약합니다.
RPL과 공용 work item
RPL도 같은 work item으로 entry를 저장합니다. 다른 pending configuration이 없을 때 RPL 저장을 요청하면 delay를 CONFIG_BT_MESH_RPL_STORE_TIMEOUT으로 설정합니다.
저장해야 할 다른 stack configuration이 있고 CONFIG_BT_MESH_STORE_TIMEOUT이 CONFIG_BT_MESH_RPL_STORE_TIMEOUT보다 짧으며 현재 work item이 RPL에 의해 예약된 경우 work item을 다시 예약합니다. Work item이 실행될 때 stack은 RPL entry를 포함한 모든 pending configuration을 저장합니다.
Work item 실행 context
CONFIG_BT_MESH_SETTINGS_WORKQ는 work item을 실행할 context를 정합니다. 기본값은 활성화이며 stack이 전용 cooperative thread로 work item을 처리합니다. Configuration을 저장하는 동안에도 incoming·outgoing message와 system workqueue의 다른 work item을 처리할 수 있습니다.
이 option을 끄면 work item을 system workqueue에 제출합니다. 그러면 stack configuration을 저장하는 동안 system workqueue가 block됩니다. Device가 눈에 띄는 시간 동안 응답하지 않을 수 있으므로 option을 끄는 것은 권장하지 않습니다.
Advertisement identity
모든 mesh stack bearer는 BT_ID_DEFAULT local identity로 data를 advertise합니다. 이 값은 mesh stack 구현에 미리 설정되어 있습니다.
Bluetooth Low Energy와 Bluetooth Mesh가 같은 device에 공존한다면 application은 통신을 시작하기 전에 Bluetooth LE용 local identity를 별도로 할당하고 구성해야 합니다.
API Reference
공식 bt_mesh Doxygen group이 Mesh Core state, LPN, RPL과 공통 API를 생성합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.