]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge commit 'v2.13.1-186-g761649e6' into thread-next
authorMaria Matejka <mq@ucw.cz>
Sun, 28 Jan 2024 13:38:43 +0000 (14:38 +0100)
committerMaria Matejka <mq@ucw.cz>
Sun, 28 Jan 2024 13:38:43 +0000 (14:38 +0100)
1  2 
doc/bird.sgml
filter/f-inst.c
proto/bgp/bgp.h

diff --cc doc/bird.sgml
Simple merge
diff --cc filter/f-inst.c
index 4aa4c489d58164d830fb12d20bd8ad19e8754266,6b1c411140ca6e9d552d22d2a5f7057a42a1b531..dab6cdfb3a174f6502cb96d11bb7abab3226d2b4
  
    INST(FI_EA_SET, 1, 0) {
      ACCESS_RTE;
 -    ACCESS_EATTRS;
      ARG_ANY(1);
      DYNAMIC_ATTR;
 -    ARG_TYPE(1, da.f_type);
 +    ARG_TYPE(1, da->type);
+     FID_NEW_BODY;
 -      if (da.f_type == T_ENUM_EMPTY)
++      if (da->type == T_OPAQUE)
+       cf_error("Setting opaque attribute is not allowed");
+     FID_INTERPRET_BODY;
      {
 -      struct ea_list *l = lp_alloc(fs->pool, sizeof(struct ea_list) + sizeof(eattr));
 -
 -      l->next = NULL;
 -      l->flags = EALF_SORTED;
 -      l->count = 1;
 -      l->attrs[0].id = da.ea_code;
 -      l->attrs[0].flags = da.flags;
 -      l->attrs[0].type = da.type;
 -      l->attrs[0].originated = 1;
 -      l->attrs[0].fresh = 1;
 -      l->attrs[0].undef = 0;
 -
 -      switch (da.type) {
 -      case EAF_TYPE_INT:
 -      case EAF_TYPE_ROUTER_ID:
 -      l->attrs[0].u.data = v1.val.i;
 -      break;
 +      struct eattr *a;
  
 -      case EAF_TYPE_IP_ADDRESS:;
 -      int len = sizeof(ip_addr);
 -      struct adata *ad = lp_alloc(fs->pool, sizeof(struct adata) + len);
 -      ad->length = len;
 -      (* (ip_addr *) ad->data) = v1.val.ip;
 -      l->attrs[0].u.ptr = ad;
 -      break;
 +      if (da->type >= EAF_TYPE__MAX)
 +      bug("Unsupported attribute type");
  
 -      case EAF_TYPE_OPAQUE:
 -      case EAF_TYPE_AS_PATH:
 -      case EAF_TYPE_INT_SET:
 -      case EAF_TYPE_EC_SET:
 -      case EAF_TYPE_LC_SET:
 -      l->attrs[0].u.ptr = v1.val.ad;
 +      switch (da->type) {
 +      case T_IFACE:
 +      case T_OPAQUE:
 +      runtime( "Setting opaque attribute is not allowed" );
        break;
  
 -      case EAF_TYPE_BITFIELD:
 -      {
 -        /* First, we have to find the old value */
 -        eattr *e = ea_find(*fs->eattrs, da.ea_code);
 -        u32 data = e ? e->u.data : 0;
 -
 -        if (v1.val.i)
 -          l->attrs[0].u.data = data | (1u << da.bit);
 -        else
 -          l->attrs[0].u.data = data & ~(1u << da.bit);
 -      }
 +      case T_IP:
 +      a = ea_set_attr(&fs->rte->attrs,
 +          EA_LITERAL_STORE_ADATA(da, 0, &v1.val.ip, sizeof(ip_addr)));
        break;
  
        default:
diff --cc proto/bgp/bgp.h
index b59b02d831e9c6d06ae3b118d1568d11ec7ec0a5,2e95037c75658d88a5e470b3cd4c9e0a315b487b..b79fca2994a42e49f63bb92fd48f557ff413c6a9
@@@ -615,35 -611,31 +615,36 @@@ void bgp_unset_attr(ea_list **to, uint 
  
  int bgp_encode_mp_reach_mrt(struct bgp_write_state *s, eattr *a, byte *buf, uint size);
  
+ const char * bgp_attr_name(uint code);
  int bgp_encode_attrs(struct bgp_write_state *s, ea_list *attrs, byte *buf, byte *end);
  ea_list * bgp_decode_attrs(struct bgp_parse_state *s, byte *data, uint len);
 -void bgp_finish_attrs(struct bgp_parse_state *s, rta *a);
 +void bgp_finish_attrs(struct bgp_parse_state *s, ea_list **to);
 +
 +void bgp_setup_out_table(struct bgp_channel *c);
 +
 +void bgp_init_pending_tx(struct bgp_channel *c);
 +void bgp_free_pending_tx(struct bgp_channel *c);
  
 -void bgp_init_bucket_table(struct bgp_channel *c);
 -void bgp_free_bucket_table(struct bgp_channel *c);
 -void bgp_free_bucket(struct bgp_channel *c, struct bgp_bucket *b);
 -void bgp_defer_bucket(struct bgp_channel *c, struct bgp_bucket *b);
  void bgp_withdraw_bucket(struct bgp_channel *c, struct bgp_bucket *b);
 +int bgp_done_bucket(struct bgp_channel *c, struct bgp_bucket *b);
  
 -void bgp_init_prefix_table(struct bgp_channel *c);
 -void bgp_free_prefix_table(struct bgp_channel *c);
 -void bgp_free_prefix(struct bgp_channel *c, struct bgp_prefix *bp);
 +void bgp_done_prefix(struct bgp_channel *c, struct bgp_prefix *px, struct bgp_bucket *buck);
  
 -int bgp_rte_better(struct rte *, struct rte *);
 -int bgp_rte_mergable(rte *pri, rte *sec);
 -int bgp_rte_recalculate(rtable *table, net *net, rte *new, rte *old, rte *old_best);
 -struct rte *bgp_rte_modify_stale(struct rte *r, struct linpool *pool);
 -u32 bgp_rte_igp_metric(struct rte *);
 -void bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old);
 +int bgp_rte_better(const rte *, const rte *);
 +int bgp_rte_mergable(const rte *pri, const rte *sec);
 +int bgp_rte_recalculate(struct rtable_private *table, net *net, struct rte_storage *new, struct rte_storage *old, struct rte_storage *old_best);
 +void bgp_rte_modify_stale(struct rt_export_request *req, const net_addr *n, struct rt_pending_export *first, struct rt_pending_export *last, const rte **feed, uint count);
 +u32 bgp_rte_igp_metric(const rte *);
 +void bgp_rt_notify(struct proto *P, struct channel *C, const net_addr *n, rte *new, const rte *old);
  int bgp_preexport(struct channel *, struct rte *);
 -int bgp_get_attr(const struct eattr *e, byte *buf, int buflen);
 -void bgp_get_route_info(struct rte *, byte *buf);
 -int bgp_total_aigp_metric_(rte *e, u64 *metric, const struct adata **ad);
 +void bgp_get_route_info(const rte *, byte *);
 +int bgp_total_aigp_metric_(const rte *e, u64 *metric, const struct adata **ad);
 +
 +static inline struct bgp_proto *bgp_rte_proto(const rte *rte)
 +{
 +  return (rte->src->owner->class == &bgp_rte_owner_class) ?
 +    SKIP_BACK(struct bgp_proto, p.sources, rte->src->owner) : NULL;
 +}
  
  byte * bgp_bmp_encode_rte(struct bgp_channel *c, byte *buf, const net_addr *n, const struct rte *new, const struct rte_src *src);