From b84d6a4a9ea644b4a085b06771438a26d4ddb513 Mon Sep 17 00:00:00 2001 From: Andreas Scholdan Date: Wed, 14 Oct 2026 20:32:49 +0200 Subject: [PATCH] BGP: Add gshut command for graceful shutdown (RFC 8326) Operators draining a router before maintenance want to attach the well-known GRACEFUL_SHUTDOWN community (65535, 0) to all routes exported to a neighbor, so the neighbor can deprefer them before the session is taken down. Until now this needed a filter condition on a define and a reconfigure for what is really a runtime state change. Add a per-protocol runtime flag toggled by "gshut [off] ", modelled on the existing per-peer community handling in export. While set, bgp_update_attrs() adds the community to every exported route and the channels are refed so the change goes out immediately. The flag is kept across reconfiguration of a running instance, also when the instance is restarted, and is inherited by sessions spawned from a dynamic BGP listener. It is shown in "show protocols all". This covers the outbound signalling of the RFC 8326 procedure. Lowering the preference of received routes carrying the community stays in import filters, and shutting the session down afterwards stays with the operator, as the command deliberately does not touch the session. Target: minor --- doc/bird.sgml | 18 +++++++++++++++++ proto/bgp/attrs.c | 10 ++++++++++ proto/bgp/bgp.c | 49 +++++++++++++++++++++++++++++++++++++++++++++- proto/bgp/bgp.h | 4 ++++ proto/bgp/config.Y | 8 +++++++- 5 files changed, 87 insertions(+), 2 deletions(-) diff --git a/doc/bird.sgml b/doc/bird.sgml index 660ea4c..e9d2071 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -1544,6 +1544,24 @@ This argument can be omitted if there exists only a single instance. Enable, disable or restart a given protocol instance, instances matching the or