summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-10-02 14:41:37 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2013-10-02 14:41:37 +0200
commit28a10f84cbc3635e59bff348cb1715859dfacade (patch)
treec39b3c3d706d860d1fbdef4745520ab1b8c94dbe /nest
parent70c5780535fa3bd2360e8208f9273ac6d1741107 (diff)
Some fixes in filter code.
Thanks to Sergey Popovich for original patches.
Diffstat (limited to 'nest')
-rw-r--r--nest/route.h4
-rw-r--r--nest/rt-attr.c3
2 files changed, 5 insertions, 2 deletions
diff --git a/nest/route.h b/nest/route.h
index 35b5fa19..e0b88551 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -405,6 +405,10 @@ struct adata {
byte data[0];
};
+static inline int adata_same(struct adata *a, struct adata *b)
+{ return (a->length == b->length && !memcmp(a->data, b->data, a->length)); }
+
+
typedef struct ea_list {
struct ea_list *next; /* In case we have an override list */
byte flags; /* Flags: EALF_... */
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 6aed318b..3f79ee59 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -366,8 +366,7 @@ ea_same(ea_list *x, ea_list *y)
if (a->id != b->id ||
a->flags != b->flags ||
a->type != b->type ||
- ((a->type & EAF_EMBEDDED) ? a->u.data != b->u.data :
- (a->u.ptr->length != b->u.ptr->length || memcmp(a->u.ptr->data, b->u.ptr->data, a->u.ptr->length))))
+ ((a->type & EAF_EMBEDDED) ? a->u.data != b->u.data : !adata_same(a->u.ptr, b->u.ptr)))
return 0;
}
return 1;