summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2018-09-25 08:08:39 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2018-09-25 08:08:39 +0000
commit1f371323e377f9cbe2a23ed0f3635b37cf99a928 (patch)
treed325af549c6b2e1161ff43b448c019268a232e9c /usr.sbin/bgpd
parent9e1c1dc716d81c8f8d14e378d8e4e8188cd974be (diff)
Fix loading of roa-sets in the RDE. From a much bigger diff but this
goes in now since it fixes a real issue.
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/rde.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 23081362d3f..871e6f822fc 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.426 2018/09/21 04:55:27 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.427 2018/09/25 08:08:38 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -895,16 +895,19 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
if (imsg.hdr.type == IMSG_RECONF_ROA_SET) {
SIMPLEQ_INSERT_TAIL(roasets_tmp, ps, entry);
ps->roa = 1;
- last_set = set_new(1, sizeof(struct roa_set));
- if (last_set == NULL)
- fatal(NULL);
} else
SIMPLEQ_INSERT_TAIL(prefixsets_tmp, ps, entry);
last_prefixset = ps;
+ last_set = NULL;
break;
case IMSG_RECONF_ROA_AS_SET_ITEMS:
nmemb = imsg.hdr.len - IMSG_HEADER_SIZE;
nmemb /= sizeof(struct roa_set);
+ if (last_set == NULL) {
+ last_set = set_new(1, sizeof(struct roa_set));
+ if (last_set == NULL)
+ fatal(NULL);
+ }
if (set_add(last_set, imsg.data, nmemb) != 0)
fatal(NULL);
break;
@@ -919,6 +922,7 @@ rde_dispatch_imsg_parent(struct imsgbuf *ibuf)
set_prep(last_set);
rv = trie_roa_add(&last_prefixset->th,
&psi.p.addr, psi.p.len, last_set);
+ last_set = NULL;
} else {
rv = trie_add(&last_prefixset->th,
&psi.p.addr, psi.p.len,