]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit '4972590e' into thread-next
authorMaria Matejka <mq@ucw.cz>
Thu, 12 Oct 2023 07:29:51 +0000 (09:29 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 12 Oct 2023 09:05:28 +0000 (11:05 +0200)
1  2 
nest/proto.c
proto/bgp/attrs.c
proto/bgp/bgp.h
proto/bgp/packets.c

diff --cc nest/proto.c
index b0ca57da53df5d5fd40ede6bf78bc7a6dc3b109c,a532570575eeb1d12a6aafffb76c0aa7f51d8dc9..5b00cc9d9dca012f60f30b194ac046920c8fecd0
@@@ -272,11 -177,12 +272,10 @@@ proto_add_channel(struct proto *p, stru
    c->preference = cf->preference;
    c->debug = cf->debug;
    c->merge_limit = cf->merge_limit;
 -  c->in_keep_filtered = cf->in_keep_filtered;
 +  c->in_keep = cf->in_keep;
    c->rpki_reload = cf->rpki_reload;
--  c->bmp_hack = cf->bmp_hack;
  
    c->channel_state = CS_DOWN;
 -  c->export_state = ES_DOWN;
    c->last_state_change = current_time();
    c->reloadable = 1;
  
index 6fd7abaeb5a7474c546a7f35e6f7969c2d46b906,457a8b152a0df8c1d5270f1c174f9ec6f17723fc..dfd6f1d3e8866c1b325896b7e1a7aa9fd517c48b
@@@ -1209,43 -1145,12 +1209,34 @@@ static union bgp_attr_desc bgp_attr_tab
    },
  };
  
 -static inline int
 -bgp_attr_known(uint code)
 +eattr *
 +bgp_find_attr(ea_list *attrs, uint code)
 +{
 +  return ea_find(attrs, BGP_EA_ID(code));
 +}
 +
 +void
 +bgp_register_attrs(void)
  {
 -  return (code < ARRAY_SIZE(bgp_attr_table)) && bgp_attr_table[code].name;
 +  for (uint i=0; i<ARRAY_SIZE(bgp_attr_table); i++)
 +  {
 +    if (!bgp_attr_table[i].name)
 +      bgp_attr_table[i] = (union bgp_attr_desc) {
 +      .name = mb_sprintf(&root_pool, "bgp_unknown_0x%02x", i),
 +      .type = T_OPAQUE,
 +      .flags = BAF_OPTIONAL,
 +      .readonly = 1,
 +      .export = bgp_export_unknown,
 +      .encode = bgp_encode_raw,
 +      .decode = bgp_decode_unknown,
 +      .format = bgp_format_unknown,
 +      };
 +
 +    ea_register_init(&bgp_attr_table[i].class);
 +  }
  }
  
- void
- bgp_fix_attr_flags(ea_list *attrs)
- {
-   for (u8 i = 0; i < attrs->count; i++)
-   {
-     attrs->attrs[i].flags = bgp_attr_table[EA_ID(attrs->attrs[i].id)].flags;
-   }
- }
 +
  /*
   *    Attribute export
   */
diff --cc proto/bgp/bgp.h
index 7e35b37c1beeba87af03ca2a47460d5cd8f1516a,ceba958c159ce69b361daacb96e0525b3cb21c1f..cc2b538a92a56756971c3eab35aa313353e31719
@@@ -579,20 -556,12 +579,18 @@@ void bgp_store_error(struct bgp_proto *
  void bgp_stop(struct bgp_proto *p, int subcode, byte *data, uint len);
  const char *bgp_format_role_name(u8 role);
  
- void bgp_fix_attr_flags(ea_list *attrs);
  static inline int
 -rte_resolvable(rte *rt)
 +rte_resolvable(const rte *rt)
  {
 -  return rt->attrs->dest != RTD_UNREACHABLE;
 +  eattr *nhea = ea_find(rt->attrs, &ea_gen_nexthop);
 +  if (!nhea)
 +    return 0;
 +
 +  struct nexthop_adata *nhad = (void *) nhea->u.ptr;
 +  return NEXTHOP_IS_REACHABLE(nhad) || (nhad->dest != RTD_UNREACHABLE);
  }
  
 +extern struct rte_owner_class bgp_rte_owner_class;
  
  #ifdef LOCAL_DEBUG
  #define BGP_FORCE_DEBUG 1
index 2c5c04a26a789d6d59bc11d21d98f14ec6787409,6b11eaf7ef13c76eb8cfd00d9e3f43b28fa29783..657d5374ea37168abf7a563599d480c6cc85ffdf
@@@ -2449,13 -2453,13 +2449,12 @@@ bgp_bmp_encode_rte(struct bgp_channel *
  //  struct bgp_proto *p = (void *) c->c.proto;
    byte *pkt = buf + BGP_HEADER_LENGTH;
  
--  ea_list *attrs = new ? new->attrs->eattrs : NULL;
++  ea_list *attrs = new ? new->attrs : NULL;
    uint ea_size = new ? (sizeof(ea_list) + attrs->count * sizeof(eattr)) : 0;
    uint bucket_size = sizeof(struct bgp_bucket) + ea_size;
    uint prefix_size = sizeof(struct bgp_prefix) + n->length;
  
--  struct lp_state tmpp;
--  lp_save(tmp_linpool, &tmpp);
++  struct lp_state *tmpp = lp_save(tmp_linpool);
  
    /* Temporary bucket */
    struct bgp_bucket *b = tmp_allocz(bucket_size);
    struct bgp_prefix *px = tmp_allocz(prefix_size);
    px->path_id = src->private_id;
    net_copy(px->net, n);
--  add_tail(&b->prefixes, &px->buck_node);
++  add_tail(&b->prefixes, &px->buck_node_xx);
  
    byte *end = bgp_create_update_bmp(c, pkt, b, !!new);
  
    if (end)
      bgp_bmp_prepare_bgp_hdr(buf, end - buf, PKT_UPDATE);
  
--  lp_restore(tmp_linpool, &tmpp);
++  lp_restore(tmp_linpool, tmpp);
  
    return end;
  }