summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
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 /proto/bgp/bgp.c
parent8478de8817c58af02f7aed1d621013891115a2dc (diff)
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 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index e1e0d796..ad78d5e5 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -2037,6 +2037,10 @@ bgp_postconfig(struct proto_config *CF)
if (!cc->gw_mode)
cc->gw_mode = cf->multihop ? GW_RECURSIVE : GW_DIRECT;
+ /* Different default for next_hop_prefer */
+ if (!cc->next_hop_prefer)
+ cc->next_hop_prefer = (cc->gw_mode == GW_DIRECT) ? NHP_GLOBAL : NHP_LOCAL;
+
/* Defaults based on proto config */
if (cc->gr_able == 0xff)
cc->gr_able = (cf->gr_mode == BGP_GR_ABLE);
@@ -2167,6 +2171,7 @@ bgp_channel_reconfigure(struct channel *C, struct channel_config *CC, int *impor
return 0;
if ((new->gw_mode != old->gw_mode) ||
+ (new->next_hop_prefer != old->next_hop_prefer) ||
(new->aigp != old->aigp) ||
(new->cost != old->cost))
{