summaryrefslogtreecommitdiff
path: root/iprule.h
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2019-05-27 21:01:25 +0200
committerHans Dedecker <dedeckeh@gmail.com>2019-05-27 22:31:52 +0200
commitbeb810dbccee098add0347d551eb5362e404fbdc (patch)
tree9d58bb9911ed7e583993fa40c3287486de452334 /iprule.h
parent22e8e589fd6ab5d19dc1d3c9d1bcf2bfabf1fafb (diff)
downloadnetifd-beb810dbccee098add0347d551eb5362e404fbdc.tar.gz
iprule: fix missing ip rules after a reload (FS#2296)
Since commit 5cf79759a24e9bb2a6a3aef7c83d73efb9bf2df3 (iprule: rework interface based rules to handle dynamic interfaces) the rule comparison is broken and doesn't correctly recognize matching rules. This in turn break the reloading as adding the "new" rule fails because it already exists and it then delete the "old" rule. The comparison is broken because it now include fields that are not defining the rule itself, as well as some pointer to malloced strings. To fix this we move back the offending fields in the iprule struct before the 'flags' field and match the malloced strings separately. Signed-off-by: Alban Bedel <albeu@free.fr> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'iprule.h')
-rw-r--r--iprule.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/iprule.h b/iprule.h
index f05c3c9..89b94b4 100644
--- a/iprule.h
+++ b/iprule.h
@@ -69,15 +69,6 @@ struct iprule {
struct vlist_node node;
unsigned int order;
- /* everything below is used as avl tree key */
- enum iprule_flags flags;
-
- bool invert;
-
- /* uci interface name */
- char *in_iface;
- char *out_iface;
-
/* to receive interface events */
struct interface_user in_iface_user;
struct interface_user out_iface_user;
@@ -86,6 +77,17 @@ struct iprule {
char in_dev[IFNAMSIZ + 1];
char out_dev[IFNAMSIZ + 1];
+ /* everything below is used as avl tree key */
+ /* don't change the order */
+
+ /* uci interface name */
+ char *in_iface;
+ char *out_iface;
+
+ enum iprule_flags flags;
+
+ bool invert;
+
unsigned int src_mask;
union if_addr src_addr;