From 8f79e6b93e32a4eb7e4dda9bd4a9d04400b79d45 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Mon, 10 Oct 2022 05:06:19 +0200 Subject: 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. --- proto/bgp/packets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'proto/bgp/packets.c') diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 8087608a..c464e9c7 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1020,7 +1020,8 @@ bgp_apply_next_hop(struct bgp_parse_state *s, rta *a, ip_addr gw, ip_addr ll) WITHDRAW(BAD_NEXT_HOP " - zero address"); rtable *tab = ipa_is_ip4(gw) ? c->igp_table_ip4 : c->igp_table_ip6; - s->hostentry = rt_get_hostentry(tab, gw, ll, c->c.table); + ip_addr lla = (c->cf->next_hop_prefer == NHP_LOCAL) ? ll : IPA_NONE; + s->hostentry = rt_get_hostentry(tab, gw, lla, c->c.table); if (!s->mpls) rta_apply_hostentry(a, s->hostentry, NULL); -- cgit v1.2.3