]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Ensure mpath data is only on bestpath
authorDonald Sharp <sharpd@nvidia.com>
Thu, 26 Sep 2024 14:46:23 +0000 (10:46 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 1 Oct 2024 16:25:57 +0000 (12:25 -0400)
The mpath data structure has data that is only relevant
for the first mpath in the list.  It is not being used
anywhere else.  Let's document that a bit more.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_mpath.c
bgpd/bgp_mpath.h

index 3421b00ba75ba03ceded8fcf41963c38fc5eaa45..3b8b2745566397c5c26f813bc8c30d08a3fbe703 100644 (file)
@@ -411,6 +411,10 @@ static void bgp_path_info_mpath_count_set(struct bgp_path_info *path,
  * bgp_path_info_mpath_lb_update
  *
  * Update cumulative info related to link-bandwidth
+ *
+ * This is only set on the first mpath of the list
+ * as such we should UNSET the flags when removing
+ * to ensure nothing accidently happens
  */
 static void bgp_path_info_mpath_lb_update(struct bgp_path_info *path, bool set,
                                          bool all_paths_lb, uint64_t cum_bw)
index 129682d1dc19c3c796fa8fb5e45da1b35af3eef1..267d729e06d446a0b2bb57f56dce3921634e8970 100644 (file)
@@ -25,15 +25,18 @@ struct bgp_path_info_mpath {
        /* When attached to best path, the number of selected multipaths */
        uint16_t mp_count;
 
-       /* Flags - relevant as noted. */
+       /* Flags - relevant as noted, attached to bestpath. */
        uint16_t mp_flags;
 #define BGP_MP_LB_PRESENT 0x1 /* Link-bandwidth present for >= 1 path */
 #define BGP_MP_LB_ALL 0x2 /* Link-bandwidth present for all multipaths */
 
-       /* Aggregated attribute for advertising multipath route */
+       /*
+        * Aggregated attribute for advertising multipath route,
+        * attached to bestpath
+        */
        struct attr *mp_attr;
 
-       /* Cumulative bandiwdth of all multipaths - attached to best path. */
+       /* Cumulative bandiwdth of all multipaths - attached to bestpath. */
        uint64_t cum_bw;
 };