From de6b13a4741ec9fcd3d165a02dd6772aad69ef04 Mon Sep 17 00:00:00 2001 From: benno Date: Fri, 7 Sep 2018 16:45:23 +0000 Subject: [PATCH] fix badly broken reload of filter rules that use prefix-sets. debugged and fixed with/by claudio@ --- usr.sbin/bgpd/rde_filter.c | 10 ++++++---- 1 file 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 @@ -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) { -- 2.20.1