summaryrefslogtreecommitdiffhomepage
path: root/system-linux.c
diff options
context:
space:
mode:
authorKristian Evensen <kristian.evensen@gmail.com>2016-01-07 14:46:04 +0100
committerFelix Fietkau <nbd@openwrt.org>2016-01-17 11:50:44 +0100
commit49c8ab4ed307e4de016e92d3ffc84cd0ab50d56c (patch)
treed771c2732a09cced693c465abe0b95ac3fdab8ea /system-linux.c
parentb8438154804c3fe105d41ecbd00a597315506f30 (diff)
netifd: Do not add local/source policy rules multiple times
interface_ip_set_enabled() is usually called two times right after one another, once to handle config_ip and once to handle proto_ip. As long as ip->iface->l3_dev.dev is set, the local/source policy rules are updated. This value is in several cases set on both config_ip and proto_ip, causing the rules to be added multiple time. The reason is that the kernel does not respect the NLM_F_* flag for rules. In other words, the rule state has to be managed by the routing daemon. Since the local/source policy rules are bound to iface, this commit solves the problem by adding a flag to interface which stores the current rule state. The flag follows the enabled-paramter passed to interface_ip_set_enabled(), similar to route-> and addr->enabled. The flag breaks the alignment of the interface struct, but based on earlier commits this seems to be ok. I have tested the patch in different configurations and have not found any regression. Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Diffstat (limited to 'system-linux.c')
-rw-r--r--system-linux.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/system-linux.c b/system-linux.c
index d3bb64d..2b17764 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -1792,10 +1792,8 @@ static int system_iprule(struct iprule *rule, int cmd)
.rtm_flags = 0,
};
- if (cmd == RTM_NEWRULE) {
+ if (cmd == RTM_NEWRULE)
rtm.rtm_type = RTN_UNICAST;
- rtm.rtm_flags |= NLM_F_REPLACE | NLM_F_EXCL;
- }
if (rule->invert)
rtm.rtm_flags |= FIB_RULE_INVERT;