summaryrefslogtreecommitdiffhomepage
path: root/system-linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'system-linux.c')
-rw-r--r--system-linux.c9
1 files changed, 9 insertions, 0 deletions
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);
}