0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Merge commit '8f5511da' into mq-aggregator-for-v3

This commit is contained in:
Maria Matejka 2023-11-09 16:53:45 +01:00
commit 87e2ba8c84

View File

@ -50,7 +50,6 @@
/* /*
* TODO: * TODO:
* - import/export target reconfiguration
* - check for simple nodes in export route * - check for simple nodes in export route
* - replace pair of channels with shared channel for one address family * - replace pair of channels with shared channel for one address family
* - improve route comparisons in VRFs * - improve route comparisons in VRFs
@ -121,6 +120,13 @@ l3vpn_export_targets(struct l3vpn_proto *p, const struct adata *src)
return dst; return dst;
} }
static inline void
l3vpn_prepare_import_targets(struct l3vpn_proto *p)
{
const struct f_tree *t = p->import_target;
p->import_target_one = !t->left && !t->right && (t->from.val.ec == t->to.val.ec);
}
static void static void
l3vpn_add_ec(const struct f_tree *t, void *P) l3vpn_add_ec(const struct f_tree *t, void *P)
{ {
@ -130,10 +136,10 @@ l3vpn_add_ec(const struct f_tree *t, void *P)
} }
static void static void
l3vpn_prepare_targets(struct l3vpn_proto *p) l3vpn_prepare_export_targets(struct l3vpn_proto *p)
{ {
const struct f_tree *t = p->import_target; if (p->export_target_data)
p->import_target_one = !t->left && !t->right && (t->from.val.ec == t->to.val.ec); mb_free(p->export_target_data);
uint len = 2 * tree_node_count(p->export_target); uint len = 2 * tree_node_count(p->export_target);
p->export_target_data = mb_alloc(p->p.pool, len * sizeof(u32)); p->export_target_data = mb_alloc(p->p.pool, len * sizeof(u32));
@ -373,8 +379,10 @@ l3vpn_start(struct proto *P)
p->rd = cf->rd; p->rd = cf->rd;
p->import_target = cf->import_target; p->import_target = cf->import_target;
p->export_target = cf->export_target; p->export_target = cf->export_target;
p->export_target_data = NULL;
l3vpn_prepare_targets(p); l3vpn_prepare_import_targets(p);
l3vpn_prepare_export_targets(p);
proto_setup_mpls_map(P, RTS_L3VPN, 1); proto_setup_mpls_map(P, RTS_L3VPN, 1);
@ -407,14 +415,24 @@ l3vpn_reconfigure(struct proto *P, struct proto_config *CF)
!proto_configure_channel(P, &P->mpls_channel, proto_cf_find_channel(CF, NET_MPLS))) !proto_configure_channel(P, &P->mpls_channel, proto_cf_find_channel(CF, NET_MPLS)))
return 0; return 0;
if ((p->rd != cf->rd) || if (p->rd != cf->rd)
!same_tree(p->import_target, cf->import_target) ||
!same_tree(p->export_target, cf->export_target))
return 0; return 0;
/* int import_changed = !same_tree(p->import_target, cf->import_target);
if (!same_tree(p->import_target, cf->import_target)) int export_changed = !same_tree(p->export_target, cf->export_target);
/* Update pointers to config structures */
p->import_target = cf->import_target;
p->export_target = cf->export_target;
proto_setup_mpls_map(P, RTS_L3VPN, 1);
if (import_changed)
{ {
TRACE(D_EVENTS, "Import target changed");
l3vpn_prepare_import_targets(p);
if (p->vpn4_channel && (p->vpn4_channel->channel_state == CS_UP)) if (p->vpn4_channel && (p->vpn4_channel->channel_state == CS_UP))
channel_request_feeding(p->vpn4_channel); channel_request_feeding(p->vpn4_channel);
@ -422,21 +440,18 @@ l3vpn_reconfigure(struct proto *P, struct proto_config *CF)
channel_request_feeding(p->vpn6_channel); channel_request_feeding(p->vpn6_channel);
} }
if (!same_tree(p->export_target, cf->export_target)) if (export_changed)
{ {
TRACE(D_EVENTS, "Export target changed");
l3vpn_prepare_export_targets(p);
if (p->ip4_channel && (p->ip4_channel->channel_state == CS_UP)) if (p->ip4_channel && (p->ip4_channel->channel_state == CS_UP))
channel_request_feeding(p->ip4_channel); channel_request_feeding(p->ip4_channel);
if (p->ip6_channel && (p->ip6_channel->channel_state == CS_UP)) if (p->ip6_channel && (p->ip6_channel->channel_state == CS_UP))
channel_request_feeding(p->ip6_channel); channel_request_feeding(p->ip6_channel);
} }
*/
/* Update pointers to config structures */
p->import_target = cf->import_target;
p->export_target = cf->export_target;
proto_setup_mpls_map(P, RTS_L3VPN, 1);
return 1; return 1;
} }