main: initialise sgw system after the tables
authorFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 11 Apr 2016 12:39:31 +0000 (14:39 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 11 Apr 2016 12:59:16 +0000 (14:59 +0200)
To prevent a NULL deref of active_lq_handler in get_linkcost_text

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/main.c

index 8c9edc9..a7ca8dc 100644 (file)
@@ -611,13 +611,6 @@ int main(int argc, char *argv[]) {
     }
   }
 
-#ifdef __linux__
-  /* startup gateway system */
-  if (olsr_cnf->smart_gw_active && olsr_startup_gateways()) {
-    olsr_exit("Cannot startup gateway tunnels", EXIT_FAILURE);
-  }
-#endif /* __linux__ */
-
   /* initialise the IPC socket */
   if ((olsr_cnf->ipc_connections > 0) && ipc_init()) {
     olsr_exit("ipc_init failure", EXIT_FAILURE);
@@ -626,6 +619,13 @@ int main(int argc, char *argv[]) {
   /* Initialisation of different tables to be used. */
   olsr_init_tables();
 
+#ifdef __linux__
+  /* startup gateway system */
+  if (olsr_cnf->smart_gw_active && olsr_startup_gateways()) {
+    olsr_exit("Cannot startup gateway tunnels", EXIT_FAILURE);
+  }
+#endif /* __linux__ */
+
   olsr_do_startup_sleep();
 
   /* start heartbeat that is showing on stdout */