diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2023-08-22 01:24:21 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2023-08-22 01:26:06 +0200 |
commit | 4558adabfbbe3696156d20767168010d6238f434 (patch) | |
tree | 43f17ffb951f75cb3dc70401b98a422dada87b8b /proto/bgp/packets.c | |
parent | 52641e086675832e9f43f86237b0cddbd5ec551e (diff) |
BMP: Improve peer_down handling
Move all bmp_peer_down() calls to one place and make it synchronous with
BGP session down, ensuring that BMP receives peer_down before route
withdraws from flushing.
Also refactor bmp_peer_down_() message generating code.
Diffstat (limited to 'proto/bgp/packets.c')
-rw-r--r-- | proto/bgp/packets.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 2f1ff659..6b728b4e 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -3042,7 +3042,6 @@ bgp_fire_tx(struct bgp_conn *conn) { conn->packets_to_send = 1 << PKT_SCHEDULE_CLOSE; end = bgp_create_notification(conn, pkt); - bmp_peer_down(p, BE_BGP_TX, pkt, end - pkt); return bgp_send(conn, PKT_NOTIFICATION, end - buf); } else if (s & (1 << PKT_OPEN)) @@ -3334,6 +3333,11 @@ bgp_rx_notification(struct bgp_conn *conn, byte *pkt, uint len) bgp_log_error(p, BE_BGP_RX, "Received", code, subcode, pkt+21, len-21); bgp_store_error(p, conn, BE_BGP_RX, (code << 16) | subcode); + conn->notify_code = code; + conn->notify_subcode = subcode; + conn->notify_data = pkt+21; + conn->notify_size = len-21; + bgp_conn_enter_close_state(conn); bgp_schedule_packet(conn, NULL, PKT_SCHEDULE_CLOSE); @@ -3352,8 +3356,6 @@ bgp_rx_notification(struct bgp_conn *conn, byte *pkt, uint len) p->p.disabled = 1; } } - - bmp_peer_down(p, BE_BGP_RX, pkt + BGP_HEADER_LENGTH, len - BGP_HEADER_LENGTH); } static void |