wlanslovenija / tunneldigger

L2TPv3 VPN tunneling solution
http://tunneldigger.readthedocs.org/
Other
72 stars 52 forks source link

Broker: Wait for interface to have an IP before listening #189

Open pmelange opened 1 year ago

pmelange commented 1 year ago

If the configured port gets it's IP addr per DHCP, then it may not be configured by the time the broker starts.

Here is a log excerpt

Sat Aug 19 12:31:24 2023 daemon.err python[3096]: [WARNING/tunneldigger.broker] Failed to listen on :8943, skipping.

No client connections are possible in this state.

pmelange commented 1 year ago

I reworked the init script for OpenWrt to restart tunneldigger-broker when the configured interface goes up. In addition, if the config file gets changed, and reload_config is run on the command line, then the broker also restarts.

I haven't tested this on a distro like Debian. I don't know if tunneldigger-broker starts before the interface gets an ip address. I don't have a way to test it right now. If it's not a problem on Debian, then I would consider this problem "no longer existant" and this issue can be closed.

RalfJung commented 1 year ago

I never had that problem on our Debian boxes. Our systemd unit file looks as follows

[Unit]
Description = Start tunneldigger L2TPv3 broker
After = network-online.target
Wants = network-online.target

[Service]
ExecStart = /usr/bin/systemd-cat -p notice -t "tunneldigger" /opt/tunneldigger.sh
KillSignal= SIGINT
Restart=on-failure
RestartSec=1

[Install]
WantedBy = multi-user.target

AFAIK the After = network-online.target ensures that the network interface is up before tunneldigger gets started.