]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: beginning to add rib_uptime field for loc-rib timestamp
authormxyns <mx.yns@outlook.fr>
Fri, 29 Jul 2022 18:06:08 +0000 (20:06 +0200)
committerMaxence Younsi <mx.yns@outlook.fr>
Sat, 4 Nov 2023 11:17:48 +0000 (12:17 +0100)
added time_t field to bgp_path_info
set value before bgp dp hook is called
value not set in the msg yet, testing and double checking is needed before

Signed-off-by: Maxence Younsi <mx.yns@outlook.fr>
bgpd/bgp_bmp.c
bgpd/bgp_route.c
bgpd/bgp_route.h

index 6a48cb3e5ca41df13f47e384d0e8ecbcf802e781..f74647f09437564ebc810eaf5404ec6692ca6e13 100644 (file)
@@ -1165,7 +1165,7 @@ afibreak:
            CHECK_FLAG(bmp->targets->afimon[afi][safi], BMP_MON_LOC_RIB)) {
                bmp_monitor(bmp, bpi->peer, 0, BMP_PEER_TYPE_LOC_RIB_INSTANCE,
                            bmp_get_peer_distinguisher(bmp, afi), bn_p, prd,
-                           bpi->attr, afi, safi, bpi->uptime);
+                           bpi->attr, afi, safi, bpi->rib_uptime);
        }
 
        if (bpi && CHECK_FLAG(bpi->flags, BGP_PATH_VALID)
@@ -1322,7 +1322,7 @@ static bool bmp_wrqueue_locrib(struct bmp *bmp, struct pullwr *pullwr)
        bmp_monitor(bmp, peer, 0, BMP_PEER_TYPE_LOC_RIB_INSTANCE,
                    bmp_get_peer_distinguisher(bmp, afi), &bqe->p, prd,
                    bpi ? bpi->attr : NULL, afi, safi,
-                   bpi ? bpi->uptime : monotime(NULL));
+                   bpi ? bpi->rib_uptime : monotime(NULL));
        written = true;
 
 out:
index 7333d5a432f2cf04df6026aff8aa1006163d3f7a..9353b64f305b06cbf1df9a54a97e1528953b1f4e 100644 (file)
@@ -3457,6 +3457,11 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
                zlog_info("old_select==NULL %s | new_select==NULL %s",
                          old_select == NULL ? "YES" : "NO",
                          new_select == NULL ? "YES" : "NO");
+
+               if (old_select) /* route is not installed in locrib anymore */
+                       old_select->rib_uptime = (time_t)(-1L);
+               if (new_select) /* route is installed in locrib from now on */
+                       new_select->rib_uptime = bgp_clock();
                bool is_withdraw = old_select && !new_select;
 
                hook_call(bgp_route_update, bgp, afi, safi, dest,
@@ -3989,6 +3994,7 @@ struct bgp_path_info *info_make(int type, int sub_type, unsigned short instance,
        new->peer = peer;
        new->attr = attr;
        new->uptime = monotime(NULL);
+       new->rib_uptime = (time_t)(-1L);
        new->net = dest;
        return new;
 }
index f83453974282e9e7c884a2c2033c97cc94be87af..232d680188e5f25642b415821a0d4157c9df7149 100644 (file)
@@ -295,6 +295,7 @@ struct bgp_path_info {
 
        /* Uptime.  */
        time_t uptime;
+       time_t rib_uptime;
 
        /* reference count */
        int lock;