question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prevent nextAvailableUnicastAddress() from returning an already assigned address.

See original GitHub issue

Describe the bug nextAvailableUnicastAddress() will return an already assigned unicast address.

A new node is added to a mesh by:

  1. Provisioning the device.
  2. Connecting to the new node and…
  3. (only if the connection is established) assigning and binding an app key by sending ConfigDefaultTtlGet, ConfigNetworkTransmitSet, ConfigAppKeyAdd, ConfigModelAppBind.

If step 1. succeeds, but step 2. fails, then the library gets inconsistent with the actual mesh. The effect is that nextAvailableUnicastAddress() will return an already (at step 1.) assigned unicast address.

This happens because the library updates its internal list of nodes (BaseMeshNetwork.nodes) in response of the commands ConfigDefaultTtlGet, ConfigNetworkTransmitSet, ConfigAppKeyAdd, ConfigModelAppBind. Now if the connection to the mesh fails (step 2.), then non of those commands are sent and hence the library does not update its internal list of nodes. If a new node is now provisioned, nextAvailableUnicastAddress() will return the same address as the node that failed to connect.

To Reproduce The easiest way to reproduce this is by provisioning (and assigning app keys to) a bunch of devices in a loop. If one node fails to connect, then the following device will get the same address assigned, causing a “unicast address already in use” error to show up in logcat.

Expected behavior nextAvailableUnicastAddress() must not return an already used unicast address. The only way to fix this is if the library updates its internal list of nodes as soon as a new node is provisioned - i.e. before connecting to the newly provisioned node.

Platform details: Happens on all Android versions.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
lenguyenthanhcommented, Oct 29, 2021

@NanaDada this issue is fixed now. Please give it a test and confirm.

Can you please publish a snapshot version? I’d like to try it. Thanks!

1reaction
roshanrajaratnamcommented, Oct 29, 2021

@NanaDada this issue is fixed now. Please give it a test and confirm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to consume/invalidate a unicast address? - Nordic Q&A
Now the question is, how can you prevent nextAvailableUnicastAddress() from returning an address that assignUnicastAddress() rejects?
Read more >
How to block MAC when the IP is already assigned ...
Hi, Here is the scenario, my laptop is assigned with an IP 172.16.1.1 and MAC address is 'abcd.efgh.ijkl'. Now is there a way...
Read more >
DHCP client can't get a DHCP-assigned IP address
In this article ... This article helps fix an issue where a DHCP client can't get a DHCP-assigned IP address. Applies to: Windows...
Read more >
How to Release DHCP-Assigned Addresses from a DHCP ...
Overview This document describes how to release IP address reservations for a DHCP server configured on a Palo Alto Networks Firewall.
Read more >
Troubleshooting a DHCP server failure
The first DHCP error is no assigned IP address. The most common reasons for this error include DHCP server failure, no available addresses...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found