summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2018-09-26 14:47:21 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2018-09-26 14:47:21 +0000
commit97bedb4b77bfc2e29e930a3871c5dce37c03b69a (patch)
tree9675e59ff0bf3afd1b2fddc0672a7ab1bb00cfca /usr.sbin/bgpd
parent4d8781d2bb0eebc708e9192a1b07ce45cbb49ae6 (diff)
Use the same logic in trie_roa_check_v4 as in trie_roa_check_v6 when
checking that a source_as / maxlen combo actually fits. Fixes regress test.
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/rde_trie.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/rde_trie.c b/usr.sbin/bgpd/rde_trie.c
index da6a296ef62..539b2a458a0 100644
--- a/usr.sbin/bgpd/rde_trie.c
+++ b/usr.sbin/bgpd/rde_trie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_trie.c,v 1.7 2018/09/20 11:45:59 claudio Exp $ */
+/* $OpenBSD: rde_trie.c,v 1.8 2018/09/26 14:47:20 claudio Exp $ */
/*
* Copyright (c) 2018 Claudio Jeker <claudio@openbsd.org>
@@ -567,9 +567,10 @@ trie_roa_check_v4(struct trie_head *th, struct in_addr *prefix, u_int8_t plen,
/* Treat AS 0 as NONE which can never be matched */
if (as != 0) {
- rs = set_match(n->set, as);
- if (rs && plen <= rs->maxlen)
+ if ((rs = set_match(n->set, as)) != NULL) {
+ if (plen == n->plen || plen <= rs->maxlen)
return ROA_VALID;
+ }
}
}