r5206 - in trunk/varnish-cache: bin/varnishtest/tests lib/libvmod_std
phk at varnish-cache.org
phk at varnish-cache.org
Tue Sep 14 11:12:23 CEST 2010
Author: phk
Date: 2010-09-14 11:12:22 +0200 (Tue, 14 Sep 2010)
New Revision: 5206
Modified:
trunk/varnish-cache/bin/varnishtest/tests/m00001.vtc
trunk/varnish-cache/lib/libvmod_std/vmod.py
trunk/varnish-cache/lib/libvmod_std/vmod.vcc
trunk/varnish-cache/lib/libvmod_std/vmod_std.c
Log:
Add a procedure to std vmod to manipulate the IP TOS byte of the
client connection:
VOID set_ip_tos(INT)
Fixes: #773
Modified: trunk/varnish-cache/bin/varnishtest/tests/m00001.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/m00001.vtc 2010-09-14 09:07:15 UTC (rev 5205)
+++ trunk/varnish-cache/bin/varnishtest/tests/m00001.vtc 2010-09-14 09:12:22 UTC (rev 5206)
@@ -13,6 +13,7 @@
sub vcl_deliver {
set resp.http.foo = std.toupper(resp.http.foo);
set resp.http.bar = std.tolower(resp.http.bar);
+ std.set_ip_tos(32);
}
} -start
@@ -54,3 +55,12 @@
import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so.1" ;
}
+varnish v1 -badvcl {
+ import std from "${topbuild}/lib/libvmod_std/.libs/libvmod_std.so.1" ;
+
+ sub vcl_recv {
+ if (std == 2) {
+ }
+ }
+}
+
Modified: trunk/varnish-cache/lib/libvmod_std/vmod.py
===================================================================
--- trunk/varnish-cache/lib/libvmod_std/vmod.py 2010-09-14 09:07:15 UTC (rev 5205)
+++ trunk/varnish-cache/lib/libvmod_std/vmod.py 2010-09-14 09:12:22 UTC (rev 5206)
@@ -60,6 +60,7 @@
'INT': "int",
'HEADER': "const char *",
'PRIV_VCL': "void **",
+ 'VOID': "void",
}
#######################################################################
Modified: trunk/varnish-cache/lib/libvmod_std/vmod.vcc
===================================================================
--- trunk/varnish-cache/lib/libvmod_std/vmod.vcc 2010-09-14 09:07:15 UTC (rev 5205)
+++ trunk/varnish-cache/lib/libvmod_std/vmod.vcc 2010-09-14 09:12:22 UTC (rev 5206)
@@ -2,3 +2,4 @@
Meta meta_function
Function STRING toupper(STRING_LIST)
Function STRING tolower(PRIV_VCL, STRING_LIST)
+Function VOID set_ip_tos(INT)
Modified: trunk/varnish-cache/lib/libvmod_std/vmod_std.c
===================================================================
--- trunk/varnish-cache/lib/libvmod_std/vmod_std.c 2010-09-14 09:07:15 UTC (rev 5205)
+++ trunk/varnish-cache/lib/libvmod_std/vmod_std.c 2010-09-14 09:12:22 UTC (rev 5206)
@@ -1,10 +1,18 @@
#include <ctype.h>
#include <stdarg.h>
+#include <netinet/in.h>
#include "vrt.h"
#include "../../bin/varnishd/cache.h"
#include "vcc_if.h"
+void
+vmod_set_ip_tos(struct sess *sp, int tos)
+{
+
+ TCP_Assert(setsockopt(sp->fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)));
+}
+
static const char *
vmod_updown(struct sess *sp, int up, const char *s, va_list ap)
{
More information about the varnish-commit
mailing list