-/* $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>
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;
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))
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
-/* $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>
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);
* 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;
* 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;
}
*/
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);
}