Hello BIRD team!
This simple patch (for branch master) adds a field for the BGP channel gateway
mode (direct or recursive) setting in show protocol output. It is is a useful
information to have in some troubleshooting scenario.
Example:
bird> show protocol all bgp_test
Name Proto Table State Since
Info
bgp_test BGP --- up 2025-08-12
15:11:54 Established
BGP state: Established
[...]
Channel ipv6
State: UP
[...]
Gateway: recursive
[...]
Thanks!
--
SébastienFrom a693c7f9d8c8dde0d6a3ecd4abe4ffc3398f5ad1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Parisot?= <[email protected]>
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