summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-01-09 18:42:22 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-01-09 18:42:22 +0100
commit72163bd5f3ccefc1edda585f6f605c37e774a0b8 (patch)
tree59df1629a4c0884e2072c8082e9b4d392be648e4 /proto
parent09c1e370b3084f7acb7c3777427670a69945368a (diff)
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.
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/config.Y16
-rw-r--r--proto/ospf/config.Y7
-rw-r--r--proto/pipe/config.Y2
-rw-r--r--proto/radv/radv.c2
-rw-r--r--proto/rip/rip.c2
-rw-r--r--proto/rpki/rpki.c2
6 files changed, 18 insertions, 13 deletions
diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y
index 6ce0f1aa..4e819eb7 100644
--- a/proto/bgp/config.Y
+++ b/proto/bgp/config.Y
@@ -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:
diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y
index ce409a3a..005f4381 100644
--- a/proto/ospf/config.Y
+++ b/proto/ospf/config.Y
@@ -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))
diff --git a/proto/pipe/config.Y b/proto/pipe/config.Y
index f51ee575..4f96fdcb 100644
--- a/proto/pipe/config.Y
+++ b/proto/pipe/config.Y
@@ -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;
};
diff --git a/proto/radv/radv.c b/proto/radv/radv.c
index 0a2a3e78..8a79dfaf 100644
--- a/proto/radv/radv.c
+++ b/proto/radv/radv.c
@@ -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 *
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index a3eeaf17..85e37cea 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -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 *
diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c
index 3145399b..74860071 100644
--- a/proto/rpki/rpki.c
+++ b/proto/rpki/rpki.c
@@ -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