From bda51a9456b4b3c4a07ddc04ecf026808b696259 Mon Sep 17 00:00:00 2001
From: tomasmatus <tomatus777@tomatus.cz>
Date: Fri, 20 Feb 2026 17:59:37 +0100
Subject: [PATCH] FIX: BGP EVPN AF always sets next-hop address in IPv6 format

---
 proto/bgp/packets.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 694d2bf5..a13c4b3f 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -1389,6 +1389,12 @@ bgp_encode_next_hop_ip(struct bgp_write_state *s, eattr *a, byte *buf, uint size
     return 4;
   }
 
+  if (bgp_channel_is_l2vpn(s->channel) && ipa_is_ip4(nh[0]) && !s->channel->ext_next_hop)
+  {
+    put_ip4(buf, ipa_to_ip4(nh[0]));
+    return 4;
+  }
+
   /* Handle variants of link-local-only next hop */
   if (ipa_zero(nh[0]) && (len == 32))
   {
-- 
2.53.0

