When started while boot, olsrd quits when SmartGW is enabled with the message

olsrd[1395]: Received netlink error code Cannot assign requested address (-126)
olsrd[1395]: olsrd exit: Cannot initialize gateway tunnels

When restart after boot, olsrd starts up and works as expected.

I wrote this patch to work around this phenomenon, with this olsrd will retry
to setup the gateway tunnels and only exit with a failure if the problem
persists.

Signed-off-by: Daniel Golle <dgo...@allnet.de>
---
 net/olsrd/patches/001-retry-tunnel-setup.patch | 28 ++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 net/olsrd/patches/001-retry-tunnel-setup.patch

diff --git a/net/olsrd/patches/001-retry-tunnel-setup.patch 
b/net/olsrd/patches/001-retry-tunnel-setup.patch
new file mode 100644
index 0000000..d2c3caf
--- /dev/null
+++ b/net/olsrd/patches/001-retry-tunnel-setup.patch
@@ -0,0 +1,28 @@
+Index: olsrd-0.6.4/src/main.c
+===================================================================
+--- olsrd-0.6.4.orig/src/main.c
++++ olsrd-0.6.4/src/main.c
+@@ -240,6 +240,7 @@ int main(int argc, char *argv[]) {
+   struct ipaddr_str buf;
+   bool loadedConfig = false;
+   int i;
++  int retry;
+ 
+ #ifdef linux
+   struct interface *ifn;
+@@ -449,8 +450,13 @@ int main(int argc, char *argv[]) {
+ #ifdef linux
+   /* initialize gateway system */
+   if (olsr_cnf->smart_gw_active) {
+-    if (olsr_init_gateways()) {
+-      olsr_exit("Cannot initialize gateway tunnels", 1);
++    int retry=0;
++    while (olsr_init_gateways()) {
++      if (retry>5) {
++      olsr_exit("Cannot initialize gateway tunnels", 1);
++      }
++      retry++;
++      olsr_startup_sleep(5);
+     }
+   }
+ 
-- 
1.8.1.1

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to