summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-05-27 19:45:20 +0200
committerJo-Philipp Wich <jow@openwrt.org>2013-05-27 19:45:20 +0200
commit97e748de49c02f36a1e75bd9f9552311fb4051b4 (patch)
treecfbff63db1582f9801c3f3566132b776f158bd42
parent2f31bff38d4dc2f36006ded6b8a7d039cb569eaa (diff)
Move initial iprule flushing to system_add_iprule() to not collide with generic multiwan support
-rw-r--r--iprule.c8
-rw-r--r--system-linux.c9
2 files changed, 9 insertions, 8 deletions
diff --git a/iprule.c b/iprule.c
index c3fdcfc..27acef4 100644
--- 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;
diff --git a/system-linux.c b/system-linux.c
index f5c900d..76740f7 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -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);
}