From 93224ddd302f5426b9700b1a2ef8c643760e48e9 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 6 Mar 2025 16:09:36 +0100 Subject: [PATCH] BGP: Fix reconfiguration of hostname option The old code did not properly compare and update hostname strings, causing BGP restarts during reconfigurations. --- proto/bgp/bgp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index e17f47ae0..7ae03a06a 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -2217,7 +2217,7 @@ bgp_reconfigure(struct proto *P, struct proto_config *CF) if (proto_get_router_id(CF) != p->local_id) return 0; - if (proto_get_hostname(CF) != p->hostname) + if (bstrcmp(proto_get_hostname(CF), p->hostname)) return 0; int same = !memcmp(((byte *) old) + sizeof(struct proto_config), @@ -2259,6 +2259,7 @@ bgp_reconfigure(struct proto *P, struct proto_config *CF) /* We should update our copy of configuration ptr as old configuration will be freed */ p->cf = new; + p->hostname = proto_get_hostname(CF); /* Check whether existing connections are compatible with required capabilities */ struct bgp_conn *ci = &p->incoming_conn; -- 2.47.2