ffnord / mesh-announce

Discussion at #mesh-announce:irc.hackint.org and (separately) at
https://matrix.to/#/!MjLIHcALOcENXZWQlH:irc.hackint.org/$1547640760901FmKaD:matrix.eclabs.de
13 stars 45 forks source link

If possible use systemd's machine-id as node_id #48

Closed citronalco closed 4 years ago

citronalco commented 4 years ago

If available use systemd's machine-id as node_id. Fixes #37 and, for non babel setups, the necessity of having fixed MAC addresses on the bat interfaces.

rubo77 commented 4 years ago

Shouldn't this only change, in case there is no batman mac

citronalco commented 4 years ago

Shouldn't this only change, in case there is no batman mac

The order is intentionally: At first try to get the machine-id, and only if's not availablle (means: no systemd on the machine) use the batman mac. If you don't give your batman interface a mac manually it gets a new mac on every boot, while the machine-id is set during OS installation and is fixed after that. As the node_id should identify a node, a fixed node_id that survives reboots is what's required.

jplitza commented 4 years ago

I guess @rubo77 intended to mention that upgrading mesh-announce to this change will change the node_id of already existing setups.

neocturne commented 4 years ago

I think this solution makes sense for Babel setups.

For batadv, I consider any setup that doesn't fix all MAC addresses broken, so this change would not be necessary - and, as already pointed out by others, problematic for existing setups.

citronalco commented 4 years ago

OK. Seems I underestimated the dimension of this topic.

If you want to avoid a breaking switch to machine-id, maybe a command line option could be added to enable the usage of machine-id instead of batman's MAC. Or one to set the node_id manually. But that's something you have to decide.

@NeoRaider: Can you explain why you consider setups without fixed MAC addresses on the batman interfaces broken? During the last few months I checked many publicly available saltstack/ansible setups, and only a minority of them manually sets them (while most of them do for the connected bridge devices), so it's not that obvious.

TobleMiner commented 4 years ago

Closing PR since the current approach presented does not make any sense. Choosing the nodeid is not the job of mesh-announce. The nodeid is a configuration feature of the gateway. Using the systemd machine id is not a proper implementation since the identity of a gateway should be independent from the host it is deployed on. I might consider adding a (per domain) config option for it instead.