summaryrefslogtreecommitdiff
path: root/iprule.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-04-05 13:45:08 +0200
committerJo-Philipp Wich <jow@openwrt.org>2013-04-05 13:54:09 +0200
commit800e5e5f50b62af1b7054f41331a4cc0d7802f65 (patch)
tree7fd7f4ffd5413422b80f8f63371acef55fa0bd79 /iprule.c
parent8dacaf753b57c703f215b0c844b412b64183ac81 (diff)
downloadnetifd-800e5e5f50b62af1b7054f41331a4cc0d7802f65.tar.gz
Maintain config order of ip rules unless user explicitely provides priority
Diffstat (limited to 'iprule.c')
-rw-r--r--iprule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/iprule.c b/iprule.c
index 7172f29..c3fdcfc 100644
--- a/iprule.c
+++ b/iprule.c
@@ -29,6 +29,7 @@
struct vlist_tree iprules;
static bool iprules_flushed = false;
+static unsigned int iprules_counter[2];
enum {
RULE_INTERFACE_IN,
@@ -111,6 +112,7 @@ iprule_add(struct blob_attr *attr, bool v6)
return;
rule->flags = v6 ? IPRULE_INET6 : IPRULE_INET4;
+ rule->order = iprules_counter[rule->flags]++;
if ((cur = tb[RULE_INVERT]) != NULL)
rule->invert = blobmsg_get_bool(cur);
@@ -214,6 +216,8 @@ error:
void
iprule_update_start(void)
{
+ iprules_counter[0] = 1;
+ iprules_counter[1] = 1;
vlist_update(&iprules);
}