summaryrefslogtreecommitdiff
path: root/proto/bmp/bmp.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-08-18 03:53:58 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-08-18 03:53:58 +0200
commitf4deef89bebae6e41654217e20f2a7531c65bf49 (patch)
tree327e77cb6f41bb5e9b47691575cc7f4f2163e0ba /proto/bmp/bmp.h
parentaec21cda249f9460d63c14ca83a9fa4210bcc20d (diff)
BMP: Refactor route monitoring
- Manage BMP state through bmp_peer, bmp_stream, bmp_table structures - Use channels and rt_notify() hook for route announcements - Add support for post-policy monitoring - Send End-of-RIB even when there is no routes - Remove rte_update_in_notify() hook from import tables - Update import tables to support channels - Add bmp_hack (no feed / no flush) flag to channels
Diffstat (limited to 'proto/bmp/bmp.h')
-rw-r--r--proto/bmp/bmp.h37
1 files changed, 29 insertions, 8 deletions
diff --git a/proto/bmp/bmp.h b/proto/bmp/bmp.h
index 0c355754..9b4e2a73 100644
--- a/proto/bmp/bmp.h
+++ b/proto/bmp/bmp.h
@@ -39,6 +39,7 @@ struct bmp_config {
ip_addr station_ip; // Monitoring station address
u16 station_port; // Monitoring station TCP port
bool monitoring_rib_in_pre_policy; // Route monitoring pre-policy Adj-Rib-In
+ bool monitoring_rib_in_post_policy; // Route monitoring post-policy Adj-Rib-In
};
/* Forward declarations */
@@ -49,6 +50,11 @@ struct bmp_proto {
struct proto p; // Parent proto
const struct bmp_config *cf; // Shortcut to BMP configuration
node bmp_node; // Node in bmp_proto_list
+
+ HASH(struct bmp_peer) peer_map;
+ HASH(struct bmp_stream) stream_map;
+ HASH(struct bmp_table) table_map;
+
sock *sk; // TCP connection
event *tx_ev; // TX event
event *update_ev; // Update event
@@ -71,6 +77,28 @@ struct bmp_proto {
int sock_err; // Last socket error code
};
+struct bmp_peer {
+ struct bgp_proto *bgp;
+ struct bmp_peer *next;
+ list streams;
+};
+
+struct bmp_stream {
+ node n;
+ struct bgp_proto *bgp;
+ u32 key;
+ struct bmp_stream *next;
+ struct bmp_table *table;
+ struct bgp_channel *sender;
+};
+
+struct bmp_table {
+ struct rtable *table;
+ struct bmp_table *next;
+ struct channel *channel;
+ u32 uc;
+};
+
#ifdef CONFIG_BMP
@@ -78,18 +106,11 @@ struct bmp_proto {
* bmp_peer_up - send notification that BGP peer connection is established
*/
void
-bmp_peer_up(const struct bgp_proto *bgp,
+bmp_peer_up(struct bgp_proto *bgp,
const byte *tx_open_msg, uint tx_open_length,
const byte *rx_open_msg, uint rx_open_length);
/**
- * bmp_route_monitor_update_in_notify - send notification that rte vas received
- */
-void
-bmp_route_monitor_update_in_notify(struct channel *C, const net_addr *n,
- const struct rte *new, const struct rte_src *src);
-
-/**
* bmp_peer_down - send notification that BGP peer connection is not in
* established state
*/