From de64c80119c14d733e465a0f428f3eff7aee6e74 Mon Sep 17 00:00:00 2001
From: Maria Matejka <mq@ucw.cz>
Date: Wed, 25 Jun 2025 13:00:11 +0200
Subject: BGP: restart on outgoing next hop setting change

When next hop self / keep / address changed, BGP only reloaded
the exports but it didn't apply the changes. To fix this problem
before actually implementing a proper change detection algorithm,
we restart the protocol if this setting changes.

Fixes #280.

diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index d38666fab..d8a4a69eb 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -2851,10 +2851,13 @@ bgp_channel_reconfigure(struct channel *C, struct channel_config *CC, int *impor
     *import_changed = 1;
   }
 
+  /* 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) ||
-      (new->llnh_format != old->llnh_format) ||
+      (new->next_hop_keep != old->next_hop_keep))
+    return 0;
+
+  if ((new->llnh_format != old->llnh_format) ||
       (new->aigp != old->aigp) ||
       (new->aigp_originate != old->aigp_originate))
     *export_changed = 1;
