aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/config/traffic_selector.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2005-12-01 14:17:51 +0000
committerMartin Willi <martin@strongswan.org>2005-12-01 14:17:51 +0000
commited1b7b40cdc28854512c0ff976eec115db981892 (patch)
treedfd7e0fb692c629edab3e41fc66968127e2d00b2 /Source/charon/config/traffic_selector.c
parent7d85e0ac6ecdc2b3220508af9cbb2dbe5320e90a (diff)
downloadstrongswan-ed1b7b40cdc28854512c0ff976eec115db981892.tar.bz2
strongswan-ed1b7b40cdc28854512c0ff976eec115db981892.tar.xz
- tested sa with traffic selectors
- fixed ALOT of bugs ;-)
Diffstat (limited to 'Source/charon/config/traffic_selector.c')
-rw-r--r--Source/charon/config/traffic_selector.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/Source/charon/config/traffic_selector.c b/Source/charon/config/traffic_selector.c
index 22ab2a91a..3a95c65c6 100644
--- a/Source/charon/config/traffic_selector.c
+++ b/Source/charon/config/traffic_selector.c
@@ -99,31 +99,26 @@ static traffic_selector_t *get_subset(private_traffic_selector_t *this, private_
u_int16_t from_port, to_port;
private_traffic_selector_t *new_ts;
+ /* calculate the maximum address range allowed for both */
from_addr = max(this->from_addr_ipv4, other->from_addr_ipv4);
to_addr = min(this->to_addr_ipv4, other->to_addr_ipv4);
-
- printf("FromAddr: policy: %u, request: %u, match: %u\n", this->from_addr_ipv4, other->from_addr_ipv4, from_addr);
- printf("ToAddr : policy: %u, request: %u, match: %u\n", this->to_addr_ipv4, other->to_addr_ipv4, to_addr);
if (from_addr > to_addr)
{
/* no match */
return NULL;
}
+
+ /* calculate the maximum port range allowed for both */
from_port = max(this->from_port, other->from_port);
to_port = min(this->to_port, other->to_port);
-
- printf("FromPort: policy: %u, request: %u, match: %u\n", this->from_port, other->from_port, from_port);
- printf("ToPort: policy: %u, request: %u, match: %u\n", this->to_port, other->to_port, to_port);
if (from_port > to_port)
{
/* no match */
return NULL;
}
-
- printf("got one\n");
+ /* got a match, return it */
new_ts = traffic_selector_create(this->protocol, this->type, from_port, to_port);
-
new_ts->from_addr_ipv4 = from_addr;
new_ts->to_addr_ipv4 = to_addr;
new_ts->type = TS_IPV4_ADDR_RANGE;