Use a complete port range in traffic_selector_create_from_{subnet,cidr}
This commit is contained in:
@@ -369,7 +369,7 @@ static void add_ts(char *string, child_cfg_t *cfg, bool local)
|
||||
|
||||
if (string)
|
||||
{
|
||||
ts = traffic_selector_create_from_cidr(string, 0, 0);
|
||||
ts = traffic_selector_create_from_cidr(string, 0, 0, 65535);
|
||||
if (!ts)
|
||||
{
|
||||
DBG1(DBG_CFG, "parsing TS string '%s' failed", string);
|
||||
|
||||
@@ -63,7 +63,7 @@ static traffic_selector_t *ts_from_string(char *str)
|
||||
{
|
||||
traffic_selector_t *ts;
|
||||
|
||||
ts = traffic_selector_create_from_cidr(str, 0, 0);
|
||||
ts = traffic_selector_create_from_cidr(str, 0, 0, 65535);
|
||||
if (ts)
|
||||
{
|
||||
return ts;
|
||||
@@ -389,4 +389,3 @@ medcli_config_t *medcli_config_create(database_t *db)
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -873,11 +873,21 @@ static void add_ts(private_stroke_config_t *this,
|
||||
stroke_end_t *end, child_cfg_t *child_cfg, bool local)
|
||||
{
|
||||
traffic_selector_t *ts;
|
||||
u_int16_t from_port, to_port;
|
||||
|
||||
if (end->port)
|
||||
{
|
||||
from_port = to_port = end->port;
|
||||
}
|
||||
else
|
||||
{
|
||||
from_port = 0;
|
||||
to_port = 65535;
|
||||
}
|
||||
|
||||
if (end->tohost)
|
||||
{
|
||||
ts = traffic_selector_create_dynamic(end->protocol,
|
||||
end->port ? end->port : 0, end->port ? end->port : 65535);
|
||||
ts = traffic_selector_create_dynamic(end->protocol, from_port, to_port);
|
||||
child_cfg->add_traffic_selector(child_cfg, local, ts);
|
||||
}
|
||||
else
|
||||
@@ -890,7 +900,7 @@ static void add_ts(private_stroke_config_t *this,
|
||||
if (net)
|
||||
{
|
||||
ts = traffic_selector_create_from_subnet(net, 0, end->protocol,
|
||||
end->port);
|
||||
from_port, to_port);
|
||||
child_cfg->add_traffic_selector(child_cfg, local, ts);
|
||||
}
|
||||
}
|
||||
@@ -902,8 +912,8 @@ static void add_ts(private_stroke_config_t *this,
|
||||
enumerator = enumerator_create_token(end->subnets, ",", " ");
|
||||
while (enumerator->enumerate(enumerator, &subnet))
|
||||
{
|
||||
ts = traffic_selector_create_from_cidr(subnet,
|
||||
end->protocol, end->port);
|
||||
ts = traffic_selector_create_from_cidr(subnet, end->protocol,
|
||||
from_port, to_port);
|
||||
if (ts)
|
||||
{
|
||||
child_cfg->add_traffic_selector(child_cfg, local, ts);
|
||||
|
||||
@@ -89,7 +89,7 @@ static traffic_selector_t *create_ts(char *string)
|
||||
{
|
||||
traffic_selector_t *ts;
|
||||
|
||||
ts = traffic_selector_create_from_cidr(string, 0, 0);
|
||||
ts = traffic_selector_create_from_cidr(string, 0, 0, 65535);
|
||||
if (ts)
|
||||
{
|
||||
return ts;
|
||||
@@ -343,4 +343,3 @@ uci_config_t *uci_config_create(uci_parser_t *parser)
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,8 @@ static job_requeue_t add_exclude_async(entry_t *entry)
|
||||
{
|
||||
has_vip = TRUE;
|
||||
child_cfg->add_traffic_selector(child_cfg, TRUE,
|
||||
traffic_selector_create_from_subnet(host->clone(host), 32, 0, 0));
|
||||
traffic_selector_create_from_subnet(host->clone(host),
|
||||
32, 0, 0, 65535));
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
|
||||
@@ -200,7 +201,8 @@ static job_requeue_t add_exclude_async(entry_t *entry)
|
||||
{
|
||||
host = ike_sa->get_my_host(ike_sa);
|
||||
child_cfg->add_traffic_selector(child_cfg, TRUE,
|
||||
traffic_selector_create_from_subnet(host->clone(host), 32, 0, 0));
|
||||
traffic_selector_create_from_subnet(host->clone(host), 32, 0,
|
||||
0, 65535));
|
||||
}
|
||||
charon->ike_sa_manager->checkin(charon->ike_sa_manager, ike_sa);
|
||||
|
||||
|
||||
@@ -576,12 +576,12 @@ static bool get_ts(private_quick_mode_t *this, message_t *message)
|
||||
if (!tsi)
|
||||
{
|
||||
tsi = traffic_selector_create_from_subnet(hsi->clone(hsi),
|
||||
hsi->get_family(hsi) == AF_INET ? 32 : 128, 0, 0);
|
||||
hsi->get_family(hsi) == AF_INET ? 32 : 128, 0, 0, 65535);
|
||||
}
|
||||
if (!tsr)
|
||||
{
|
||||
tsr = traffic_selector_create_from_subnet(hsr->clone(hsr),
|
||||
hsr->get_family(hsr) == AF_INET ? 32 : 128, 0, 0);
|
||||
hsr->get_family(hsr) == AF_INET ? 32 : 128, 0, 0, 65535);
|
||||
}
|
||||
if (this->mode == MODE_TRANSPORT && this->udp &&
|
||||
(!tsi->is_host(tsi, hsi) || !tsr->is_host(tsr, hsr)))
|
||||
|
||||
Reference in New Issue
Block a user