diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-09-05 09:49:58 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2018-09-05 09:49:58 +0000 |
commit | b3f9a260fe596700c6b30b8b15c1d3cbbadb8b75 (patch) | |
tree | 1c41f2e2db781016b4c4c4062a707a6c0f2ba446 /usr.sbin/bgpd/rde_filter.c | |
parent | 24e122d0f1c137254099dfaa0f0533ccac9decf1 (diff) |
Change the way as_compare() and aspath_match() handle 'neighbor-as'. Instead
of doing the condition before calling aspath_match() just pass the neighbor-as
down to as_compare() which then has all needed data for the lookup. While
doing this also remove one of the as fields in struct filter_as since the
min/max fields can be reused for unary operations.
OK denis@ phessler@
Diffstat (limited to 'usr.sbin/bgpd/rde_filter.c')
-rw-r--r-- | usr.sbin/bgpd/rde_filter.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/usr.sbin/bgpd/rde_filter.c b/usr.sbin/bgpd/rde_filter.c index 5d287b63840..ddfa2ac39bb 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.99 2018/08/03 16:31:22 claudio Exp $ */ +/* $OpenBSD: rde_filter.c,v 1.100 2018/09/05 09:49:57 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -340,7 +340,6 @@ int rde_filter_match(struct filter_rule *f, struct rde_peer *peer, struct filterstate *state, struct prefix *p) { - u_int32_t pas; int cas, type; int64_t las, ld1, ld2; struct prefixset_item *psi; @@ -349,21 +348,17 @@ rde_filter_match(struct filter_rule *f, struct rde_peer *peer, if (state != NULL) asp = &state->aspath; - if (asp != NULL && f->match.as.type != AS_NONE) { - if (f->match.as.flags & AS_FLAG_NEIGHBORAS) - pas = peer->conf.remote_as; - else - pas = f->match.as.as; - if (aspath_match(asp->aspath->data, asp->aspath->len, - &f->match.as, pas) == 0) - return (0); - } - if (f->peer.ebgp && !peer->conf.ebgp) return (0); if (f->peer.ibgp && peer->conf.ebgp) return (0); + if (asp != NULL && f->match.as.type != AS_NONE) { + if (aspath_match(asp->aspath->data, asp->aspath->len, + &f->match.as, peer->conf.remote_as) == 0) + return (0); + } + if (asp != NULL && f->match.aslen.type != ASLEN_NONE) if (aspath_lenmatch(asp->aspath, f->match.aslen.type, f->match.aslen.aslen) == 0) |