An handler is added to signify that a remote notification has been received, meaning that local BGP speaker should be shutdown.
Signed-off-by: Philippe Guibert <philippe.guib...@6wind.com> --- bgpd/bgp_debug.c | 11 +++++++++++ bgpd/bgp_zmq.c | 9 +++++++++ bgpd/bgpd.h | 12 +++++++----- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index ba7972281342..369e27ce4944 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -248,6 +248,17 @@ bgp_notify_print(struct peer *peer, struct bgp_notify *bgp_notify, const char *subcode_str; const char *code_str; +#ifdef HAVE_ZEROMQ + if(!strcmp(direct,"received")) + { + struct bgp_event_shut shut = { + .peer = peer->remote_id, + .type = bgp_notify->code, + .subtype = bgp_notify->subcode + }; + bgp_notify_shut (peer->bgp, &shut); + } +#endif /* HAVE_ZEROMQ */ subcode_str = ""; code_str = LOOKUP_DEF (bgp_notify_msg, bgp_notify->code, "Unrecognized Error Code"); diff --git a/bgpd/bgp_zmq.c b/bgpd/bgp_zmq.c index d2e7fb14d40b..66bd27a66126 100644 --- a/bgpd/bgp_zmq.c +++ b/bgpd/bgp_zmq.c @@ -102,4 +102,13 @@ bgp_notify_route (struct bgp *bgp, struct bgp_event_vrf *update) void bgp_notify_shut (struct bgp *bgp, struct bgp_event_shut *shut) { + struct bgp_event_vrf msg; + + /* encapsulate message in bgp_event_vrf structure */ + memset(&msg, 0, sizeof(struct bgp_event_vrf)); + msg.announce = BGP_EVENT_SHUT; + msg.nexthop.s_addr = shut->peer.s_addr; + msg.label = shut->type; + msg.prefix.prefix.s_addr = shut->subtype; + bgp_notify_send (bgp, &msg); } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index f1de8bbc847b..56e519e02cb5 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -267,11 +267,13 @@ struct bgp_vrf struct bgp_event_vrf { - bool announce; - struct prefix_rd outbound_rd; - struct prefix_ipv4 prefix; - struct in_addr nexthop; - uint32_t label; +#define BGP_EVENT_MASK_ANNOUNCE 0x1 +#define BGP_EVENT_SHUT 0x2 + uint8_t announce; + struct prefix_rd outbound_rd; /* dummy for event_shut */ + struct prefix_ipv4 prefix; /* alias subtype */ + struct in_addr nexthop; /* alias peer */ + uint32_t label; /* alias type */ }; struct bgp_event_shut -- 2.1.4 _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev