diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2021-05-10 13:39:55 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2021-05-10 13:39:55 +0200 |
commit | 2a0af925b83f699d126cf0e733a49c75ffd86033 (patch) | |
tree | dfd17aaf95a4684c2eba093bb62ecd4a00c011a0 /proto/ospf/rt.c | |
parent | bc591061f618cdc35cf21c7973a660f8d7018b43 (diff) |
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
Diffstat (limited to 'proto/ospf/rt.c')
-rw-r--r-- | proto/ospf/rt.c | 12 |
1 files changed, 9 insertions, 3 deletions
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; } } } |