ike-cfg: Use host_create_from_range() helper
This commit is contained in:
@@ -459,27 +459,12 @@ static traffic_selector_t* make_range(char *str)
|
|||||||
{
|
{
|
||||||
traffic_selector_t *ts;
|
traffic_selector_t *ts;
|
||||||
ts_type_t type;
|
ts_type_t type;
|
||||||
char *pos;
|
|
||||||
host_t *from, *to;
|
host_t *from, *to;
|
||||||
|
|
||||||
pos = strchr(str, '-');
|
if (!host_create_from_range(str, &from, &to))
|
||||||
if (!pos)
|
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
to = host_create_from_string(pos + 1, 0);
|
|
||||||
if (!to)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
str = strndup(str, pos - str);
|
|
||||||
from = host_create_from_string_and_family(str, to->get_family(to), 0);
|
|
||||||
free(str);
|
|
||||||
if (!from)
|
|
||||||
{
|
|
||||||
to->destroy(to);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (to->get_family(to) == AF_INET)
|
if (to->get_family(to) == AF_INET)
|
||||||
{
|
{
|
||||||
type = TS_IPV4_ADDR_RANGE;
|
type = TS_IPV4_ADDR_RANGE;
|
||||||
|
|||||||
Reference in New Issue
Block a user