summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2018-09-07 16:45:24 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2018-09-07 16:45:24 +0000
commit525da14aa9c001fd67d85927b4d6a576dcba6fc5 (patch)
treefb71309db04c58741cf01afc856cca0dc839fa28 /usr.sbin
parentcacbc04ed5ad1fb425d241c395e0a46d85a41b2c (diff)
fix badly broken reload of filter rules that use prefix-sets. debugged
and fixed with/by claudio@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/rde_filter.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/rde_filter.c b/usr.sbin/bgpd/rde_filter.c
index 52d36ad33af..4705cef5a55 100644
--- a/usr.sbin/bgpd/rde_filter.c
+++ b/usr.sbin/bgpd/rde_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_filter.c,v 1.103 2018/09/07 10:49:22 claudio Exp $ */
+/* $OpenBSD: rde_filter.c,v 1.104 2018/09/07 16:45:23 benno Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -573,6 +573,7 @@ rde_filter_equal(struct filter_head *a, struct filter_head *b,
struct filter_rule *fa, *fb;
struct rde_prefixset *psa, *psb;
struct as_set *asa, *asb;
+ int r;
fa = a ? TAILQ_FIRST(a) : NULL;
fb = b ? TAILQ_FIRST(b) : NULL;
@@ -605,13 +606,14 @@ rde_filter_equal(struct filter_head *a, struct filter_head *b,
asb = fb->match.as.aset;
fa->match.prefixset.ps = fb->match.prefixset.ps = NULL;
fa->match.as.aset = fb->match.as.aset = NULL;
- if (memcmp(&fa->match, &fb->match, sizeof(fa->match)))
- return (0);
+ r = memcmp(&fa->match, &fb->match, sizeof(fa->match));
+ /* fixup the struct again */
fa->match.prefixset.ps = psa;
fb->match.prefixset.ps = psb;
fa->match.as.aset = asa;
fb->match.as.aset = asb;
-
+ if (r != 0)
+ return (0);
if (fa->match.prefixset.flags != 0 &&
fa->match.prefixset.ps != NULL &&
fa->match.prefixset.ps->dirty) {