Move initial iprule flushing to system_add_iprule() to not collide with generic multi...
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 27 May 2013 17:45:20 +0000 (19:45 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 27 May 2013 17:45:20 +0000 (19:45 +0200)
iprule.c
system-linux.c

index c3fdcfce6e046d42ca75e989f01faebb170d4eb6..27acef4a553371cfccc7e7fffbc371b08e9bbfd1 100644 (file)
--- a/iprule.c
+++ b/iprule.c
@@ -28,7 +28,6 @@
 #include "system.h"
 
 struct vlist_tree iprules;
-static bool iprules_flushed = false;
 static unsigned int iprules_counter[2];
 
 enum {
@@ -199,13 +198,6 @@ iprule_add(struct blob_attr *attr, bool v6)
                rule->flags |= IPRULE_GOTO;
        }
 
-       /* trigger flush of existing rules when adding first uci rule the first time */
-       if (!iprules_flushed)
-       {
-               system_flush_iprules();
-               iprules_flushed = true;
-       }
-
        vlist_add(&iprules, &rule->node, &rule->flags);
        return;
 
index f5c900db2185ff5b6e17cc5228bc3f04208f92aa..76740f7d6078c64c94cf58b842e3579c320b9a3f 100644 (file)
@@ -65,6 +65,8 @@ static void handle_hotplug_event(struct uloop_fd *u, unsigned int events);
 
 static char dev_buf[256];
 
+static bool iprules_flushed = false;
+
 static void
 handler_nl_event(struct uloop_fd *u, unsigned int events)
 {
@@ -1177,6 +1179,13 @@ static int system_iprule(struct iprule *rule, int cmd)
 
 int system_add_iprule(struct iprule *rule)
 {
+       /* trigger flush of existing rules when adding first rule the first time */
+       if (!iprules_flushed)
+       {
+               system_flush_iprules();
+               iprules_flushed = true;
+       }
+
        return system_iprule(rule, RTM_NEWRULE);
 }