varnishtest "VCL compiler coverage test: vcc_acl.c"

varnish v1 -errvcl {Too wide mask (/33) for IPv4 address} {
	backend b { .host = "${localhost}"; }
	acl a { "10.1.2.3"/33; }
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {Too wide mask (/129) for IPv6 address} {
	backend b { .host = "${localhost}"; }
	acl a { "1::2"/129; }
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -vcl {
	backend b { .host = "${localhost}"; }
	acl a {
		"1.2.3.4"/31;
		"1.2.3.4"/31;
	}
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {Conflicting ACL entries:} {
	backend b { .host = "${localhost}"; }
	acl a {
		"1.2.3.4";
		!"1.2.3.4";
	}
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {DNS lookup(...com): } {
	backend b { .host = "${localhost}"; }
	acl a { "...com"; }
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {DNS lookup(10.1..2): } {
	backend b { .host = "${localhost}"; }
	acl a { "10.1..2"; }
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {Expected ')' got ';'} {
	backend b { .host = "${localhost}"; }
	acl a { ( "10.1.2"; }
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {Expected ';' got ')'} {
	backend b { .host = "${localhost}"; }
	acl a { "10.1.2" ); }
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -vcl {
	backend b { .host = "${localhost}"; }
	acl a {
		! "10.1.3";
		("...com" / 22);
		(!"...com");
	}
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {Operator > not possible on IP} {
	backend b { .host = "${localhost}"; }
	sub vcl_recv { if (client.ip > "${localhost}") { return(pass); } }
}

varnish v1 -vcl {
	backend b { .host = "${localhost}"; }
	acl a {
		"10.1.1"/25;
		"10.1.3"/26;
		"10.1.3"/25;
		"10.1.2"/25;
		"10.1.2"/26;
		"10.1.4"/25;
		"10.2.66"/23;
		! "10.2.64"/23;
		"10.2.68"/23;
	}
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {.../mask is not numeric.} {
	backend b { .host = "${localhost}"; }
	acl a {
		"10.0.1.0/1bc";
	}
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {/mask only allowed once} {
	backend b { .host = "${localhost}"; }
	acl a {
		"10.0.1.0/22" / 22;
	}
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {Expected a flag at:} {
	backend b { .host = "${localhost}"; }
	acl a + foobar {
		"10.0.1.0/22" / 22;
	}
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}

varnish v1 -errvcl {Unknown ACL flag:} {
	backend b { .host = "${localhost}"; }
	acl a +foobar {
		"10.0.1.0/22" / 22;
	}
	sub vcl_recv { if (client.ip ~ a) { return(pass); } }
}
