]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Merge branch 'mq-aggregator-for-v3' into thread-next
authorMaria Matejka <mq@ucw.cz>
Thu, 9 Nov 2023 14:58:41 +0000 (15:58 +0100)
committerMaria Matejka <mq@ucw.cz>
Thu, 9 Nov 2023 14:58:41 +0000 (15:58 +0100)
1  2 
nest/mpls.c
proto/static/config.Y
proto/static/static.c
proto/static/static.h

diff --cc nest/mpls.c
Simple merge
Simple merge
index 7d0ea917b7738dfc4164ad8039225ee66533cf8c,8e69a20419f061e804d48e973cd4d2ede5bd4420..2024514f1ed3c6b36a246caf310a8c331214fba2
@@@ -80,39 -73,69 +80,55 @@@ static_announce_rte(struct static_prot
        if (!r2->active)
        continue;
  
 -      struct nexthop *nh = allocz(NEXTHOP_MAX_SIZE);
 -      nh->gw = r2->via;
 -      nh->iface = r2->neigh->iface;
 -      nh->flags = r2->onlink ? RNF_ONLINK : 0;
 -      nh->weight = r2->weight;
 +      *nh = (struct nexthop) {
 +      .gw = r2->via,
 +      .iface = r2->neigh->iface,
 +      .flags = r2->onlink ? RNF_ONLINK : 0,
 +      .weight = r2->weight,
 +      };
 +
        if (r2->mls)
        {
 -      nh->labels = r2->mls->len;
 -      memcpy(nh->label, r2->mls->stack, r2->mls->len * sizeof(u32));
 +      nh->labels = r2->mls->length / sizeof(u32);
 +      memcpy(nh->label, r2->mls->data, r2->mls->length);
        }
  
 -      nexthop_insert(&nhs, nh);
 +      nh = NEXTHOP_NEXT(nh);
      }
  
 -    if (!nhs)
 -      goto withdraw;
 -
 -    nexthop_link(a, nhs);
 +    ea_set_attr_data(&ea, &ea_gen_nexthop, 0,
 +      nhad->ad.data, (void *) nh - (void *) nhad->ad.data);
    }
  
 -  if (r->dest == RTDX_RECURSIVE)
 +  else if (r->dest == RTDX_RECURSIVE)
    {
      rtable *tab = ipa_is_ip4(r->via) ? p->igp_table_ip4 : p->igp_table_ip6;
 -    rta_set_recursive_next_hop(p->p.main_channel->table, a, tab, r->via, IPA_NONE, r->mls);
 +    u32 *labels = r->mls ? (void *) r->mls->data : NULL;
 +    u32 lnum = r->mls ? r->mls->length / sizeof(u32) : 0;
 +
 +    ea_set_hostentry(&ea, p->p.main_channel->table, tab,
 +      r->via, IPA_NONE, lnum, labels);
++
    }
  
 -    ea_list *ea = alloca(sizeof(ea_list) + 2 * sizeof(eattr));
 -    *ea = (ea_list) { .flags = EALF_SORTED };
 -    ea->next = a->eattrs;
 -    a->eattrs = ea;
 -
 +  else if (r->dest)
 +    ea_set_dest(&ea, 0, r->dest);
 +
+   if (p->p.mpls_channel)
+   {
+     struct mpls_channel *mc = (void *) p->p.mpls_channel;
 -      ea->attrs[0] = (eattr) {
 -      .id = EA_MPLS_LABEL,
 -      .type = EAF_TYPE_INT,
 -      .u.data = r->mpls_label,
 -      };
 -
 -      ea->attrs[1] = (eattr) {
 -      .id = EA_MPLS_POLICY,
 -      .type = EAF_TYPE_INT,
 -      .u.data = MPLS_POLICY_STATIC,
 -      };
 -
 -      ea->count = 2;
+     if (r->mpls_label != (uint) -1)
+     {
 -      ea->attrs[0] = (eattr) {
 -      .id = EA_MPLS_POLICY,
 -      .type = EAF_TYPE_INT,
 -      .u.data = mc->label_policy,
 -      };
 -
 -      ea->count = 1;
++      ea_set_attr_u32(&ea, &ea_gen_mpls_label, 0, r->mpls_label);
++      ea_set_attr_u32(&ea, &ea_gen_mpls_policy, 0, MPLS_POLICY_STATIC);
+     }
+     else
+     {
++      ea_set_attr_u32(&ea, &ea_gen_mpls_policy, 0, mc->label_policy);
+     }
+   }
    /* Already announced */
    if (r->state == SRS_CLEAN)
      return;
@@@ -465,9 -484,10 +482,10 @@@ static_postconfig(struct proto_config *
  
    if (!cf->igp_table_ip6)
      cf->igp_table_ip6 = (cc->table->addr_type == NET_IP6) ?
 -      cc->table : cf->c.global->def_tables[NET_IP6];
 +      cc->table : rt_get_default_table(cf->c.global, NET_IP6);
  
    WALK_LIST(r, cf->routes)
+   {
      if (r->net && (r->net->type != CF->net_type))
        cf_error("Route %N incompatible with channel type", r->net);
  
index cda230403eec6b211da80447e4d5cb1ef4d45e47,a0a95a4b7405b57a46c34edc23668c8ef8c24866..b7feb64990a49ac2cd05ad93996d57d383a74067
@@@ -48,8 -48,9 +48,9 @@@ struct static_route 
    byte onlink;                                /* Gateway is onlink regardless of IP ranges */
    byte weight;                                /* Multipath next hop weight */
    byte use_bfd;                               /* Configured to use BFD */
+   uint mpls_label;                    /* Local MPLS label, -1 if unused */
    struct bfd_request *bfd_req;                /* BFD request, if BFD is used */
 -  mpls_label_stack *mls;              /* MPLS label stack; may be NULL */
 +  struct adata *mls;                  /* MPLS label stack; may be NULL */
  };
  
  /*