]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit 'ebd807c0b8eb0b7a3dc3371cd4c87ae886c00885' into haugesund
authorMaria Matejka <mq@ucw.cz>
Mon, 30 May 2022 13:27:46 +0000 (15:27 +0200)
committerMaria Matejka <mq@ucw.cz>
Mon, 30 May 2022 13:27:46 +0000 (15:27 +0200)
1  2 
nest/route.h
nest/rt-table.c
proto/babel/babel.c
proto/bgp/attrs.c
proto/ospf/topology.c
proto/rip/rip.c
sysdep/unix/krt.c

diff --cc nest/route.h
index ab8ee258a717c09618403792a55ef8b254272e9e,595acabd96ca8a02ce2823db621256c89fe87b76..1aba218b1a1cb6e0c1a94c98a2f47b1616bd203a
@@@ -480,25 -314,30 +480,25 @@@ static inline net *net_get(rtable *tab
  net *net_get(rtable *tab, const net_addr *addr);
  net *net_route(rtable *tab, const net_addr *n);
  int net_roa_check(rtable *tab, const net_addr *n, u32 asn);
 -rte *rte_find(net *net, struct rte_src *src);
 -rte *rte_get_temp(struct rta *, struct rte_src *src);
 -void rte_update2(struct channel *c, const net_addr *n, rte *new, struct rte_src *src);
 -/* rte_update() moved to protocol.h to avoid dependency conflicts */
 -int rt_examine(rtable *t, net_addr *a, struct proto *p, const struct filter *filter);
 -rte *rt_export_merged(struct channel *c, net *net, rte **rt_free, linpool *pool, int silent);
 -void rt_refresh_begin(rtable *t, struct channel *c);
 -void rt_refresh_end(rtable *t, struct channel *c);
 -void rt_modify_stale(rtable *t, struct channel *c);
 +int rt_examine(rtable *t, net_addr *a, struct channel *c, const struct filter *filter);
 +rte *rt_export_merged(struct channel *c, rte ** feed, uint count, linpool *pool, int silent);
 +void rt_refresh_begin(rtable *t, struct rt_import_request *);
 +void rt_refresh_end(rtable *t, struct rt_import_request *);
 +void rt_modify_stale(rtable *t, struct rt_import_request *);
  void rt_schedule_prune(rtable *t);
 -void rte_dump(rte *);
 -void rte_free(rte *);
 -rte *rte_do_cow(rte *);
 -static inline rte * rte_cow(rte *r) { return (r->flags & REF_COW) ? rte_do_cow(r) : r; }
 -rte *rte_cow_rta(rte *r, linpool *lp);
 +void rte_dump(struct rte_storage *);
- void rte_free(struct rte_storage *, rtable *);
++void rte_free(struct rte_storage *);
 +struct rte_storage *rte_store(const rte *, net *net, rtable *);
  void rt_dump(rtable *);
  void rt_dump_all(void);
 -int rt_feed_channel(struct channel *c);
 -void rt_feed_channel_abort(struct channel *c);
 -int rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *src);
 +void rt_dump_hooks(rtable *);
 +void rt_dump_hooks_all(void);
  int rt_reload_channel(struct channel *c);
  void rt_reload_channel_abort(struct channel *c);
 +void rt_refeed_channel(struct channel *c);
  void rt_prune_sync(rtable *t, int all);
 -int rte_update_out(struct channel *c, const net_addr *n, rte *new, rte *old, rte **old_exported, int refeed);
 +int rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *src);
 +int rte_update_out(struct channel *c, const net_addr *n, rte *new, const rte *old, struct rte_storage **old_exported);
  struct rtable_config *rt_new_table(struct symbol *s, uint addr_type);
  
  static inline int rt_is_ip(rtable *tab)
diff --cc nest/rt-table.c
index 48a75acac8c7138229b92d6727122caf204a0683,1885e602bca1d73fbcd67a3c655da4955e28a35d..b1ea1d9897dc36f4543cdd57c640c9bd974e57a0
@@@ -615,13 -625,21 +615,13 @@@ rte_store(const rte *r, net *net, rtabl
   *
   * rte_free() deletes the given &rte from the routing table it's linked to.
   */
 -void
 -rte_free(rte *e)
 -{
 -  rt_unlock_source(e->src);
 -  if (rta_is_cached(e->attrs))
 -    rta_free(e->attrs);
 -  sl_free(e);
 -}
  
 -static inline void
 -rte_free_quick(rte *e)
 +void
- rte_free(struct rte_storage *e, rtable *tab)
++rte_free(struct rte_storage *e)
  {
 -  rt_unlock_source(e->src);
 -  rta_free(e->attrs);
 +  rt_unlock_source(e->rte.src);
 +  rta_free(e->rte.attrs);
-   sl_free(tab->rte_slab, e);
+   sl_free(e);
  }
  
  static int                            /* Actually better or at least as good as */
@@@ -842,17 -827,17 +842,17 @@@ do_rt_notify(struct channel *c, const n
    if (p->debug & D_ROUTES)
    {
      if (new && old)
 -      rte_trace_out(D_ROUTES, c, new, "replaced");
 +      channel_rte_trace_out(D_ROUTES, c, new, "replaced");
      else if (new)
 -      rte_trace_out(D_ROUTES, c, new, "added");
 +      channel_rte_trace_out(D_ROUTES, c, new, "added");
      else if (old)
 -      rte_trace_out(D_ROUTES, c, old, "removed");
 +      channel_rte_trace_out(D_ROUTES, c, old, "removed");
    }
  
 -  p->rt_notify(p, c, net, new, old);
 +  p->rt_notify(p, c, net, new, old_exported ? &old_exported->rte : old);
  
    if (c->out_table && old_exported)
-     rte_free(old_exported, c->out_table);
 -    rte_free_quick(old_exported);
++    rte_free(old_exported);
  }
  
  static void
@@@ -1466,10 -1486,10 +1466,10 @@@ rte_recalculate(struct rt_import_hook *
  
    if (old)
      {
 -      if (!new)
 +      if (!new_stored)
        hmap_clear(&table->id_map, old->id);
  
-       rte_free(old_stored, table);
 -      rte_free_quick(old);
++      rte_free(old_stored);
      }
  }
  
@@@ -2846,17 -2726,15 +2846,17 @@@ rt_next_hop_update_net(rtable *tab, ne
        n->routes = new;
      }
  
 -  /* Announce the new best route */
 -  if (new != old_best)
 -    rte_trace_in(D_ROUTES, new->sender, new, "updated [best]");
 -
 -  /* Propagate changes */
 -  rte_announce_i(tab, RA_UNDEF, n, NULL, NULL, n->routes, old_best);
 +  /* Announce the changes */
 +  for (int i=0; i<count; i++)
 +  {
 +    _Bool nb = (new == updates[i].new), ob = (old_best == updates[i].old);
 +    const char *best_indicator[2][2] = { { "updated", "updated [-best]" }, { "updated [+best]", "updated [best]" } };
 +    rt_rte_trace_in(D_ROUTES, updates[i].new->rte.sender->req, &updates[i].new->rte, best_indicator[nb][ob]);
 +    rte_announce_i(tab, n, updates[i].new, updates[i].old, new, old_best);
 +  }
  
 -  if (free_old_best)
 -    rte_free_quick(old_best);
 +  for (int i=0; i<count; i++)
-     rte_free(updates[i].old, tab);
++    rte_free(updates[i].old);
  
    return count;
  }
@@@ -3134,32 -3054,17 +3134,32 @@@ rte_update_in(struct channel *c, const 
        goto drop_update;
        }
  
 +      if (!new)
 +      CHANNEL_LIMIT_POP(c, RX);
 +
        /* Move iterator if needed */
 -      if (old == c->reload_next_rte)
 -      c->reload_next_rte = old->next;
 +      if (*pos == c->reload_next_rte)
 +      c->reload_next_rte = (*pos)->next;
  
        /* Remove the old rte */
 -      *pos = old->next;
 -      rte_free_quick(old);
 +      struct rte_storage *del = *pos;
 +      *pos = (*pos)->next;
-       rte_free(del, tab);
++      rte_free(del);
        tab->rt_count--;
 +    }
 +  else if (new)
 +    {
 +      if (CHANNEL_LIMIT_PUSH(c, RX))
 +      {
 +      /* Required by rte_trace_in() */
 +      new->net = n;
  
 -      break;
 +      channel_rte_trace_in(D_FILTERS, c, new, "ignored [limit]");
 +      goto drop_update;
 +      }
      }
 +  else
 +    goto drop_withdraw;
  
    if (!new)
    {
@@@ -3265,10 -3192,10 +3265,10 @@@ again
  
      while (e = *ee)
      {
 -      if (all || (e->flags & (REF_STALE | REF_DISCARD)))
 +      if (all || (e->rte.flags & (REF_STALE | REF_DISCARD)))
        {
        *ee = e->next;
-       rte_free(e, t);
 -      rte_free_quick(e);
++      rte_free(e);
        t->rt_count--;
        }
        else
Simple merge
Simple merge
Simple merge
diff --cc proto/rip/rip.c
Simple merge
index 40a5844293f9508ea905a9a1e6f90efc833ae39c,7d7ec7e6e606a73bb16708f0bc2e0ade3222ec93..f80c4c457cd11c3793948535b09f79cdf9b2aae3
@@@ -327,11 -326,11 +327,11 @@@ krt_learn_scan(struct krt_proto *p, rt
        break;
    if (m)
      {
 -      if (krt_uptodate(m, e))
 +      if (krt_uptodate(&m->rte, e))
        {
          krt_trace_in_rl(&rl_alien, p, e, "[alien] seen");
-         rte_free(ee, p->krt_table);
 -        rte_free(e);
 -        m->pflags |= KRT_REF_SEEN;
++        rte_free(ee);
 +        m->rte.pflags |= KRT_REF_SEEN;
        }
        else
        {
@@@ -378,13 -376,13 +378,13 @@@ again
        ee = &n->routes;
        while (e = *ee)
        {
 -        if (e->pflags & KRT_REF_BEST)
 +        if (e->rte.pflags & KRT_REF_BEST)
            old_best = e;
  
 -        if (!(e->pflags & KRT_REF_SEEN))
 +        if (!(e->rte.pflags & KRT_REF_SEEN))
            {
              *ee = e->next;
-             rte_free(e, p->krt_table);
+             rte_free(e);
              continue;
            }
  
@@@ -445,10 -444,10 +445,10 @@@ krt_learn_async(struct krt_proto *p, rt
      {
        if (g)
        {
 -        if (krt_uptodate(g, e))
 +        if (krt_uptodate(&g->rte, e))
            {
              krt_trace_in(p, e, "[alien async] same");
-             rte_free(ee, p->krt_table);
 -            rte_free(e);
++            rte_free(ee);
              return;
            }
          krt_trace_in(p, e, "[alien async] updated");
    else if (!g)
      {
        krt_trace_in(p, e, "[alien async] delete failed");
-       rte_free(ee, p->krt_table);
 -      rte_free(e);
++      rte_free(ee);
        return;
      }
    else
      {
        krt_trace_in(p, e, "[alien async] removed");
        *gg = g->next;
-       rte_free(ee, p->krt_table);
-       rte_free(g, p->krt_table);
 -      rte_free(e);
++      rte_free(ee);
+       rte_free(g);
      }
    best = n->routes;
    bestp = &n->routes;