Skip to content

Fix: make maximum node_id configurable (default: 250)#2604

Merged
ipspace merged 1 commit intodevfrom
node-max-id
Aug 18, 2025
Merged

Fix: make maximum node_id configurable (default: 250)#2604
ipspace merged 1 commit intodevfrom
node-max-id

Conversation

@ipspace
Copy link
Owner

@ipspace ipspace commented Aug 18, 2025

Fixes #2603

@ipspace ipspace merged commit 0a30a76 into dev Aug 18, 2025
11 checks passed
@ipspace ipspace deleted the node-max-id branch August 18, 2025 13:36
@jbemmel
Copy link
Collaborator

jbemmel commented Aug 18, 2025

There's an issue here:

addrs.mac_eui[3] = node.id # ... using a difference in the 4th octet, not the last one #1954

@ipspace
Copy link
Owner Author

ipspace commented Aug 18, 2025

There's an issue here:

addrs.mac_eui[3] = node.id # ... using a difference in the 4th octet, not the last one #1954

Thank you. So he'd have to define the management MAC addresses manually, or should we also modify the 3rd octet if needed? Also, we're currently squatting on OUI assigned to Cisco, so maybe we should change that to locally-administered range as well?

@jbemmel
Copy link
Collaborator

jbemmel commented Aug 18, 2025

Thank you. So he'd have to define the management MAC addresses manually, or should we also modify the 3rd octet if needed? Also, we're currently squatting on OUI assigned to Cisco, so maybe we should change that to locally-administered range as well?

Not completely solving the issue, but

addrs.mac_eui[3] = node.id // 256
addrs.mac_eui[4] = node.id % 256

would allow for 64K nodes.

We could adjust the OUI prefix as well (though orthogonal to this issue)

@ipspace
Copy link
Owner Author

ipspace commented Aug 18, 2025

addrs.mac_eui[3] = node.id // 256
addrs.mac_eui[4] = node.id % 256

That would change the OUI, and I know you want to have plenty of MAC address space for individual nodes. Going to locally administered MAC addresses seems to be the only sane long-term solution, but after all the crap we've seen while working on this project, I'm afraid of what might break.

Should we, for the moment, just add a slight addition to that footnote saying "if you increase MAX_NODE_ID beyond 255, you'll have to deal with management MAC addresses as well"?

@ssasso
Copy link
Collaborator

ssasso commented Aug 18, 2025

Side note: instead of "complex" math, you could use netaddr to handle mac addresses as well:

>>> base_mac = netaddr.EUI('02-00-00-00-00-00')
>>> id=1234
>>> node_mac = netaddr.EUI(int(base_mac)+id)
>>> node_mac
EUI('02-00-00-00-04-D2')

@ipspace
Copy link
Owner Author

ipspace commented Aug 18, 2025

Side note: instead of "complex" math, you could use netaddr to handle mac addresses as well:

That's what we had in the past. I'll leave it to @jbemmel to explain the sad history of this change 😒

@jbemmel
Copy link
Collaborator

jbemmel commented Aug 18, 2025

addrs.mac_eui[3] = node.id // 256
addrs.mac_eui[4] = node.id % 256

That would change the OUI, and I know you want to have plenty of MAC address space for individual nodes.

Unless I’m mistaken, the OUI is in 0..2 (24 bits). Index 3 and 4 are available to change

We could also change 0..2 - but that is a different issue

A footnote would not help users deal with the macs - that’s a pain

@ipspace
Copy link
Owner Author

ipspace commented Aug 18, 2025

Unless I’m mistaken, the OUI is in 0..2 (24 bits). Index 3 and 4 are available to change

We were modifying byte #6. Then you wanted to modify byte #4. Now you claim #4 and #5 are OK. Could you please figure out what you really need (and why), otherwise we can go back to the old solution (along the lines of what @ssasso recommended) and call it a day.

Oh, and thanks for discussing things in a barely-related merged PR. That will make it so much easier to find them later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

max node_id

3 participants