traffic-selector: Use calc_netbits() in RFC 3779 constructor
authorTobias Brunner <tobias@strongswan.org>
Tue, 25 Aug 2015 17:13:59 +0000 (19:13 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 27 Aug 2015 09:47:36 +0000 (11:47 +0200)
This properly detects prefixes encoded as ranges.

src/libstrongswan/selectors/traffic_selector.c

index 3b7f8c5..6686324 100644 (file)
@@ -849,8 +849,7 @@ traffic_selector_t *traffic_selector_create_from_rfc3779_format(ts_type_t type,
                memcpy(this->to, to.ptr+1, to.len-1);
                this->to[to.len-2] |= mask;
        }
-       this->netbits = chunk_equals(from, to) ? (from.len-1)*8 - from.ptr[0]
-                                                                                  : NON_SUBNET_ADDRESS_RANGE;
+       calc_netbits(this);
        return (&this->public);
 }