olsrd: fix olsrd starting before network
authorNick Hainke <vincent@systemli.org>
Fri, 18 Jun 2021 08:06:38 +0000 (10:06 +0200)
committerPolynomdivision <vincent@systemli.org>
Wed, 7 Jul 2021 12:49:23 +0000 (14:49 +0200)
Should fix #691.

Sometimes the wifi interface is not ready before olsrd tries to access
it. This leads to warnings in the form of:

daemon.info olsrd: /etc/rc.d/S65olsrd: olsrd_write_interface()
Warning: Interface 'wireless0' not found, skipped
daemon.notice procd: /etc/rc.d/S65olsrd: olsrd: /etc/rc.d/S65olsrd:
olsrd_write_interface() Warning: Interface 'wireless0' not found, skipped

We make use of the "wait_for" procd command that allows us to wait for
the network before starting olsrd.

Tested-by: Noki
Signed-off-by: Nick Hainke <vincent@systemli.org>
olsrd/files/olsrd4.init
olsrd/files/olsrd6.init

index ca71a426176cf332cb5d938749e9442afcf18a1a..ceb553a3ee885e6059510047f36d29430d194bdd 100644 (file)
@@ -10,6 +10,18 @@ OLSRD=olsrd
 CONF=/var/etc/$OLSRD.conf
 PID=/var/run/olsrd.pid
 
+wait_for_network()
+{
+       ubus -t 15 wait_for network.interface.$1 2>/dev/null
+}
+
+boot()
+{
+       config_load network
+       config_foreach wait_for_network interface
+       rc_procd start_service
+}
+
 start_service() {
        olsrd_generate_config $OLSRD
        
index 8b81019e31f1f9c4fd32c39266ed868dbc8e6865..6d0b59b5ae5efec8b04440be25b653812be71f72 100644 (file)
@@ -10,6 +10,17 @@ OLSRD=olsrd6
 CONF=/var/etc/$OLSRD.conf
 PID=/var/run/olsrd6.pid
 
+wait_for_network()
+{
+       ubus -t 15 wait_for network.interface.$1 2>/dev/null
+}
+
+boot()
+{
+       config_load network
+       config_foreach wait_for_network interface
+       rc_procd start_service
+}
 
 start_service() {
        olsrd_generate_config $OLSRD