stroke: Default to %dynamic if no valid TS are specified in left|rightsubnet
Otherwise, we'd end up with an empty TS list, which is not valid. Because end->tohost is set to !end->subnets in starter the removed branch was never used.
This commit is contained in:
@@ -982,28 +982,9 @@ static void add_ts(private_stroke_config_t *this,
|
|||||||
stroke_end_t *end, child_cfg_t *child_cfg, bool local)
|
stroke_end_t *end, child_cfg_t *child_cfg, bool local)
|
||||||
{
|
{
|
||||||
traffic_selector_t *ts;
|
traffic_selector_t *ts;
|
||||||
|
bool ts_added = FALSE;
|
||||||
|
|
||||||
if (end->tohost)
|
if (end->subnets)
|
||||||
{
|
|
||||||
ts = traffic_selector_create_dynamic(end->protocol,
|
|
||||||
end->from_port, end->to_port);
|
|
||||||
child_cfg->add_traffic_selector(child_cfg, local, ts);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!end->subnets)
|
|
||||||
{
|
|
||||||
host_t *net;
|
|
||||||
|
|
||||||
net = host_create_from_string(end->address, 0);
|
|
||||||
if (net)
|
|
||||||
{
|
|
||||||
ts = traffic_selector_create_from_subnet(net, 0, end->protocol,
|
|
||||||
end->from_port, end->to_port);
|
|
||||||
child_cfg->add_traffic_selector(child_cfg, local, ts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
enumerator_t *enumerator;
|
enumerator_t *enumerator;
|
||||||
char *subnet, *pos;
|
char *subnet, *pos;
|
||||||
@@ -1041,6 +1022,7 @@ static void add_ts(private_stroke_config_t *this,
|
|||||||
if (ts)
|
if (ts)
|
||||||
{
|
{
|
||||||
child_cfg->add_traffic_selector(child_cfg, local, ts);
|
child_cfg->add_traffic_selector(child_cfg, local, ts);
|
||||||
|
ts_added = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1049,6 +1031,11 @@ static void add_ts(private_stroke_config_t *this,
|
|||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
}
|
}
|
||||||
|
if (!ts_added)
|
||||||
|
{
|
||||||
|
ts = traffic_selector_create_dynamic(end->protocol,
|
||||||
|
end->from_port, end->to_port);
|
||||||
|
child_cfg->add_traffic_selector(child_cfg, local, ts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user