Android-nRF-Mesh-Library: IV index doesn't update on a imported network


Describe the bug When a network is exported and imported to a new mobile device, the iv index of network is lost. Although it should update on receiving a secure network beacon after connecting to proxy, app discards the message and hence any message the app sends is ignored by the proxy.

Issue seems to be that when network is imported, IVIndex default transitionDate is set to currentDate and thus always failing the following condition image

To Reproduce Steps to reproduce the behavior:

  1. Create a mesh network
  2. Add multiple nodes
  3. Generate enough traffic to increment iv index (or change it manually if possible)
  4. Export network
  5. Import on another phone
  6. Change provisioner address on the new phone
  7. Try provisioning new node in the vicinity of existing nodes.
  8. It fails 90% of the time at Sending Composition Data Get as the node will ignore messages with older IV

Expected behavior Expected The IV index to get updated on first secure beacon

Platform details:

  • Device: Redmi 9 power
  • OS: Android 11
  • Library Version : 3.2.4

Logs / Screenshots

2022-06-22 19:58:08 [INFO]  BleManager: Connected to D7:31:53:E5:D3:DE
2022-06-22 19:58:09 [INFO]  BleManager: PHY updated (TX: LE 2M, RX: LE 2M)
2022-06-22 19:58:09 [INFO]  BleManager: Connection parameters updated (interval: 30.0ms, latency: 0, timeout: 200ms)
2022-06-22 19:58:09 [INFO]  BleManager: Services discovered
2022-06-22 19:58:09 [INFO]  BleManager: MTU changed to: 247
2022-06-22 19:58:09 [INFO]  BleManager: Notification received from 00002ade-0000-1000-8000-00805f9b34fb, value: (0x) 01-01-00-DD-05-4B-24-03-2B-24-ED-00-00-00-03-0B-34-C1-F4-8B-B3-B7-A1
2022-06-22 19:58:09 [INFO]  BleManager: Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 01-00
2022-06-22 19:58:09 [INFO]  BleManager: Notifications enabled

** The problem point
2022-06-22 19:58:09 [OTHER]  MeshManagerApi/Received mesh beacon: SecureNetworkBeacon { KeyRefreshActive: false, IV Index: IV Index: 3, IV Update Active: false, Authentication Value: 0x0B34C1F48BB3B7A1}
2022-06-22 19:58:09 [OTHER]  MeshManagerApi/Secure Network Beacon authenticated.
2022-06-22 19:58:09 [OTHER]  MeshManagerApi/Last IV Index: 0
2022-06-22 19:58:09 [WARN]  MeshManagerApi: Discarding beacon IV Index: 3, IV Update Active: false, last 0, changed: 0h ago, test mode: false
**


2022-06-22 19:58:09 [INFO]  BleManager: Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
2022-06-22 19:58:10 [INFO]  BleManager: Connection parameters updated (interval: 30.0ms, latency: 0, timeout: 200ms)
2022-06-22 19:58:11 [OTHER]  MeshTransport/Src address: 7FFF
2022-06-22 19:58:11 [OTHER]  MeshTransport/Dst address: 0021
2022-06-22 19:58:11 [OTHER]  MeshTransport/Key: EC3A1FA4903D5320049C69424C805AE3
2022-06-22 19:58:11 [OTHER]  MeshTransport/akf: 0
2022-06-22 19:58:11 [OTHER]  MeshTransport/aid: 0
2022-06-22 19:58:11 [OTHER]  MeshTransport/aszmic: 0
2022-06-22 19:58:11 [OTHER]  MeshTransport/Sequence number: 2
2022-06-22 19:58:11 [OTHER]  MeshTransport/Access message opcode: 8008
2022-06-22 19:58:11 [OTHER]  MeshTransport/Access message parameters: FF
2022-06-22 19:58:11 [OTHER]  AccessLayer/Created Access PDU 8008FF
2022-06-22 19:58:11 [OTHER]  UpperTransportLayer/Device nonce: 02000000027FFF002100000000
2022-06-22 19:58:11 [OTHER]  UpperTransportLayer/Encrypted upper transport pdu: 959D5EF58D5EBE
2022-06-22 19:58:11 [OTHER]  LowerTransportLayer/Unsegmented Lower transport access PDU 00959D5EF58D5EBE
2022-06-22 19:58:11 [OTHER]  NetworkLayer/Encryption key: 6E46DED43FC00F629C620A59C48E7265
2022-06-22 19:58:11 [OTHER]  NetworkLayer/Privacy key: 27D5F91E8D8FDDA3AEC347217878A354
2022-06-22 19:58:11 [OTHER]  NetworkLayer/Sequence Number: 000002
2022-06-22 19:58:11 [OTHER]  NetworkLayer/Encrypted Network payload: 6B6358D42F28B044FF90AA6E6A60
2022-06-22 19:58:11 [INFO]  BleManager: Data written to 00002add-0000-1000-8000-00805f9b34fb, value: (0x) 00-1E-64-67-B9-BB-F5-ED-6B-63-58-D4-2F-28-B0-44-FF-90-AA-6E-6A-60
2022-06-22 19:58:11 [OTHER]  MeshManagerApi/MeshNetwork pdu sent: 0x001E6467B9BBF5ED6B6358D42F28B044FF90AA6E6A60
2022-06-22 19:58:14 [INFO]  BleManager: Notification received from 00002ade-0000-1000-8000-00805f9b34fb, value: (0x) 01-01-00-DD-05-4B-24-03-2B-24-ED-00-00-00-03-0B-34-C1-F4-8B-B3-B7-A1
2022-06-22 19:58:14 [OTHER]  MeshManagerApi/Received mesh beacon: SecureNetworkBeacon { KeyRefreshActive: false, IV Index: IV Index: 3, IV Update Active: false, Authentication Value: 0x0B34C1F48BB3B7A1}
2022-06-22 19:58:14 [OTHER]  MeshManagerApi/Secure Network Beacon authenticated.
2022-06-22 19:58:14 [OTHER]  MeshManagerApi/Last IV Index: 0
2022-06-22 19:58:14 [WARN]  MeshManagerApi: Discarding beacon IV Index: 3, IV Update Active: false, last 0, changed: 0h ago, test mode: false
2022-06-22 19:58:35 [WARN]  BleManager: Error: (0x13): GATT CONN TERMINATE PEER USER
2022-06-22 19:58:35 [INFO]  BleManager: Disconnected

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (15 by maintainers)

Commits related to this issue

Most upvoted comments

@R0m4in-dooz Thanks for this. Instead of removing the check completely, I decided to update the iv index date after import is done since that api is public. I set the year to 1970 😛. The advantage was I did not need to put the library under source control. I could still use maven plugin