Commit cc4b5356 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a procedure to std vmod to manipulate the IP TOS byte of the

client connection:

	VOID set_ip_tos(INT)

Fixes:	#773



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5206 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 2dbe1505
......@@ -13,6 +13,7 @@ varnish v1 -vcl+backend {
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 @@ varnish v1 -badvcl {
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) {
}
}
}
......@@ -60,6 +60,7 @@ ctypes = {
'INT': "int",
'HEADER': "const char *",
'PRIV_VCL': "void **",
'VOID': "void",
}
#######################################################################
......
......@@ -2,3 +2,4 @@ Module std
Meta meta_function
Function STRING toupper(STRING_LIST)
Function STRING tolower(PRIV_VCL, STRING_LIST)
Function VOID set_ip_tos(INT)
#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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment