diff options
author | Martin Willi <martin@strongswan.org> | 2009-03-19 09:16:03 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2009-03-19 09:16:03 +0000 |
commit | c3340cf8dacc2ff61fda73315da1f93b82d6ffe9 (patch) | |
tree | fb16cf6d3d7eb3d4f9b71d28ea1f84e71315336e /src/libstrongswan/utils/host.c | |
parent | ce67ab162d4bb973c5974f6bab302d6af9777b15 (diff) | |
download | strongswan-c3340cf8dacc2ff61fda73315da1f93b82d6ffe9.tar.bz2 strongswan-c3340cf8dacc2ff61fda73315da1f93b82d6ffe9.tar.xz |
respect port in create_dns/create_from_string when passing %any
Diffstat (limited to 'src/libstrongswan/utils/host.c')
-rw-r--r-- | src/libstrongswan/utils/host.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/libstrongswan/utils/host.c b/src/libstrongswan/utils/host.c index 6a6a49089..d42ec5f00 100644 --- a/src/libstrongswan/utils/host.c +++ b/src/libstrongswan/utils/host.c @@ -365,6 +365,18 @@ static private_host_t *host_create_empty(void) } /* + * Create a %any host with port + */ +static host_t *host_create_any_port(int family, u_int16_t port) +{ + host_t *this; + + this = host_create_any(family); + this->set_port(this, port); + return this; +} + +/* * Described in header. */ host_t *host_create_from_string(char *string, u_int16_t port) @@ -373,11 +385,11 @@ host_t *host_create_from_string(char *string, u_int16_t port) if (streq(string, "%any")) { - return host_create_any(AF_INET); + return host_create_any_port(AF_INET, port); } if (streq(string, "%any6")) { - return host_create_any(AF_INET6); + return host_create_any_port(AF_INET6, port); } this = host_create_empty(); @@ -432,11 +444,11 @@ host_t *host_create_from_dns(char *string, int af, u_int16_t port) if (streq(string, "%any")) { - return host_create_any(af ? af : AF_INET); + return host_create_any_port(af ? af : AF_INET, port); } if (streq(string, "%any6")) { - return host_create_any(af ? af : AF_INET6); + return host_create_any_port(af ? af : AF_INET6, port); } else if (strchr(string, ':')) { |