diff options
author | Maria Matejka <mq@ucw.cz> | 2022-05-05 18:08:37 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-05-26 12:34:26 +0200 |
commit | f15f2fcee7eeb5a100bd204a0e67018e25953420 (patch) | |
tree | 12a99cfb8b6ee5aba555af282b356fb712457b18 /proto/ospf/topology.c | |
parent | f2e725a76882ba6b75c3ce4fb3c760bd83462410 (diff) |
Moved nexthop from struct rta to extended attribute.
This doesn't do anything more than to put the whole structure inside
adata. The overall performance is certainly going downhill; we'll
optimize this later.
Anyway, this is one of the latest items inside rta and in several
commits we may drop rta completely and move to eattrs-only routes.
Diffstat (limited to 'proto/ospf/topology.c')
-rw-r--r-- | proto/ospf/topology.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c index db423dc8..ca4620cc 100644 --- a/proto/ospf/topology.c +++ b/proto/ospf/topology.c @@ -1366,8 +1366,20 @@ ospf_rt_notify(struct proto *P, struct channel *ch UNUSED, net *n, rte *new, rte uint tag = ea_get_int(a->eattrs, &ea_ospf_tag, 0); ip_addr fwd = IPA_NONE; - if ((a->dest == RTD_UNICAST) && use_gw_for_fwaddr(p, a->nh.gw, a->nh.iface)) - fwd = a->nh.gw; + if (a->dest == RTD_UNICAST) + { + eattr *nhea = ea_find(a->eattrs, &ea_gen_nexthop); + if (!nhea) + { + log(L_ERR "%s: Unicast route without nexthop for %N", + p->p.name, n->n.addr); + return; + } + + struct nexthop_adata *nhad = (struct nexthop_adata *) nhea->u.ptr; + if (use_gw_for_fwaddr(p, nhad->nh.gw, nhad->nh.iface)) + fwd = nhad->nh.gw; + } /* NSSA-LSA with P-bit set must have non-zero forwarding address */ if (oa && ipa_zero(fwd)) |