diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-06-27 16:51:53 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-06-27 16:57:07 +0200 |
commit | 586c1800c447ff099d34889b23647c4733876d9b (patch) | |
tree | d2f3feec9aaabeffe2457d994f4c453e1d9e7782 /proto | |
parent | 45f28d85818f79790968725a945063228989bae7 (diff) |
Nest: Neighbor cache cleanups
Simplify neighbor cache code, fix several minor bugs, and improve
handling of ONLINK flag.
Diffstat (limited to 'proto')
-rw-r--r-- | proto/bfd/bfd.c | 2 | ||||
-rw-r--r-- | proto/bgp/bgp.c | 4 | ||||
-rw-r--r-- | proto/bgp/packets.c | 4 | ||||
-rw-r--r-- | proto/ospf/rt.c | 2 | ||||
-rw-r--r-- | proto/rip/packets.c | 2 | ||||
-rw-r--r-- | proto/rip/rip.c | 2 | ||||
-rw-r--r-- | proto/static/static.c | 7 |
7 files changed, 11 insertions, 12 deletions
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c index 64d5007b..fdcd7225 100644 --- a/proto/bfd/bfd.c +++ b/proto/bfd/bfd.c @@ -775,7 +775,7 @@ bfd_start_neighbor(struct bfd_proto *p, struct bfd_neighbor *n) return; } - struct neighbor *nb = neigh_find2(&p->p, &n->addr, n->iface, NEF_STICKY); + struct neighbor *nb = neigh_find(&p->p, n->addr, n->iface, NEF_STICKY); if (!nb) { log(L_ERR "%s: Invalid remote address %I%J", p->p.name, n->addr, n->iface); diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index 932ad9f3..ced83c5c 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -1277,7 +1277,7 @@ bgp_start_locked(struct object_lock *lock) return; } - neighbor *n = neigh_find2(&p->p, &cf->remote_ip, cf->iface, NEF_STICKY); + neighbor *n = neigh_find(&p->p, cf->remote_ip, cf->iface, NEF_STICKY); if (!n) { log(L_ERR "%s: Invalid remote address %I%J", p->p.name, cf->remote_ip, cf->iface); @@ -1521,7 +1521,7 @@ bgp_channel_start(struct channel *C) if (ipa_zero(c->next_hop_addr)) { /* We know the iface for single-hop, we make lookup for multihop */ - struct neighbor *nbr = p->neigh ?: neigh_find2(&p->p, &src, NULL, 0); + struct neighbor *nbr = p->neigh ?: neigh_find(&p->p, src, NULL, 0); struct iface *iface = nbr ? nbr->iface : NULL; if (bgp_channel_is_ipv4(c) && iface && iface->addr4) diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index aa08732d..190fd6fe 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -744,9 +744,9 @@ bgp_apply_next_hop(struct bgp_parse_state *s, rta *a, ip_addr gw, ip_addr ll) /* GW_DIRECT -> single_hop -> p->neigh != NULL */ if (ipa_nonzero(gw)) - nbr = neigh_find2(&p->p, &gw, NULL, 0); + nbr = neigh_find(&p->p, gw, NULL, 0); else if (ipa_nonzero(ll)) - nbr = neigh_find2(&p->p, &ll, p->neigh->iface, 0); + nbr = neigh_find(&p->p, ll, p->neigh->iface, 0); if (!nbr || (nbr->scope == SCOPE_HOST)) WITHDRAW(BAD_NEXT_HOP); diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c index b4f9b067..4549ce2a 100644 --- a/proto/ospf/rt.c +++ b/proto/ospf/rt.c @@ -1987,7 +1987,7 @@ again1: for (nh = nf->n.nhs; nh; nh = nh->next) if (ipa_nonzero(nh->gw)) { - neighbor *ng = neigh_find2(&p->p, &nh->gw, nh->iface, 0); + neighbor *ng = neigh_find(&p->p, nh->gw, nh->iface, 0); if (!ng || (ng->scope == SCOPE_HOST)) { reset_ri(nf); break; } } diff --git a/proto/rip/packets.c b/proto/rip/packets.c index 891f454f..1b65362f 100644 --- a/proto/rip/packets.c +++ b/proto/rip/packets.c @@ -627,7 +627,7 @@ rip_receive_response(struct rip_proto *p, struct rip_iface *ifa, struct rip_pack if (ipa_nonzero(rte.next_hop)) { - neighbor *nbr = neigh_find2(&p->p, &rte.next_hop, ifa->iface, 0); + neighbor *nbr = neigh_find(&p->p, rte.next_hop, ifa->iface, 0); if (!nbr || (nbr->scope <= 0)) rte.next_hop = IPA_NONE; } diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 90bf8e5c..2838d425 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -377,7 +377,7 @@ rip_rt_notify(struct proto *P, struct channel *ch UNUSED, struct network *net, s struct rip_neighbor * rip_get_neighbor(struct rip_proto *p, ip_addr *a, struct rip_iface *ifa) { - neighbor *nbr = neigh_find2(&p->p, a, ifa->iface, 0); + neighbor *nbr = neigh_find(&p->p, *a, ifa->iface, 0); if (!nbr || (nbr->scope == SCOPE_HOST) || !rip_iface_link_up(ifa)) return NULL; diff --git a/proto/static/static.c b/proto/static/static.c index 8dfa6f35..40096c16 100644 --- a/proto/static/static.c +++ b/proto/static/static.c @@ -205,10 +205,9 @@ static_add_rte(struct static_proto *p, struct static_route *r) for (r2 = r; r2; r2 = r2->mp_next) { - n = ipa_nonzero(r2->via) ? - neigh_find2(&p->p, &r2->via, r2->iface, - NEF_STICKY | (r2->onlink ? NEF_ONLINK : 0)) : - neigh_find_iface(&p->p, r2->iface); + n = neigh_find(&p->p, r2->via, r2->iface, NEF_STICKY | + (r2->onlink ? NEF_ONLINK : 0) | + (ipa_zero(r2->via) ? NEF_IFACE : 0)); if (!n) { |