Varnish with missing "if" in pfSense generated vcl



  • I am having a problem setting up Varnish in pfSense v2.0.3 (i386).  When I set up a backend using only the 3 values of backend name of test, IP address of 192.168.1.1 and port of 100 and then try and start the service, I get the following error:

    php: /status_services.php: The command '/usr/local/etc/rc.d/varnish.sh stop' returned exit code '2', the output was 'kern.ipc.nmbclusters: 65536 sysctl: kern.ipc.nmbclusters: Invalid argument kern.ipc.somaxconn: 16384 -> 16384 kern.maxfiles: 131072 -> 131072 kern.maxfilesperproc: 104856 -> 104856 kern.threads.max_threads_per_proc: 4096 -> 4096 Message from VCC-compiler: Expected an action, 'if', '{' or '}' ('input' Line 60 Pos 17) else { –--------------####----- Running VCC-compiler failed, exit 1 VCL compilation failed'

    I have tried both Varnish3, version 3.0.2 pkg v.0.1 and version2, version 2.1.5 pkg v.1.0.  As you can see, it appears like the vcl that is generated by pfSense is missing an "if" statement.  I have been nosing around and found the following bit of code in /usr/local/pkg/varnish.inc that seems to be where the issue is:

    ...
    ...
    ...
    sub vcl_recv {

    #BASIC VCL RULES SETTING
    #set client balance identity
    set client.identity = client.ip;

    #set X-forward
    unset req.http.X-Forwarded-For;

    ####  MY NOTE - THERE SEEMS TO BE A MISSING "IF" STATEMENT HERE THAT IS CAUSING THE ISSUE ####
    else {
    set req.backend = testBACKEND;
    }

    #respect client wish to refresh the page
    if (req.http.Pragma ~ "no-cache")
    {
    return(pass);
    }

    ...
    ...

    The problem is I don't know how to correct the issue or if this is even the correct spot to correct it.  I also tried just changing the configuration file of /var/etc/default.vcl but each time I do that and then try to start the Varnish service, it changes it right back again.

    So, either there is a bug OR there is a setting in the backend tab of the pfSense Varnish GUI that needs an entry that I am not entering and perhaps when that entry is properly entered it will cause the missing "if" statement to be added.

    Problem is I haven't a clue which it is or how to fix it?  Any assistance would be greatly appreciated.

    Thank you.



  • I pushed a fix for this - please test it and let me know.

    There is quite a bit to still do on this package :/


Log in to reply