We've been making changes to how we organize and display our docs. Our work isn't done but we'd love your feedback.

IP

The IP type represents both IPv4 and IPv6 addresses. These are individual addresses, with no netmask. Literals may be given in a variety of formats using the usual dotted quad for IPv4 and colon-separated IPv6. For example:

1
2
3
4
5
6
7
declare local var.ip IP;
set var.ip = "192.0.2.0";
set var.ip = "2001:db8::1";
set var.ip = "2002:c000:0204::"; /* 6to4 mapping for "192.0.2.4" */
set var.ip = "::FFFF:192.0.2.4"; /* IPv4 mapping for "192.0.2.4" */
set var.ip = "::1";
set var.ip = "::"; /* unspecified address */

Short forms for IPv4 are not permitted:

1
2
3
4
declare local var.ip IP;
set var.ip = "192.2.0"; /* invalid; would be equivalent to "192.0.2.0" */
set var.ip = "127.1";   /* invalid; would be equivalent to "127.0.0.1" */
set var.ip = "0";       /* invalid; would be equivalent to "0.0.0.0"   */
Back to Top