summaryrefslogtreecommitdiff
path: root/src/pki/pki.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2017-04-01 16:26:44 +0200
committerYves-Alexis Perez <corsac@corsac.net>2017-04-01 16:26:44 +0200
commit05ddd767992d68bb38c7f16ece142e8c2e9ae016 (patch)
tree302c618be306d4ed3c7f9fc58a1f6aaad4dd252f /src/pki/pki.c
parent25663e04c3ab01ef8dc9f906608282319cfea2db (diff)
downloadvyos-strongswan-05ddd767992d68bb38c7f16ece142e8c2e9ae016.tar.gz
vyos-strongswan-05ddd767992d68bb38c7f16ece142e8c2e9ae016.zip
New upstream version 5.5.2
Diffstat (limited to 'src/pki/pki.c')
-rw-r--r--src/pki/pki.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/pki/pki.c b/src/pki/pki.c
index 472704945..0fdab2aab 100644
--- a/src/pki/pki.c
+++ b/src/pki/pki.c
@@ -258,6 +258,28 @@ hash_algorithm_t get_default_digest(private_key_t *private)
return alg == HASH_UNKNOWN ? HASH_SHA256 : alg;
}
+/*
+ * Described in header
+ */
+traffic_selector_t* parse_ts(char *str)
+{
+ ts_type_t type = TS_IPV4_ADDR_RANGE;
+ char *to, from[64];
+
+ if (strchr(str, ':'))
+ {
+ type = TS_IPV6_ADDR_RANGE;
+ }
+ to = strchr(str, '-');
+ if (to)
+ {
+ snprintf(from, sizeof(from), "%.*s", (int)(to - str), str);
+ to++;
+ return traffic_selector_create_from_string(0, type, from, 0, to, 65535);
+ }
+ return traffic_selector_create_from_cidr(str, 0, 0, 65535);
+}
+
/**
* Callback credential set pki uses
*/