Move iprule flushing to the init function to make the timing predictable
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 27 May 2013 17:57:58 +0000 (19:57 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 27 May 2013 17:57:58 +0000 (19:57 +0200)
iprule.c
system-linux.c

index 27acef4a553371cfccc7e7fffbc371b08e9bbfd1..0ff02ded72f8691080d08ceb7b7c31beed9fe546 100644 (file)
--- a/iprule.c
+++ b/iprule.c
@@ -247,5 +247,6 @@ 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);
 }
index 76740f7d6078c64c94cf58b842e3579c320b9a3f..f5c900db2185ff5b6e17cc5228bc3f04208f92aa 100644 (file)
@@ -65,8 +65,6 @@ 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)
 {
@@ -1179,13 +1177,6 @@ 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);
 }