From 49c8ab4ed307e4de016e92d3ffc84cd0ab50d56c Mon Sep 17 00:00:00 2001 From: Kristian Evensen Date: Thu, 7 Jan 2016 14:46:04 +0100 Subject: 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 --- interface.h | 1 + 1 file changed, 1 insertion(+) (limited to 'interface.h') diff --git a/interface.h b/interface.h index c2049f1..73a3b55 100644 --- a/interface.h +++ b/interface.h @@ -112,6 +112,7 @@ struct interface { bool link_state; bool force_link; bool dynamic; + bool policy_rules_set; time_t start_time; enum interface_state state; -- cgit v1.2.1