diff options
author | Martin Willi <martin@strongswan.org> | 2006-12-21 14:35:17 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-12-21 14:35:17 +0000 |
commit | 7652be891c5d3b1cd305d3e32bce64f5e67134c7 (patch) | |
tree | 5def6569a7d5c8f4305a7b78779d7befa540ea68 /src/charon/config/traffic_selector.c | |
parent | 38ab8048f54ce449339c317310e3e73a7b7f53d0 (diff) | |
download | strongswan-7652be891c5d3b1cd305d3e32bce64f5e67134c7.tar.bz2 strongswan-7652be891c5d3b1cd305d3e32bce64f5e67134c7.tar.xz |
added support for transport mode and (experimental!) BEET mode
support for the type=transport/tunnel parameter in charon
Diffstat (limited to 'src/charon/config/traffic_selector.c')
-rw-r--r-- | src/charon/config/traffic_selector.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/charon/config/traffic_selector.c b/src/charon/config/traffic_selector.c index 2b99b9180..2afeb5e48 100644 --- a/src/charon/config/traffic_selector.c +++ b/src/charon/config/traffic_selector.c @@ -447,15 +447,27 @@ static u_int8_t get_protocol(private_traffic_selector_t *this) */ static bool is_host(private_traffic_selector_t *this, host_t *host) { - chunk_t addr; - int family = host->get_family(host); - - if ((family == AF_INET && this->type == TS_IPV4_ADDR_RANGE) || - (family == AF_INET6 && this->type == TS_IPV6_ADDR_RANGE)) + if (host) { - addr = host->get_address(host); - if (memeq(addr.ptr, this->from, addr.len) && - memeq(addr.ptr, this->to, addr.len)) + chunk_t addr; + int family = host->get_family(host); + + if ((family == AF_INET && this->type == TS_IPV4_ADDR_RANGE) || + (family == AF_INET6 && this->type == TS_IPV6_ADDR_RANGE)) + { + addr = host->get_address(host); + if (memeq(addr.ptr, this->from, addr.len) && + memeq(addr.ptr, this->to, addr.len)) + { + return TRUE; + } + } + } + else + { + size_t length = (this->type == TS_IPV4_ADDR_RANGE) ? 4 : 16; + + if (memeq(this->from, this->to, length)) { return TRUE; } |