main: cleanup the gateways earlier on shutdown
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 1 Mar 2016 10:29:37 +0000 (11:29 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 1 Mar 2016 10:44:54 +0000 (11:44 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/main.c

index 69d6823..7a0cc19 100644 (file)
@@ -187,6 +187,14 @@ static void olsr_shutdown(int signo __attribute__ ((unused)))
   /* instruct the scheduler to stop */
   olsr_scheduler_stop();
 
+#ifdef __linux__
+  /* trigger gateway selection */
+  if (olsr_cnf->smart_gw_active) {
+    olsr_shutdown_gateways();
+    olsr_cleanup_gateways();
+  }
+#endif
+
   /* clear all links and send empty hellos/tcs */
   olsr_reset_all_links();
 
@@ -212,12 +220,6 @@ static void olsr_shutdown(int signo __attribute__ ((unused)))
   olsr_delete_all_mid_entries();
 
 #ifdef __linux__
-  /* trigger gateway selection */
-  if (olsr_cnf->smart_gw_active) {
-    olsr_shutdown_gateways();
-    olsr_cleanup_gateways();
-  }
-
   /* trigger niit static route cleanup */
   if (olsr_cnf->use_niit) {
     olsr_cleanup_niit_routes();