From a693c7f9d8c8dde0d6a3ecd4abe4ffc3398f5ad1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Parisot?= <sparisot@iliad-free.fr>
Date: Mon, 25 Aug 2025 14:28:47 +0200
Subject: [PATCH] BGP: Display gateway mode in show protocol output

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

diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index ad51e626..9b9b1051 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -3028,6 +3028,16 @@ bgp_show_afis(int code, char *s, u32 *afis, uint count)
   cli_msg(code, b.start);
 }
 
+const char *
+bgp_format_gw_mode(u8 gw_mode)
+{
+  if (gw_mode == GW_DIRECT)
+    return "direct";
+  if (gw_mode == GW_RECURSIVE)
+    return "recursive";
+  return "?";
+}
+
 const char *
 bgp_format_role_name(u8 role)
 {
@@ -3278,6 +3288,8 @@ bgp_show_proto_info(struct proto *P)
       if (c->stale_timer && tm_active(c->stale_timer))
 	cli_msg(-1006, "    LL stale timer: %t/-", tm_remains(c->stale_timer));
 
+      cli_msg(-1006, "    Gateway: %s", bgp_format_gw_mode(c->cf->gw_mode));
+
       if (c->c.channel_state == CS_UP)
       {
 	if (ipa_zero(c->link_addr))
-- 
2.39.5

