]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit '575da88f' into haugesund
authorMaria Matejka <mq@ucw.cz>
Wed, 9 Mar 2022 12:37:12 +0000 (13:37 +0100)
committerMaria Matejka <mq@ucw.cz>
Wed, 9 Mar 2022 12:37:12 +0000 (13:37 +0100)
Conflicts:
nest/rt-table.c

1  2 
nest/rt-table.c

diff --cc nest/rt-table.c
index 9a9d57ad37253f01bf0d42245c92c2bc81a8bbf8,837e0ab9fadc8156871dcb179db0f33e0ab01559..2fa4f5160e7610283759fb87f1f4639020ddbb3b
@@@ -2516,28 -1870,29 +2516,32 @@@ rt_flowspec_update_rte(rtable *tab, ne
  static inline int
  rt_next_hop_update_net(rtable *tab, net *n)
  {
-   struct rte_storage **k, *e, *new, *old_best, **new_best;
+   struct rte_storage *new;
    int count = 0;
-   int free_old_best = 0;
++  int is_flow = net_is_flow(n->n.addr);
  
-   old_best = n->routes;
+   struct rte_storage *old_best = n->routes;
    if (!old_best)
      return 0;
  
-   for (k = &n->routes; e = *k; k = &e->next)
-   {
-     if (!net_is_flow(n->n.addr))
-       new = rt_next_hop_update_rte(tab, n, &e->rte);
-     else
-       new = rt_flowspec_update_rte(tab, n, &e->rte);
+   for (struct rte_storage *e, **k = &n->routes; e = *k; k = &e->next)
 -    if (rta_next_hop_outdated(e->rte.attrs))
++    if (is_flow || rta_next_hop_outdated(e->rte.attrs))
+       count++;
  
-     if (new)
-       {
-       new->next = e->next;
-       *k = new;
+   if (!count)
+     return 0;
+   struct rte_multiupdate {
+     struct rte_storage *old, *new;
+   } *updates = alloca(sizeof(struct rte_multiupdate) * count);
  
-       rte_trace_in(D_ROUTES, new->rte.sender, &new->rte, "updated");
-       rte_announce_i(tab, RA_ANY, n, new, e, NULL, NULL);
+   int pos = 0;
+   for (struct rte_storage *e, **k = &n->routes; e = *k; k = &e->next)
 -    if (rta_next_hop_outdated(e->rte.attrs))
++    if (is_flow || rta_next_hop_outdated(e->rte.attrs))
+       {
 -      struct rte_storage *new = rt_next_hop_update_rte(tab, n, &e->rte);
++      struct rte_storage *new = is_flow
++        ? rt_flowspec_update_rte(tab, n, &e->rte)
++        : rt_next_hop_update_rte(tab, n, &e->rte);
  
        /* Call a pre-comparison hook */
        /* Not really an efficient way to compute this */