From: Andreas Steffen Date: Tue, 22 Dec 2009 16:07:08 +0000 (+0100) Subject: do not recalculate netbits for true subnets X-Git-Tag: 4.3.6~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=925eadba5fd421bcca9cae1bd37beb6c723104b6;p=thirdparty%2Fstrongswan.git do not recalculate netbits for true subnets --- diff --git a/src/libstrongswan/selectors/traffic_selector.c b/src/libstrongswan/selectors/traffic_selector.c index 87e3464f66..68bbbe2fde 100644 --- a/src/libstrongswan/selectors/traffic_selector.c +++ b/src/libstrongswan/selectors/traffic_selector.c @@ -534,12 +534,14 @@ static void set_address(private_traffic_selector_t *this, host_t *host) { memset(this->from6, 0x00, sizeof(this->from6)); memset(this->to6, 0xFF, sizeof(this->to6)); + this->netbits = 0; } else { chunk_t from = host->get_address(host); memcpy(this->from, from.ptr, from.len); memcpy(this->to, from.ptr, from.len); + this->netbits = from.len * 8; } } } @@ -599,7 +601,8 @@ static void to_subnet(private_traffic_selector_t *this, host_t **net, u_int8_t * u_int16_t port = 0; chunk_t net_chunk; - *mask = calc_netbits(this); + *mask = (this->netbits == NON_SUBNET_ADDRESS_RANGE) ? calc_netbits(this) + : this->netbits; switch (this->type) {