Skip to content

luid: change last byte instead of first on luid_get() re-calls#12623

Closed
miri64 wants to merge 1 commit intoRIOT-OS:masterfrom
miri64:luid/fix/change-on-luid_get
Closed

luid: change last byte instead of first on luid_get() re-calls#12623
miri64 wants to merge 1 commit intoRIOT-OS:masterfrom
miri64:luid/fix/change-on-luid_get

Conversation

@miri64
Copy link
Member

@miri64 miri64 commented Oct 31, 2019

Contribution description

For the first byte bit 2 and 3 are changed when e.g. used as EUI-64 to make it a valid unicast EUI-64. So changing only the first byte on re-calls of luid_get() reduces the potential pool of non-duplicates for nodes with multiple interfaces.

The general doc btw already states as much:

RIOT/sys/include/luid.h

Lines 36 to 37 in 85a392e

* Example: Calling `luid_get(&buf, 8)` four times in a row, will yield four
* different IDs, differing in their LSB.

Testing procedure

A node with two network devices using the same address length and using luid_get() to generate the MAC address should differ in their last byte now, not the first.

Issues/PRs references

Alternative to #12592

For the first byte bit 2 and 3 are changed when used as EUI-64 to make
it a valid unicast EUI-64. So changing only the first byte on re-calls
of `luid_get()` reduces the potential pool of non-duplicates for nodes
with multiple interfaces.
@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: sys Area: System labels Oct 31, 2019
@miri64 miri64 added this to the Release 2020.01 milestone Oct 31, 2019
@benpicco
Copy link
Contributor

The problem is that (most)? drivers will use the first two bytes for the short address so this will now always be the same if there are multiple interfaces.

@miri64
Copy link
Member Author

miri64 commented Oct 31, 2019

True. Then this needs to be fixed as well. I don't think using the second MSB arbitrarily is a good idea either.

@miri64
Copy link
Member Author

miri64 commented Oct 31, 2019

Closing in favor of @benpicco's future PR ;-) (see #12592 (comment))

@miri64 miri64 closed this Oct 31, 2019
@benpicco
Copy link
Contributor

Well I haven not started yet 😉

@maribu
Copy link
Member

maribu commented Oct 31, 2019

The last byte is usually the most valuable in terms of uniqueness. Modifying it will yield a higher collision probability than modifying any other byte.

@miri64 miri64 deleted the luid/fix/change-on-luid_get branch November 5, 2019 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: sys Area: System Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants