aboutsummaryrefslogtreecommitdiffstats
path: root/nest
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2022-10-10 05:06:19 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2022-10-10 05:06:19 +0200
commit8f79e6b93e32a4eb7e4dda9bd4a9d04400b79d45 (patch)
tree3fb00fa2a37787df14866f9049b6a4003bb558b1 /nest
parent8478de8817c58af02f7aed1d621013891115a2dc (diff)
downloadbird-8f79e6b93e32a4eb7e4dda9bd4a9d04400b79d45.tar.gz
BGP: Add option 'next hop prefer global'
Add BGP channel option 'next hop prefer global' that modifies BGP recursive next hop resolution to use global next hop IPv6 address instead of link-local next hop IPv6 address for immediate next hop of received routes.
Diffstat (limited to 'nest')
-rw-r--r--nest/rt-table.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 4127912c..cb8c56a6 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -3603,6 +3603,7 @@ rt_update_hostcache(rtable *tab)
struct hostentry *
rt_get_hostentry(rtable *tab, ip_addr a, ip_addr ll, rtable *dep)
{
+ ip_addr link = ipa_zero(ll) ? a : ll;
struct hostentry *he;
if (!tab->hostcache)
@@ -3611,10 +3612,10 @@ rt_get_hostentry(rtable *tab, ip_addr a, ip_addr ll, rtable *dep)
u32 k = hc_hash(a, dep);
struct hostcache *hc = tab->hostcache;
for (he = hc->hash_table[k >> hc->hash_shift]; he != NULL; he = he->next)
- if (ipa_equal(he->addr, a) && (he->tab == dep))
+ if (ipa_equal(he->addr, a) && ipa_equal(he->link, link) && (he->tab == dep))
return he;
- he = hc_new_hostentry(hc, tab->rp, a, ipa_zero(ll) ? a : ll, dep, k);
+ he = hc_new_hostentry(hc, tab->rp, a, link, dep, k);
rt_update_hostentry(tab, he);
return he;
}