ts.get_subnet() returns TRUE if the selector actually is a subnet
This commit is contained in:
@@ -571,7 +571,7 @@ METHOD(traffic_selector_t, includes, bool,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(traffic_selector_t, to_subnet, void,
|
METHOD(traffic_selector_t, to_subnet, bool,
|
||||||
private_traffic_selector_t *this, host_t **net, u_int8_t *mask)
|
private_traffic_selector_t *this, host_t **net, u_int8_t *mask)
|
||||||
{
|
{
|
||||||
/* there is no way to do this cleanly, as the address range may
|
/* there is no way to do this cleanly, as the address range may
|
||||||
@@ -597,7 +597,7 @@ METHOD(traffic_selector_t, to_subnet, void,
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* unreachable */
|
/* unreachable */
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
net_chunk.ptr = malloc(net_chunk.len);
|
net_chunk.ptr = malloc(net_chunk.len);
|
||||||
@@ -616,6 +616,8 @@ METHOD(traffic_selector_t, to_subnet, void,
|
|||||||
|
|
||||||
*net = host_create_from_chunk(family, net_chunk, port);
|
*net = host_create_from_chunk(family, net_chunk, port);
|
||||||
chunk_free(&net_chunk);
|
chunk_free(&net_chunk);
|
||||||
|
|
||||||
|
return this->netbits != NON_SUBNET_ADDRESS_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(traffic_selector_t, clone_, traffic_selector_t*,
|
METHOD(traffic_selector_t, clone_, traffic_selector_t*,
|
||||||
|
|||||||
@@ -203,8 +203,9 @@ struct traffic_selector_t {
|
|||||||
*
|
*
|
||||||
* @param net converted subnet (has to be freed)
|
* @param net converted subnet (has to be freed)
|
||||||
* @param mask converted net mask
|
* @param mask converted net mask
|
||||||
|
* @return TRUE if traffic selector matches exactly to the subnet
|
||||||
*/
|
*/
|
||||||
void (*to_subnet) (traffic_selector_t *this, host_t **net, u_int8_t *mask);
|
bool (*to_subnet) (traffic_selector_t *this, host_t **net, u_int8_t *mask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the ts object
|
* Destroys the ts object
|
||||||
|
|||||||
Reference in New Issue
Block a user