]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
ike-cfg: Use host_create_from_range() helper
authorTobias Brunner <tobias@strongswan.org>
Tue, 28 Oct 2014 17:23:10 +0000 (18:23 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 30 Oct 2014 11:32:45 +0000 (12:32 +0100)
src/libcharon/config/ike_cfg.c

index 42a3e90577c82e9124d5b6fd395621cf9d5d9de4..9464ceb5dc6517e97479ce3d3812b43881a61173 100644 (file)
@@ -459,25 +459,10 @@ static traffic_selector_t* make_range(char *str)
 {
        traffic_selector_t *ts;
        ts_type_t type;
-       char *pos;
        host_t *from, *to;
 
-       pos = strchr(str, '-');
-       if (!pos)
-       {
-               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)
+       if (!host_create_from_range(str, &from, &to))
        {
-               to->destroy(to);
                return NULL;
        }
        if (to->get_family(to) == AF_INET)