]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Nest: Avoid spurious announcements triggered by filtered routes
authorOndrej Zajicek <santiago@crfreenet.org>
Tue, 6 Dec 2022 18:40:02 +0000 (19:40 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Tue, 6 Dec 2022 18:51:50 +0000 (19:51 +0100)
When filtered routes (enabled by 'import keep filtered' option) are
updated, they trigger announcements by rte_announce(). For regular
channels (e.g. type RA_OPTIMAL or RA_ANY) such announcement is just
ignored, but in case of RA_ACCEPTED (BGP peer with 'secondary' option)
it just reannounces the old (and still valid) best route.

The patch ensures that such no-change is ignored even for these channels.

nest/rt-table.c

index cb8c56a611ee89e653bdf7479c8baa46f20411b1..845b2483d351602e9cb7842c8d1cbb1bb3bfc825 100644 (file)
@@ -1112,7 +1112,20 @@ rte_announce(rtable *tab, uint type, net *net, rte *new, rte *old,
       break;
 
     case RA_ACCEPTED:
-      rt_notify_accepted(c, net, new, old, 0);
+      /*
+       * The (new != old) condition is problematic here, as it would break
+       * the second usage pattern (announcement after bulk change, used in
+       * rt_next_hop_update_net(), which sends both new and old as NULL).
+       *
+       * But recursive next hops do not work with sorted tables anyways,
+       * such configuration is forbidden in BGP and not supported in
+       * rt_notify_accepted().
+       *
+       * The condition is needed to eliminate spurious announcements where
+       * both old and new routes are not valid (so they are NULL).
+       */
+      if (new != old)
+       rt_notify_accepted(c, net, new, old, 0);
       break;
 
     case RA_MERGED: