From b4e228d141b327fb19b862180f0fd03dc058a782 Mon Sep 17 00:00:00 2001
From: Maria Matejka <mq@ucw.cz>
Date: Tue, 29 Jul 2025 14:15:08 +0200
Subject: BGP: Do not restart when next hop keep/self is changed

The change in dade7147eb6b62b2d58d478a370baef513d96975 forces BGP to restart
even if next hop self and next hop keep changes, which can be updated just by
reloading export, while explicit next hop address can not.

Related to #280.

diff --git a/doc/bird.sgml b/doc/bird.sgml
index 3e024f4c1..6595dc327 100644
--- a/doc/bird.sgml
+++ b/doc/bird.sgml
@@ -3925,7 +3925,6 @@ direction (re-export of routes to the BGP neighbor):
 
 <itemize>
 	<item><cf/export/
-	<item><cf/next hop address/
 	<item><cf/next hop self/
 	<item><cf/next hop keep/
 	<item><cf/link local next hop format/
@@ -3962,6 +3961,7 @@ direction (re-export of routes to the BGP neighbor):
 	<item><cf/graceful restart/
 	<item><cf/long lived graceful restart/
 	<item><cf/long lived stale time/
+	<item><cf/next hop address/
 	<item><cf/extended next hop/
 	<item><cf/add paths/
 	<item><cf/import table/
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index d8a4a69eb..818edeeba 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -2852,12 +2852,12 @@ bgp_channel_reconfigure(struct channel *C, struct channel_config *CC, int *impor
   }
 
   /* Outgoing next hop setting is too complex to update, forcing restart. */
-  if (!ipa_equal(new->next_hop_addr, old->next_hop_addr) ||
-      (new->next_hop_self != old->next_hop_self) ||
-      (new->next_hop_keep != old->next_hop_keep))
+  if (!ipa_equal(new->next_hop_addr, old->next_hop_addr))
     return 0;
 
-  if ((new->llnh_format != old->llnh_format) ||
+  if ((new->next_hop_self != old->next_hop_self) ||
+      (new->next_hop_keep != old->next_hop_keep) ||
+      (new->llnh_format != old->llnh_format) ||
       (new->aigp != old->aigp) ||
       (new->aigp_originate != old->aigp_originate))
     *export_changed = 1;
