1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Nest: Allow modification of channels inherited from templates

Multiple definitions of same channels are forbidden, but inherited
channel can be redefined. In such case channel options are merged.
This commit is contained in:
Ondrej Zajicek (work)
2018-01-09 18:42:22 +01:00
parent 09c1e370b3
commit 72163bd5f3
10 changed files with 93 additions and 35 deletions

View File

@@ -158,12 +158,16 @@ bgp_channel_start: bgp_afi
if (!desc)
cf_error("Unknown AFI/SAFI");
this_channel = channel_config_new(&channel_bgp, desc->net, this_proto);
BGP_CC->c.name = desc->name;
BGP_CC->c.ra_mode = RA_UNDEF;
BGP_CC->afi = $1;
BGP_CC->desc = desc;
BGP_CC->gr_able = 0xff; /* undefined */
this_channel = channel_config_get(&channel_bgp, desc->name, desc->net, this_proto);
/* New channel */
if (!BGP_CC->desc)
{
BGP_CC->c.ra_mode = RA_UNDEF;
BGP_CC->afi = $1;
BGP_CC->desc = desc;
BGP_CC->gr_able = 0xff; /* undefined */
}
};
bgp_channel_item:

View File

@@ -84,8 +84,8 @@ ospf_proto_finish(void)
/* Define default channel */
if (EMPTY_LIST(this_proto->channels))
{
this_proto->net_type = ospf_cfg_is_v2() ? NET_IP4 : NET_IP6;
channel_config_new(NULL, this_proto->net_type, this_proto);
uint net_type = this_proto->net_type = ospf_cfg_is_v2() ? NET_IP4 : NET_IP6;
channel_config_new(NULL, net_label[net_type], net_type, this_proto);
}
/* Propagate global instance ID to interfaces */
@@ -238,7 +238,8 @@ ospf_af_mc:
/* We redefine proto_channel to add multicast flag */
ospf_channel_start: net_type ospf_af_mc
{
$$ = this_channel = channel_config_new(NULL, $1, this_proto);
/* TODO: change name for multicast channels */
$$ = this_channel = channel_config_get(NULL, net_label[$1], $1, this_proto);
/* Save the multicast flag */
if (this_channel == proto_cf_main_channel(this_proto))

View File

@@ -25,7 +25,7 @@ CF_ADDTO(proto, pipe_proto '}' { this_channel = NULL; } )
pipe_proto_start: proto_start PIPE
{
this_proto = proto_config_new(&proto_pipe, $1);
this_channel = channel_config_new(NULL, 0, this_proto);
this_channel = channel_config_new(NULL, NULL, 0, this_proto);
this_channel->in_filter = FILTER_ACCEPT;
this_channel->out_filter = FILTER_ACCEPT;
};

View File

@@ -569,7 +569,7 @@ radv_postconfig(struct proto_config *CF)
/* Define default channel */
if (EMPTY_LIST(CF->channels))
channel_config_new(NULL, NET_IP6, CF);
channel_config_new(NULL, net_label[NET_IP6], NET_IP6, CF);
}
static struct proto *

View File

@@ -1078,7 +1078,7 @@ rip_postconfig(struct proto_config *CF)
/* Define default channel */
if (EMPTY_LIST(CF->channels))
channel_config_new(NULL, CF->net_type, CF);
channel_config_new(NULL, net_label[CF->net_type], CF->net_type, CF);
}
static struct proto *

View File

@@ -901,7 +901,7 @@ rpki_postconfig(struct proto_config *CF)
{
/* Define default channel */
if (EMPTY_LIST(CF->channels))
channel_config_new(NULL, CF->net_type, CF);
channel_config_new(NULL, net_label[CF->net_type], CF->net_type, CF);
}
static void