Commit a68689f
committed
Add sm_sec_req_auto_pair: make auto-pairing on Security Request configurable
On a Security Request from a peer we have no keys for, the host sends a
Pairing Request immediately from ble_sm_sec_req_rx(). Some peripherals never
answer a Pairing Request sent in the same instant as their own Security
Request (e.g. the Okida OT-2000 oven module: no Pairing Response, link
dropped after its 30 s SMP timeout). They pair first try with Bluedroid,
macOS and iOS, which leave initiation to the application.
Core Spec Vol 3, Part H, 2.4.6 says the central "may" initiate pairing on a
Security Request. Make it configurable: ble_hs_cfg.sm_sec_req_auto_pair
(syscfg BLE_SM_SEC_REQ_AUTO_PAIR, default 1 = unchanged). When cleared the
request is ignored and the application initiates pairing, e.g. via
NimBLEClient::secureConnection(). Peers we have keys for are unaffected.
Exposed as NimBLEDevice::setSecurityAutoPairOnSecReq().
Verified on ESP32-C3 / arduino-esp32 3.3.11: the oven pairs with the flag
cleared; with stock behaviour it fails regardless of MTU exchange,
connection interval, key distribution, address type or SC/legacy.1 parent 2c487b7 commit a68689f
6 files changed
Lines changed: 38 additions & 1 deletion
File tree
- src
- nimble/nimble/host
- include/host
- src
- syscfg
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1221 | 1221 | | |
1222 | 1222 | | |
1223 | 1223 | | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
1224 | 1236 | | |
1225 | 1237 | | |
1226 | 1238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
322 | 332 | | |
323 | 333 | | |
324 | 334 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2090 | 2090 | | |
2091 | 2091 | | |
2092 | 2092 | | |
2093 | | - | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
2094 | 2103 | | |
2095 | 2104 | | |
2096 | 2105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
838 | 842 | | |
839 | 843 | | |
840 | 844 | | |
| |||
0 commit comments