0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-03-11 17:08:46 +00:00

Merge branch 'mq-aggregator-for-v3' into thread-next

This commit is contained in:
Maria Matejka 2023-11-09 15:58:41 +01:00
commit 3ccf890e58
4 changed files with 34 additions and 3 deletions

View File

@ -823,7 +823,9 @@ mpls_free_fec(struct mpls_fec_map *m, struct mpls_fec *fec)
DBG("Free FEC %u\n", fec->label);
mpls_free_label(m->domain, m->handle, fec->label);
if (fec->policy != MPLS_POLICY_STATIC)
mpls_free_label(m->domain, m->handle, fec->label);
HASH_REMOVE2(m->label_hash, LABEL, m->pool, fec);
switch (fec->policy)

View File

@ -107,15 +107,21 @@ stat_nexthops:
| stat_nexthops stat_nexthop
;
stat_mpls:
/* empty */
| MPLS expr { this_srt->mpls_label = $2; if ($2 >= MPLS_MAX_LABEL) cf_error("MPLS label must be less than 2^20"); }
;
stat_route0: ROUTE net_any {
this_srt = cfg_allocz(sizeof(struct static_route));
add_tail(&STATIC_CFG->routes, &this_srt->n);
this_srt->net = $2;
this_srt->mpls_label = (uint) -1;
this_srt_cmds = NULL;
this_srt_last_cmd = NULL;
this_srt->mp_next = NULL;
this_snh = NULL;
}
} stat_mpls
;
stat_route:

View File

@ -108,11 +108,27 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
ea_set_hostentry(&ea, p->p.main_channel->table, tab,
r->via, IPA_NONE, lnum, labels);
}
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;
if (r->mpls_label != (uint) -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;
@ -371,7 +387,7 @@ static inline int
static_same_rte(struct static_route *or, struct static_route *nr)
{
/* Note that i_same() requires arguments in (new, old) order */
return static_same_dest(or, nr) && f_same(nr->cmds, or->cmds);
return (or->mpls_label == nr->mpls_label) && static_same_dest(or, nr) && f_same(nr->cmds, or->cmds);
}
static void
@ -458,6 +474,7 @@ static_postconfig(struct proto_config *CF)
cf_error("Channel not specified");
struct channel_config *cc = proto_cf_main_channel(CF);
struct channel_config *mc = proto_cf_mpls_channel(CF);
if (!cf->igp_table_ip4)
cf->igp_table_ip4 = (cc->table->addr_type == NET_IP4) ?
@ -468,9 +485,14 @@ static_postconfig(struct proto_config *CF)
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);
if ((r->mpls_label != (uint) -1) && !mc)
cf_error("Route %N has MPLS label, but MPLS channel not specified", r->net);
}
static_index_routes(cf);
}

View File

@ -48,6 +48,7 @@ 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 */
struct adata *mls; /* MPLS label stack; may be NULL */
};