-/* $OpenBSD: mrt.c,v 1.85 2018/07/17 07:02:11 claudio Exp $ */
+/* $OpenBSD: mrt.c,v 1.86 2018/07/24 10:10:58 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
pt_getaddr(p->re->prefix, &addr);
- n = prefix_aspath(p)->nexthop;
+ n = prefix_nexthop(p);
if (n == NULL) {
bzero(&nexthop, sizeof(struct bgpd_addr));
nexthop.aid = addr.aid;
return (-1);
}
- nexthop = prefix_aspath(p)->nexthop;
+ nexthop = prefix_nexthop(p);
if (nexthop == NULL) {
bzero(&addr, sizeof(struct bgpd_addr));
addr.aid = p->re->prefix->aid;
struct bgpd_addr *nh;
struct ibuf *tbuf;
- nexthop = prefix_aspath(p)->nexthop;
+ nexthop = prefix_nexthop(p);
if (nexthop == NULL) {
bzero(&addr, sizeof(struct bgpd_addr));
addr.aid = re->prefix->aid;
-/* $OpenBSD: rde.c,v 1.399 2018/07/22 16:59:08 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.400 2018/07/24 10:10:58 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
memcpy(&rib.remote_addr, &prefix_peer(p)->remote_addr,
sizeof(rib.remote_addr));
rib.remote_id = prefix_peer(p)->remote_bgpid;
- if (asp->nexthop != NULL) {
- memcpy(&rib.true_nexthop, &asp->nexthop->true_nexthop,
+ if (prefix_nexthop(p) != NULL) {
+ memcpy(&rib.true_nexthop, &prefix_nexthop(p)->true_nexthop,
sizeof(rib.true_nexthop));
- memcpy(&rib.exit_nexthop, &asp->nexthop->exit_nexthop,
+ memcpy(&rib.exit_nexthop, &prefix_nexthop(p)->exit_nexthop,
sizeof(rib.exit_nexthop));
} else {
/* announced network may have a NULL nexthop */
rib.flags |= F_PREF_INTERNAL;
if (asp->flags & F_PREFIX_ANNOUNCED)
rib.flags |= F_PREF_ANNOUNCE;
- if (asp->nexthop == NULL || asp->nexthop->state == NEXTHOP_REACH)
+ if (prefix_nexthop(p) == NULL ||
+ prefix_nexthop(p)->state == NEXTHOP_REACH)
rib.flags |= F_PREF_ELIGIBLE;
if (asp->flags & F_ATTR_LOOP)
rib.flags &= ~F_PREF_ELIGIBLE;
if (asp->flags & F_NEXTHOP_BLACKHOLE)
kr.flags |= F_BLACKHOLE;
if (type == IMSG_KROUTE_CHANGE)
- memcpy(&kr.nexthop, &asp->nexthop->true_nexthop,
+ memcpy(&kr.nexthop, &prefix_nexthop(p)->true_nexthop,
sizeof(kr.nexthop));
strlcpy(kr.label, rtlabel_id2name(asp->rtlabelid), sizeof(kr.label));
* is chosen
*/
if (type == IMSG_KROUTE_CHANGE)
- memcpy(&kr.nexthop, &asp->nexthop->exit_nexthop,
+ memcpy(&kr.nexthop,
+ &prefix_nexthop(p)->exit_nexthop,
sizeof(kr.nexthop));
if (imsg_compose(ibuf_main, type, rd->rtableid, 0, -1,
&kr, sizeof(kr)) == -1)
bzero(&k, sizeof(k));
memcpy(&k.prefix, &addr, sizeof(k.prefix));
- if (asp->nexthop == NULL ||
- asp->nexthop->state != NEXTHOP_REACH)
+ if (prefix_nexthop(p) == NULL ||
+ prefix_nexthop(p)->state != NEXTHOP_REACH)
k.nexthop.aid = k.prefix.aid;
else
- memcpy(&k.nexthop, &asp->nexthop->true_nexthop,
+ memcpy(&k.nexthop, &prefix_nexthop(p)->true_nexthop,
sizeof(k.nexthop));
k.prefixlen = p->re->prefix->prefixlen;
k.flags = F_KERNEL;
-/* $OpenBSD: rde_decide.c,v 1.68 2018/06/21 17:26:16 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.69 2018/07/24 10:10:58 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
return (1);
/* 1. check if prefix is eligible a.k.a reachable */
- if (asp2->nexthop != NULL && asp2->nexthop->state != NEXTHOP_REACH)
+ if (prefix_nexthop(p2) != NULL &&
+ prefix_nexthop(p2)->state != NEXTHOP_REACH)
return (1);
- if (asp1->nexthop != NULL && asp1->nexthop->state != NEXTHOP_REACH)
+ if (prefix_nexthop(p1) != NULL &&
+ prefix_nexthop(p1)->state != NEXTHOP_REACH)
return (-1);
/* 2. local preference of prefix, bigger is better */
if (xp != NULL) {
struct rde_aspath *xasp = prefix_aspath(xp);
if (xasp->flags & (F_ATTR_LOOP|F_ATTR_PARSE_ERR) ||
- (xasp->nexthop != NULL &&
- xasp->nexthop->state != NEXTHOP_REACH))
+ (prefix_nexthop(xp) != NULL &&
+ prefix_nexthop(xp)->state != NEXTHOP_REACH))
/* xp is ineligible */
xp = NULL;
}