]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: We try to skip out of updating the multipath aggregate if there are no
authorJosh Bailey <joshb@google.com>
Thu, 21 Jul 2011 03:52:06 +0000 (20:52 -0700)
committerJosh Bailey <joshb@google.com>
Thu, 21 Jul 2011 03:52:06 +0000 (20:52 -0700)
changes in the multipath set or attributes, but failed to check for
just a bestpath change. The result is there is no attribute on the new
bestpath and we hit the assert. Added the bestpath check and
rearranged the code to only check attributes when there is no bestpath
or multipath change, so we only scan the for attribute changes when
necessary.

* bgpd/bgp_mpath.c
  * bgp_info_mpath_aggregate_update(): Added check for bestpath
    change before skipping the aggregate generation. Skip the attribute
    check if either the multipath set or bestpath has changed.

bgpd/bgp_mpath.c

index 1709c24484921c5f8bbd3ca79340066c2dd68251..d07830d14db7394c63843915e7be47d3ca91ce9d 100644 (file)
@@ -626,25 +626,32 @@ bgp_info_mpath_aggregate_update (struct bgp_info *new_best,
   /*
    * Bail out here if the following is true:
    * - MULTIPATH_CHG bit is not set on new_best, and
+   * - No change in bestpath, and
    * - ATTR_CHANGED bit is not set on new_best or any of the multipaths
    */
-  attr_chg = 0;
-  if (CHECK_FLAG (new_best->flags, BGP_INFO_ATTR_CHANGED))
-    attr_chg = 1;
-  else
-    for (mpinfo = bgp_info_mpath_first (new_best); mpinfo;
-         mpinfo = bgp_info_mpath_next (mpinfo))
-      {
-        if (CHECK_FLAG (mpinfo->flags, BGP_INFO_ATTR_CHANGED))
+  if (!CHECK_FLAG (new_best->flags, BGP_INFO_MULTIPATH_CHG) &&
+      (old_best == new_best))
+    {
+      attr_chg = 0;
+
+      if (CHECK_FLAG (new_best->flags, BGP_INFO_ATTR_CHANGED))
+        attr_chg = 1;
+      else
+        for (mpinfo = bgp_info_mpath_first (new_best); mpinfo;
+             mpinfo = bgp_info_mpath_next (mpinfo))
           {
-            attr_chg = 1;
-            break;
+            if (CHECK_FLAG (mpinfo->flags, BGP_INFO_ATTR_CHANGED))
+              {
+                attr_chg = 1;
+                break;
+              }
           }
-      }
-  if (!CHECK_FLAG (new_best->flags, BGP_INFO_MULTIPATH_CHG) && !attr_chg)
-    {
-      assert (bgp_info_mpath_attr (new_best));
-      return;
+
+      if (!attr_chg)
+        {
+          assert (bgp_info_mpath_attr (new_best));
+          return;
+        }
     }
 
   bgp_attr_dup (&attr, new_best->attr);