]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: Fix reconfiguration of hostname option
authorOndrej Zajicek <santiago@crfreenet.org>
Thu, 6 Mar 2025 15:09:36 +0000 (16:09 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Thu, 6 Mar 2025 15:09:36 +0000 (16:09 +0100)
The old code did not properly compare and update hostname strings,
causing BGP restarts during reconfigurations.

proto/bgp/bgp.c

index e17f47ae05ac7169b1efa277a40b62359ab12891..7ae03a06a9ca91f76a5176e5cb3914abdef460bd 100644 (file)
@@ -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;