mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
MPLS: FEC Map moved from protocol to MPLS channel
This commit is contained in:
21
nest/mpls.c
21
nest/mpls.c
@@ -565,6 +565,7 @@ mpls_channel_init(struct channel *C, struct channel_config *CC)
|
||||
c->domain = cc->domain->domain;
|
||||
c->range = cc->range->range;
|
||||
c->label_policy = cc->label_policy;
|
||||
c->rts = cc->rts;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -575,6 +576,9 @@ mpls_channel_start(struct channel *C)
|
||||
mpls_lock_domain(c->domain);
|
||||
mpls_lock_range(c->range);
|
||||
|
||||
ASSERT_DIE(c->rts);
|
||||
c->mpls_map = mpls_fec_map_new(C->proto->pool, C, c->rts);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -592,6 +596,9 @@ mpls_channel_cleanup(struct channel *C)
|
||||
{
|
||||
struct mpls_channel *c = (void *) C;
|
||||
|
||||
mpls_fec_map_free(c->mpls_map);
|
||||
c->mpls_map = NULL;
|
||||
|
||||
mpls_unlock_range(c->range);
|
||||
mpls_unlock_domain(c->domain);
|
||||
}
|
||||
@@ -623,6 +630,8 @@ mpls_channel_reconfigure(struct channel *C, struct channel_config *CC, int *impo
|
||||
*import_changed = 1;
|
||||
}
|
||||
|
||||
mpls_fec_map_reconfigure(c->mpls_map, C);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1141,8 +1150,10 @@ mpls_apply_fec(rte *r, struct mpls_fec *fec)
|
||||
|
||||
|
||||
int
|
||||
mpls_handle_rte(struct mpls_fec_map *m, const net_addr *n, rte *r)
|
||||
mpls_handle_rte(struct channel *c, const net_addr *n, rte *r)
|
||||
{
|
||||
struct mpls_channel *mc = SKIP_BACK(struct mpls_channel, c, c->proto->mpls_channel);
|
||||
struct mpls_fec_map *m = mc->mpls_map;
|
||||
struct mpls_fec *fec = NULL;
|
||||
|
||||
/* Select FEC for route */
|
||||
@@ -1214,13 +1225,13 @@ mpls_handle_rte(struct mpls_fec_map *m, const net_addr *n, rte *r)
|
||||
static inline struct mpls_fec_tmp_lock
|
||||
mpls_rte_get_fec_lock(const rte *r)
|
||||
{
|
||||
struct mpls_fec_tmp_lock mt = {
|
||||
.m = SKIP_BACK(struct proto, sources, r->src->owner)->mpls_map,
|
||||
};
|
||||
struct mpls_fec_tmp_lock mt = {};
|
||||
|
||||
if (!mt.m)
|
||||
struct channel *c = SKIP_BACK(struct proto, sources, r->src->owner)->mpls_channel;
|
||||
if (!c)
|
||||
return mt;
|
||||
|
||||
mt.m = SKIP_BACK(struct mpls_channel, c, c)->mpls_map;
|
||||
uint label = ea_get_int(r->attrs, &ea_gen_mpls_label, 0);
|
||||
if (label < 16)
|
||||
return mt;
|
||||
|
Reference in New Issue
Block a user