Make sure that iprule flushing happens after system_init(), otherwise the rtnl_socket...
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 28 May 2013 10:11:12 +0000 (12:11 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 28 May 2013 10:11:12 +0000 (12:11 +0200)
iprule.c

index 0ff02ded72f8691080d08ceb7b7c31beed9fe546..7b6341794423b58b5f223f2ce7b3cfe67961451a 100644 (file)
--- a/iprule.c
+++ b/iprule.c
@@ -28,6 +28,7 @@
 #include "system.h"
 
 struct vlist_tree iprules;
+static bool iprules_flushed = false;
 static unsigned int iprules_counter[2];
 
 enum {
@@ -208,6 +209,11 @@ error:
 void
 iprule_update_start(void)
 {
+       if (!iprules_flushed) {
+               system_flush_iprules();
+               iprules_flushed = true;
+       }
+
        iprules_counter[0] = 1;
        iprules_counter[1] = 1;
        vlist_update(&iprules);
@@ -247,6 +253,5 @@ iprule_update_rule(struct vlist_tree *tree,
 static void __init
 iprule_init_list(void)
 {
-       system_flush_iprules();
        vlist_init(&iprules, rule_cmp, iprule_update_rule);
 }