Literal ip4/6 addresses in VCL

2010-03-07 Thread Nils Goroll
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
___
varnish-dev mailing list
varnish-dev@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-dev


Re: Literal ip4/6 addresses in VCL

2010-03-07 Thread Poul-Henning Kamp
In message 4b93b0ab.4080...@schokola.de, Nils Goroll writes:

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).

The syntax for this is already decided, just not implemented:

set client.ip = IP(req.http.x-forwarded-for);

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
varnish-dev mailing list
varnish-dev@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-dev


Re: Literal ip4/6 addresses in VCL

2010-03-07 Thread Nils Goroll
 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).
 
 The syntax for this is already decided, just not implemented:
 
   set client.ip = IP(req.http.x-forwarded-for);

Thank you for pointing this out, so I am going to implement this syntax for the 
case where runtime conversion is needed.

Do you have an opinion regarding the suggestion for the VCL compile time case?

IOW, do you favor

set client.ip = [123.45.67.8];
or
set client.ip = 123.45.67.8;

or even no compile time support as in

set client.ip = IP(123.56.78.9);

Thanks, Nils
___
varnish-dev mailing list
varnish-dev@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-dev


Re: Literal ip4/6 addresses in VCL

2010-03-07 Thread Poul-Henning Kamp
In message 4b93b6ea.9010...@schokola.de, Nils Goroll writes:

 The syntax for this is already decided, just not implemented:
 
  set client.ip = IP(req.http.x-forwarded-for);

Thank you for pointing this out, so I am going to implement this syntax for 
the 
case where runtime conversion is needed.

Do you have an opinion regarding the suggestion for the VCL compile time case?

There should not be two different syntaxes, the above should be used in
both cases.

-- 
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
p...@freebsd.org | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
varnish-dev mailing list
varnish-dev@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-dev


Re: Literal ip4/6 addresses in VCL

2010-03-07 Thread Nils Goroll

 There should not be two different syntaxes, the above should be used in
 both cases.

OK, this is going to make life easier for me. And it's true anyway that we can 
put in optimizations later without changing the VCL syntax. Thanks for your 
advise!

Nils
___
varnish-dev mailing list
varnish-dev@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-dev


Allocating per-session memory in a director

2010-03-07 Thread Nils Goroll
Hi,

is it true that the most appropriate ws to make a per-session memory allocation 
from in a director is sp-http-ws?

Thanks, Nils
___
varnish-dev mailing list
varnish-dev@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-dev