Nest: Clean up main channel handling
Remove assumption that main channel is the only channel.
This commit is contained in:
parent
3f19100f5a
commit
47d92d8f9d
8 changed files with 9 additions and 9 deletions
|
@ -616,7 +616,7 @@ struct channel {
|
||||||
|
|
||||||
struct channel_config *proto_cf_find_channel(struct proto_config *p, uint net_type);
|
struct channel_config *proto_cf_find_channel(struct proto_config *p, uint net_type);
|
||||||
static inline struct channel_config *proto_cf_main_channel(struct proto_config *pc)
|
static inline struct channel_config *proto_cf_main_channel(struct proto_config *pc)
|
||||||
{ struct channel_config *cc = HEAD(pc->channels); return NODE_VALID(cc) ? cc : NULL; }
|
{ return proto_cf_find_channel(pc, pc->net_type); }
|
||||||
|
|
||||||
struct channel *proto_find_channel_by_table(struct proto *p, struct rtable *t);
|
struct channel *proto_find_channel_by_table(struct proto *p, struct rtable *t);
|
||||||
struct channel *proto_find_channel_by_name(struct proto *p, const char *n);
|
struct channel *proto_find_channel_by_name(struct proto *p, const char *n);
|
||||||
|
|
|
@ -85,7 +85,7 @@ ospf_proto_finish(void)
|
||||||
struct ospf_iface_patt *ic;
|
struct ospf_iface_patt *ic;
|
||||||
|
|
||||||
/* Define default channel */
|
/* Define default channel */
|
||||||
if (EMPTY_LIST(this_proto->channels))
|
if (! proto_cf_main_channel(this_proto))
|
||||||
{
|
{
|
||||||
uint net_type = this_proto->net_type = ospf_cfg_is_v2() ? NET_IP4 : NET_IP6;
|
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);
|
channel_config_new(NULL, net_label[net_type], net_type, this_proto);
|
||||||
|
@ -248,8 +248,7 @@ ospf_channel_start: net_type ospf_af_mc
|
||||||
$$ = this_channel = channel_config_get(NULL, net_label[$1], $1, this_proto);
|
$$ = this_channel = channel_config_get(NULL, net_label[$1], $1, this_proto);
|
||||||
|
|
||||||
/* Save the multicast flag */
|
/* Save the multicast flag */
|
||||||
if (this_channel == proto_cf_main_channel(this_proto))
|
OSPF_CFG->af_mc = $2;
|
||||||
OSPF_CFG->af_mc = $2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ospf_channel: ospf_channel_start channel_opt_list channel_end;
|
ospf_channel: ospf_channel_start channel_opt_list channel_end;
|
||||||
|
|
|
@ -46,6 +46,7 @@ proto: radv_proto ;
|
||||||
radv_proto_start: proto_start RADV
|
radv_proto_start: proto_start RADV
|
||||||
{
|
{
|
||||||
this_proto = proto_config_new(&proto_radv, $1);
|
this_proto = proto_config_new(&proto_radv, $1);
|
||||||
|
this_proto->net_type = NET_IP6;
|
||||||
|
|
||||||
init_list(&RADV_CFG->patt_list);
|
init_list(&RADV_CFG->patt_list);
|
||||||
init_list(&RADV_CFG->pref_list);
|
init_list(&RADV_CFG->pref_list);
|
||||||
|
|
|
@ -564,7 +564,7 @@ radv_postconfig(struct proto_config *CF)
|
||||||
// struct radv_config *cf = (void *) CF;
|
// struct radv_config *cf = (void *) CF;
|
||||||
|
|
||||||
/* Define default channel */
|
/* Define default channel */
|
||||||
if (EMPTY_LIST(CF->channels))
|
if (! proto_cf_main_channel(CF))
|
||||||
channel_config_new(NULL, net_label[NET_IP6], NET_IP6, CF);
|
channel_config_new(NULL, net_label[NET_IP6], NET_IP6, CF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ rip_postconfig(struct proto_config *CF)
|
||||||
// struct rip_config *cf = (void *) CF;
|
// struct rip_config *cf = (void *) CF;
|
||||||
|
|
||||||
/* Define default channel */
|
/* Define default channel */
|
||||||
if (EMPTY_LIST(CF->channels))
|
if (! proto_cf_main_channel(CF))
|
||||||
channel_config_new(NULL, net_label[CF->net_type], CF->net_type, CF);
|
channel_config_new(NULL, net_label[CF->net_type], CF->net_type, CF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -923,7 +923,7 @@ rpki_postconfig(struct proto_config *CF)
|
||||||
{
|
{
|
||||||
/* Define default channel */
|
/* Define default channel */
|
||||||
if (EMPTY_LIST(CF->channels))
|
if (EMPTY_LIST(CF->channels))
|
||||||
channel_config_new(NULL, net_label[CF->net_type], CF->net_type, CF);
|
cf_error("Channel not specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -434,7 +434,7 @@ static_postconfig(struct proto_config *CF)
|
||||||
struct static_config *cf = (void *) CF;
|
struct static_config *cf = (void *) CF;
|
||||||
struct static_route *r;
|
struct static_route *r;
|
||||||
|
|
||||||
if (EMPTY_LIST(CF->channels))
|
if (! proto_cf_main_channel(CF))
|
||||||
cf_error("Channel not specified");
|
cf_error("Channel not specified");
|
||||||
|
|
||||||
struct channel_config *cc = proto_cf_main_channel(CF);
|
struct channel_config *cc = proto_cf_main_channel(CF);
|
||||||
|
|
|
@ -1013,7 +1013,7 @@ krt_postconfig(struct proto_config *CF)
|
||||||
if (cf->c.class == SYM_TEMPLATE)
|
if (cf->c.class == SYM_TEMPLATE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (EMPTY_LIST(CF->channels))
|
if (! proto_cf_main_channel(CF))
|
||||||
cf_error("Channel not specified");
|
cf_error("Channel not specified");
|
||||||
|
|
||||||
#ifdef CONFIG_ALL_TABLES_AT_ONCE
|
#ifdef CONFIG_ALL_TABLES_AT_ONCE
|
||||||
|
|
Loading…
Reference in a new issue