Literal ip4/6 addresses in VCL
Nils Goroll
slink at schokola.de
Sun Mar 7 14:56:59 CET 2010
Hi,
I want to add support for assignment to ip address type variables to the VCL.
VRT support looks fairly straight forward (convert strings to struct sockaddr *
using inet_pton), but I am uncertain about a good way to represent literal
addresses in the VCL.
My main question is if they should be tokenized as CSTRs or rather as new
tokens, e.g. of token type IP (not to be confused with variable type IP).
I favor the idea to add new token types, and to facilitate lexing, I would
propose to represent IP addresses as [addr], e.g. [123.45.67.8] or [::1].
For literal addresses, the vcc parser would then generate sockaddr contants,
using the existing backend code, if possible.
This syntax could also be reused for ACLs and backend definitions by allowing
masks like in [fc00::]/7 (or rather [fc00::/7] ?) and ports like in
[123.45.67.8]:8080, but at this point it seems more natural to keep the existing
internal representation for the acl case (struct acl_e) rather than generalizing
all cases into one.
Does this sound reasonable, or should I this be done differently?
Thanks, Nils
More information about the varnish-dev
mailing list