Pike v8.1 release 6

Method NetUtils.cidr_to_netmask()


Method cidr_to_netmask

array(int) cidr_to_netmask(string cidr)

Description

Converts a string with an IP address and mask (in CIDR notation) into a binary IP address and bitmask.

Parameter cidr

The CIDR-notation input string.

Returns

An array containing:

Array
int ip

The binary representation of the IP address.

int mask

The bitmask.

Returns 0 if the string could not be parsed.