summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bgpd/rde.c27
-rw-r--r--usr.sbin/bgpd/rde_decide.c14
2 files changed, 20 insertions, 21 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 41d8372b732..eee51476fe5 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.539 2022/03/02 14:44:46 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.540 2022/03/03 13:06:15 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2912,9 +2912,7 @@ void
rde_send_kroute(struct rib *rib, struct prefix *new, struct prefix *old)
{
struct kroute_full kr;
- struct bgpd_addr addr;
struct prefix *p;
- struct rde_aspath *asp;
struct l3vpn *vpn;
enum imsg_type type;
@@ -2934,21 +2932,21 @@ rde_send_kroute(struct rib *rib, struct prefix *new, struct prefix *old)
p = new;
}
- asp = prefix_aspath(p);
- pt_getaddr(p->pt, &addr);
bzero(&kr, sizeof(kr));
- memcpy(&kr.prefix, &addr, sizeof(kr.prefix));
+ pt_getaddr(p->pt, &kr.prefix);
kr.prefixlen = p->pt->prefixlen;
- if (prefix_nhflags(p) == NEXTHOP_REJECT)
- kr.flags |= F_REJECT;
- if (prefix_nhflags(p) == NEXTHOP_BLACKHOLE)
- kr.flags |= F_BLACKHOLE;
- if (type == IMSG_KROUTE_CHANGE)
+ if (type == IMSG_KROUTE_CHANGE) {
+ if (prefix_nhflags(p) == NEXTHOP_REJECT)
+ kr.flags |= F_REJECT;
+ if (prefix_nhflags(p) == NEXTHOP_BLACKHOLE)
+ kr.flags |= F_BLACKHOLE;
memcpy(&kr.nexthop, &prefix_nexthop(p)->true_nexthop,
sizeof(kr.nexthop));
- strlcpy(kr.label, rtlabel_id2name(asp->rtlabelid), sizeof(kr.label));
+ strlcpy(kr.label, rtlabel_id2name(prefix_aspath(p)->rtlabelid),
+ sizeof(kr.label));
+ }
- switch (addr.aid) {
+ switch (kr.prefix.aid) {
case AID_VPN_IPv4:
case AID_VPN_IPv6:
if (!(rib->flags & F_RIB_LOCAL))
@@ -3027,9 +3025,6 @@ rde_generate_updates(struct rib *rib, struct prefix *new, struct prefix *old,
if (old == NULL && new == NULL)
return;
- if (!eval_all && (rib->flags & F_RIB_NOFIB) == 0)
- rde_send_kroute(rib, new, old);
-
if (new)
aid = new->pt->aid;
else
diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c
index 3a0f6eb7f1f..a28d98188f6 100644
--- a/usr.sbin/bgpd/rde_decide.c
+++ b/usr.sbin/bgpd/rde_decide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_decide.c,v 1.88 2022/03/01 09:46:22 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.89 2022/03/03 13:06:15 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
@@ -454,8 +454,10 @@ void
prefix_evaluate(struct rib_entry *re, struct prefix *new, struct prefix *old)
{
struct prefix *xp;
+ struct rib *rib;
- if (re_rib(re)->flags & F_RIB_NOEVALUATE) {
+ rib = re_rib(re);
+ if (rib->flags & F_RIB_NOEVALUATE) {
/* decision process is turned off */
if (old != NULL)
LIST_REMOVE(old, entry.list.rib);
@@ -468,7 +470,7 @@ prefix_evaluate(struct rib_entry *re, struct prefix *new, struct prefix *old)
* active. Clean up now to ensure that the RIB
* is consistant.
*/
- rde_generate_updates(re_rib(re), NULL, re->active, 0);
+ rde_generate_updates(rib, NULL, re->active, 0);
re->active = NULL;
}
return;
@@ -494,7 +496,9 @@ prefix_evaluate(struct rib_entry *re, struct prefix *new, struct prefix *old)
* but remember that xp may be NULL aka ineligible.
* Additional decision may be made by the called functions.
*/
- rde_generate_updates(re_rib(re), xp, re->active, 0);
+ rde_generate_updates(rib, xp, re->active, 0);
+ if ((rib->flags & F_RIB_NOFIB) == 0)
+ rde_send_kroute(rib, xp, re->active);
re->active = xp;
return;
}
@@ -506,5 +510,5 @@ prefix_evaluate(struct rib_entry *re, struct prefix *new, struct prefix *old)
*/
if (rde_evaluate_all())
if ((new != NULL && prefix_eligible(new)) || old != NULL)
- rde_generate_updates(re_rib(re), re->active, NULL, 1);
+ rde_generate_updates(rib, re->active, NULL, 1);
}