Add a traffic selector constructor creating a TS directly from a CIDR string
This commit is contained in:
@@ -815,6 +815,23 @@ traffic_selector_t *traffic_selector_create_from_string(
|
||||
return (&this->public);
|
||||
}
|
||||
|
||||
/*
|
||||
* see header
|
||||
*/
|
||||
traffic_selector_t *traffic_selector_create_from_cidr(char *string,
|
||||
u_int8_t protocol, u_int16_t port)
|
||||
{
|
||||
host_t *net;
|
||||
int bits;
|
||||
|
||||
net = host_create_from_subnet(string, &bits);
|
||||
if (net)
|
||||
{
|
||||
return traffic_selector_create_from_subnet(net, bits, protocol, port);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* see header
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user