zerotier-openwrt icon indicating copy to clipboard operation
zerotier-openwrt copied to clipboard

feature request: support MOON peers in the configuration file

Open SadPencil opened this issue 3 years ago • 8 comments

In a regular Linux distro, path /var/lib/zerotier-one/moons.d folder contains the information of MOON peers, each *.moon file per peer. When zerotier service starts, these files are loaded.

Currently, to let the zerotier node join the MOON in openwrt, the only way is to specify config_path in your configuration file.

# persistent configuration folder (for ZT controller mode)
	#option config_path '/etc/zerotier'

and place the moon files inside the folder. However, there are some cons in this method. Zerotier writes temporary files in the configuration folder and the persistent storage space in a OpenWRT router should not be written too much as it is a simple SPI flash that can't support too much write.

See the next comment for my solution.

SadPencil avatar Jul 13 '21 07:07 SadPencil

This request can be also achieved as follows.

The current behavior config_path is to make a symlink from /var/lib/zerotier-one to /etc/zerotier. However, it can be improved by something like,

option config_path '/etc/zerotier'
option option copy_config_path '0' # default to 0 in order to be compatible with older versions

and instead of making a symlink, copy all the files from /etc/zerotier to /var/lib/zerotier-one, and initialize the rest files.

SadPencil avatar Jul 13 '21 07:07 SadPencil

@SadPencil the only temporally files that ZT creates in /etc/zerotier are zerotier-one.pid and zerotier-one.port. Both with size of 4K and only rewrite on a router reboot. I think that flash can manage this without problem.

ogarcia avatar Jul 13 '21 07:07 ogarcia

@SadPencil the only temporally files that ZT creates in /etc/zerotier are zerotier-one.pid and zerotier-one.port. Both with size of 4K and only rewrite on a router reboot. I think that flash can manage this without problem.

The temporally files are small, indeed. But I create a PR for this anyhow. Tested on my router. https://github.com/mwarning/zerotier-openwrt/pull/92

SadPencil avatar Jul 13 '21 08:07 SadPencil

@ogarcia For those SPI flash without wear leveling feature, even though the files are small, minimizing the write is meaningful. Please review PR #92 .

SadPencil avatar Jul 15 '21 02:07 SadPencil

@mwarning what do you think?

ogarcia avatar Jul 21 '21 08:07 ogarcia

I will take a look later this week. @SadPencil thank you for your contribution!

mwarning avatar Jul 21 '21 09:07 mwarning

@mwarning support MOON?

openwrtdiy avatar Aug 20 '21 21:08 openwrtdiy

This feature sounds nice, but since I have never used mooons, it takes some time to grook and to have time to get into it. I hope to have time soon. Thank you for all the contributions so far! :)

mwarning avatar Aug 28 '21 07:08 mwarning