Open jeslinmx opened 1 month ago
the name of the interfaces created seem to be non-deducible from the network ID (and maybe non-deterministic?)
There's actually a mapping from the network ID to the interface name as defined in the zerotier code under osdep/LinuxEthernetTap.cpp. It's deterministic except for the unlikely case of a name collision with another interface.
In case it's of interest to you, I had previously replicated this same logic in Nix in my personal configs, mostly for fun to see if I could do the hex math in Nix. See the ifrname
function from: https://github.com/danielfullmer/nixos-config/blob/05222bb666808b3330f060f49c044161e4e24b0d/profiles/zerotier.nix#L2-L43
Describe the bug
Zerotier networks can be joined declaratively, but the name of the interfaces created seem to be non-deducible from the network ID (and maybe non-deterministic?). This makes it challenging to address the Zerotier interface in other parts of config, such as
networking.firewall.interfaces.<name>.allowedTCPPortRanges
.There exists a mechanism to provide a key=value mapping of network IDs to interface names at
/var/lib/zerotier-one/devicemap
, although I can't seem to find any official documentation on this, only forum, GH, and SE posts referencing this functionality.Steps To Reproduce
Steps to reproduce the behavior:
services.zerotierone.joinNetworks
.networking.firewall.interfaces.<name>
.Expected behavior
Perhaps there should be either a
services.zerotierone.devicemap
attrset option, or more intuitively thejoinNetworks
option could be extended to allow<network-id>=<interface-name>
entries which behave as a<network-id>
entry currently does, while also adding<network-id>=<interface-name>
to/var/lib/zerotier-one/devicemap
.Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Notify maintainers
@sjmackenzie @zimbatm @ehmry @obadz @danielfullmer
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.