summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_update.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-01-11 17:10:27 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-01-11 17:10:27 +0000
commitc403fa9d6171b3465b8e396d014226856f4a8604 (patch)
treef266174c83dc47f089a54b8ee0f31084987a787b /usr.sbin/bgpd/rde_update.c
parent7a42faa76d7d13fba1e283dd714c837ab25fb570 (diff)
Add the validation state to the filterstate struct.
Removes vstate argument from rde_filter(). Rename prefix_vstate() to prefix_roa_vstate(). OK tb@
Diffstat (limited to 'usr.sbin/bgpd/rde_update.c')
-rw-r--r--usr.sbin/bgpd/rde_update.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c
index 35f75a0317e..db44894d0c4 100644
--- a/usr.sbin/bgpd/rde_update.c
+++ b/usr.sbin/bgpd/rde_update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_update.c,v 1.149 2023/01/11 13:53:17 claudio Exp $ */
+/* $OpenBSD: rde_update.c,v 1.150 2023/01/11 17:10:26 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -178,9 +178,9 @@ up_generate_updates(struct filter_head *rules, struct rde_peer *peer,
rde_filterstate_prep(&state, prefix_aspath(new),
prefix_communities(new), prefix_nexthop(new),
- prefix_nhflags(new));
+ prefix_nhflags(new), prefix_roa_vstate(new));
if (rde_filter(rules, peer, prefix_peer(new), &addr,
- prefixlen, prefix_vstate(new), &state) == ACTION_DENY) {
+ prefixlen, &state) == ACTION_DENY) {
rde_filterstate_clean(&state);
if (peer->flags & PEERFLAG_EVALUATE_ALL) {
new = TAILQ_NEXT(new, entry.list.rib);
@@ -208,7 +208,8 @@ up_generate_updates(struct filter_head *rules, struct rde_peer *peer,
up_prep_adjout(peer, &state, addr.aid);
prefix_adjout_update(p, peer, &state, &addr,
- new->pt->prefixlen, new->path_id_tx, prefix_vstate(new));
+ new->pt->prefixlen, new->path_id_tx,
+ prefix_roa_vstate(new));
rde_filterstate_clean(&state);
/* max prefix checker outbound */
@@ -319,9 +320,9 @@ up_generate_addpath(struct filter_head *rules, struct rde_peer *peer,
rde_filterstate_prep(&state, prefix_aspath(new),
prefix_communities(new), prefix_nexthop(new),
- prefix_nhflags(new));
+ prefix_nhflags(new), prefix_roa_vstate(new));
if (rde_filter(rules, peer, prefix_peer(new), &addr,
- prefixlen, prefix_vstate(new), &state) == ACTION_DENY) {
+ prefixlen, &state) == ACTION_DENY) {
rde_filterstate_clean(&state);
continue;
}
@@ -340,7 +341,8 @@ up_generate_addpath(struct filter_head *rules, struct rde_peer *peer,
up_prep_adjout(peer, &state, addr.aid);
prefix_adjout_update(p, peer, &state, &addr,
- new->pt->prefixlen, new->path_id_tx, prefix_vstate(new));
+ new->pt->prefixlen, new->path_id_tx,
+ prefix_roa_vstate(new));
rde_filterstate_clean(&state);
/* max prefix checker outbound */
@@ -428,9 +430,9 @@ up_generate_addpath_all(struct filter_head *rules, struct rde_peer *peer,
rde_filterstate_prep(&state, prefix_aspath(new),
prefix_communities(new), prefix_nexthop(new),
- prefix_nhflags(new));
+ prefix_nhflags(new), prefix_roa_vstate(new));
if (rde_filter(rules, peer, prefix_peer(new), &addr,
- prefixlen, prefix_vstate(new), &state) == ACTION_DENY) {
+ prefixlen, &state) == ACTION_DENY) {
rde_filterstate_clean(&state);
continue;
}
@@ -445,7 +447,7 @@ up_generate_addpath_all(struct filter_head *rules, struct rde_peer *peer,
up_prep_adjout(peer, &state, addr.aid);
prefix_adjout_update(p, peer, &state, &addr,
- prefixlen, new->path_id_tx, prefix_vstate(new));
+ prefixlen, new->path_id_tx, prefix_roa_vstate(new));
rde_filterstate_clean(&state);
/* max prefix checker outbound */
@@ -486,7 +488,7 @@ up_generate_default(struct filter_head *rules, struct rde_peer *peer,
if (peer->capa.mp[aid] == 0)
return;
- rde_filterstate_prep(&state, NULL, NULL, NULL, 0);
+ rde_filterstate_prep(&state, NULL, NULL, NULL, 0, ROA_NOTFOUND);
asp = &state.aspath;
asp->aspath = aspath_get(NULL, 0);
asp->origin = ORIGIN_IGP;
@@ -506,8 +508,8 @@ up_generate_default(struct filter_head *rules, struct rde_peer *peer,
p = prefix_adjout_lookup(peer, &addr, 0);
/* outbound filter as usual */
- if (rde_filter(rules, peer, peerself, &addr, 0, ROA_NOTFOUND,
- &state) == ACTION_DENY) {
+ if (rde_filter(rules, peer, peerself, &addr, 0, &state) ==
+ ACTION_DENY) {
rde_filterstate_clean(&state);
return;
}
@@ -1032,7 +1034,7 @@ up_dump_attrnlri(u_char *buf, int len, struct rde_peer *peer)
goto done;
rde_filterstate_prep(&state, prefix_aspath(p), prefix_communities(p),
- prefix_nexthop(p), prefix_nhflags(p));
+ prefix_nexthop(p), prefix_nhflags(p), prefix_roa_vstate(p));
r = up_generate_attr(buf + 2, len - 2, peer, &state, AID_INET);
rde_filterstate_clean(&state);
@@ -1171,7 +1173,7 @@ up_dump_mp_reach(u_char *buf, int len, struct rde_peer *peer, uint8_t aid)
wpos = 4; /* reserve space for length fields */
rde_filterstate_prep(&state, prefix_aspath(p), prefix_communities(p),
- prefix_nexthop(p), prefix_nhflags(p));
+ prefix_nexthop(p), prefix_nhflags(p), prefix_roa_vstate(p));
/* write regular path attributes */
r = up_generate_attr(buf + wpos, len - wpos, peer, &state, aid);