From 2a0af925b83f699d126cf0e733a49c75ffd86033 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Mon, 10 May 2021 13:39:55 +0200 Subject: OSPF: Allow ifaces with host address as unnumbered PtP or PtMP ifaces Ifaces with host address (/32) were forced to be stubby, but now they can be used as PtP or PtMP. For these ifaces we need to: - Do not force stub mode - Accept packets from any IP as local - Accept any configured neighbor as local - Detect ifaces properly as unnumbered - Use ONLINK flag for nexthops --- proto/ospf/rt.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'proto/ospf/rt.c') diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index b3e49a11..17f8be7f 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1827,7 +1827,12 @@ calc_next_hop(struct ospf_area *oa, struct top_hash_entry *en, return NULL; } - return new_nexthop(p, nh, ifa->iface, ifa->ecmp_weight); + struct nexthop *nhs = new_nexthop(p, nh, ifa->iface, ifa->ecmp_weight); + + if (ifa->addr->flags & IA_HOST) + nhs->flags = RNF_ONLINK; + + return nhs; } /* The third case - bcast or nbma neighbor */ @@ -2031,8 +2036,9 @@ again1: for (nh = nf->n.nhs; nh; nh = nh->next) if (ipa_nonzero(nh->gw)) { - neighbor *ng = neigh_find(&p->p, nh->gw, nh->iface, 0); - if (!ng || (ng->scope == SCOPE_HOST)) + neighbor *nbr = neigh_find(&p->p, nh->gw, nh->iface, + (nh->flags & RNF_ONLINK) ? NEF_ONLINK : 0); + if (!nbr || (nbr->scope == SCOPE_HOST)) { reset_ri(nf); break; } } } -- cgit v1.2.3