From 63472779ad4ecdecbcfedf2d2bb40abc2f8c84b0 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Tue, 16 Jan 2018 19:17:04 +0100 Subject: BGP: Implement 'disable after cease' option The option allows to specify that some cease subcodes should disable the protocol when received. --- proto/bgp/packets.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'proto/bgp/packets.c') diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index af3b15b5..f0049d3a 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1607,6 +1607,16 @@ bgp_rx_notification(struct bgp_conn *conn, byte *pkt, uint len) bgp_update_startup_delay(p); bgp_stop(p, 0, NULL, 0); } + else + { + uint subcode_bit = 1 << ((subcode <= 8) ? subcode : 0); + if (p->cf->disable_after_cease & subcode_bit) + { + log(L_INFO "%s: Disabled after Cease notification", p->p.name); + p->startup_delay = 0; + p->p.disabled = 1; + } + } } static void -- cgit v1.2.3