]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_bmp.c
Merge pull request #9440 from dlqs/dplanehook2
[mirror_frr.git] / bgpd / bgp_bmp.c
index f733042f7ede1c596a0896ae788b09a493411f34..1bc3fd0dbae7226f5f78cfd2735b37b52345fe25 100644 (file)
@@ -34,7 +34,7 @@
 #include "lib_errors.h"
 #include "stream.h"
 #include "libfrr.h"
-#include "version.h"
+#include "lib/version.h"
 #include "jhash.h"
 #include "termtable.h"
 
@@ -89,7 +89,7 @@ static uint32_t bmp_bgp_hash(const struct bmp_bgp *e)
        return jhash(&e->bgp, sizeof(e->bgp), 0x55aa5a5a);
 }
 
-DECLARE_HASH(bmp_bgph, struct bmp_bgp, bbi, bmp_bgp_cmp, bmp_bgp_hash)
+DECLARE_HASH(bmp_bgph, struct bmp_bgp, bbi, bmp_bgp_cmp, bmp_bgp_hash);
 
 struct bmp_bgph_head bmp_bgph;
 
@@ -109,11 +109,11 @@ static uint32_t bmp_bgp_peer_hash(const struct bmp_bgp_peer *e)
 }
 
 DECLARE_HASH(bmp_peerh, struct bmp_bgp_peer, bpi,
-               bmp_bgp_peer_cmp, bmp_bgp_peer_hash)
+               bmp_bgp_peer_cmp, bmp_bgp_peer_hash);
 
 struct bmp_peerh_head bmp_peerh;
 
-DECLARE_LIST(bmp_mirrorq, struct bmp_mirrorq, bmi)
+DECLARE_LIST(bmp_mirrorq, struct bmp_mirrorq, bmi);
 
 /* listener management */
 
@@ -132,7 +132,8 @@ static int bmp_listener_cmp(const struct bmp_listener *a,
        return 0;
 }
 
-DECLARE_SORTLIST_UNIQ(bmp_listeners, struct bmp_listener, bli, bmp_listener_cmp)
+DECLARE_SORTLIST_UNIQ(bmp_listeners, struct bmp_listener, bli,
+                     bmp_listener_cmp);
 
 static int bmp_targets_cmp(const struct bmp_targets *a,
                           const struct bmp_targets *b)
@@ -140,11 +141,11 @@ static int bmp_targets_cmp(const struct bmp_targets *a,
        return strcmp(a->name, b->name);
 }
 
-DECLARE_SORTLIST_UNIQ(bmp_targets, struct bmp_targets, bti, bmp_targets_cmp)
+DECLARE_SORTLIST_UNIQ(bmp_targets, struct bmp_targets, bti, bmp_targets_cmp);
 
-DECLARE_LIST(bmp_session, struct bmp, bsi)
+DECLARE_LIST(bmp_session, struct bmp, bsi);
 
-DECLARE_DLIST(bmp_qlist, struct bmp_queue_entry, bli)
+DECLARE_DLIST(bmp_qlist, struct bmp_queue_entry, bli);
 
 static int bmp_qhash_cmp(const struct bmp_queue_entry *a,
                const struct bmp_queue_entry *b)
@@ -189,7 +190,7 @@ static uint32_t bmp_qhash_hkey(const struct bmp_queue_entry *e)
 }
 
 DECLARE_HASH(bmp_qhash, struct bmp_queue_entry, bhi,
-               bmp_qhash_cmp, bmp_qhash_hkey)
+               bmp_qhash_cmp, bmp_qhash_hkey);
 
 static int bmp_active_cmp(const struct bmp_active *a,
                const struct bmp_active *b)
@@ -206,7 +207,7 @@ static int bmp_active_cmp(const struct bmp_active *a,
        return 0;
 }
 
-DECLARE_SORTLIST_UNIQ(bmp_actives, struct bmp_active, bai, bmp_active_cmp)
+DECLARE_SORTLIST_UNIQ(bmp_actives, struct bmp_active, bai, bmp_active_cmp);
 
 static struct bmp *bmp_new(struct bmp_targets *bt, int bmp_sock)
 {
@@ -364,7 +365,7 @@ static struct stream *bmp_peerstate(struct peer *peer, bool down)
 #define BGP_BMP_MAX_PACKET_SIZE        1024
        s = stream_new(BGP_MAX_PACKET_SIZE);
 
-       if (peer->status == Established && !down) {
+       if (peer_established(peer) && !down) {
                struct bmp_bgp_peer *bbpeer;
 
                bmp_common_hdr(s, BMP_VERSION_3,
@@ -1145,7 +1146,7 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr)
                zlog_info("bmp: skipping queued item for deleted peer");
                goto out;
        }
-       if (peer->status != Established)
+       if (!peer_established(peer))
                goto out;
 
        bn = bgp_node_lookup(bmp->targets->bgp->rib[afi][safi], &bqe->p);
@@ -1322,7 +1323,7 @@ static int bmp_stats(struct thread *thread)
        for (ALL_LIST_ELEMENTS_RO(bt->bgp->peer, node, peer)) {
                size_t count = 0, count_pos, len;
 
-               if (peer->status != Established)
+               if (!peer_established(peer))
                        continue;
 
                s = stream_new(BGP_MAX_PACKET_SIZE);
@@ -2399,6 +2400,8 @@ static int bmp_config_write(struct bgp *bgp, struct vty *vty)
                frr_each (bmp_actives, &bt->actives, ba)
                        vty_out(vty, "  bmp connect %s port %u min-retry %u max-retry %u\n",
                                ba->hostname, ba->port, ba->minretry, ba->maxretry);
+
+               vty_out(vty, " exit\n");
        }
 
        return 0;
@@ -2443,4 +2446,5 @@ static int bgp_bmp_module_init(void)
 
 FRR_MODULE_SETUP(.name = "bgpd_bmp", .version = FRR_VERSION,
                 .description = "bgpd BMP module",
-                .init = bgp_bmp_module_init)
+                .init = bgp_bmp_module_init,
+);