Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
d0a23b2b
Unverified
Commit
d0a23b2b
authored
Nov 16, 2020
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
std.set_ip_tos() to support IPv6
parent
948661aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
9 deletions
+22
-9
vmod_std.c
lib/libvmod_std/vmod_std.c
+14
-3
vmod_std.vcc
lib/libvmod_std/vmod_std.vcc
+8
-6
No files found.
lib/libvmod_std/vmod_std.c
View file @
d0a23b2b
...
...
@@ -55,15 +55,26 @@ VCL_VOID v_matchproto_(td_std_set_ip_tos)
vmod_set_ip_tos
(
VRT_CTX
,
VCL_INT
tos
)
{
struct
suckaddr
*
sa
;
int
itos
=
tos
;
int
fam
,
itos
=
tos
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AZ
(
SES_Get_local_addr
(
ctx
->
req
->
sp
,
&
sa
));
/* Silently ignore for non-IP addresses. */
if
(
VSA_Compare
(
sa
,
bogo_ip
)
==
0
)
return
;
VTCP_Assert
(
setsockopt
(
ctx
->
req
->
sp
->
fd
,
IPPROTO_IP
,
IP_TOS
,
&
itos
,
sizeof
(
itos
)));
fam
=
VSA_Get_Proto
(
sa
);
switch
(
fam
)
{
case
PF_INET
:
VTCP_Assert
(
setsockopt
(
ctx
->
req
->
sp
->
fd
,
IPPROTO_IP
,
IP_TOS
,
&
itos
,
sizeof
(
itos
)));
break
;
case
PF_INET6
:
VTCP_Assert
(
setsockopt
(
ctx
->
req
->
sp
->
fd
,
IPPROTO_IPV6
,
IPV6_TCLASS
,
&
itos
,
sizeof
(
itos
)));
break
;
default:
INCOMPL
();
}
}
static
const
char
*
...
...
lib/libvmod_std/vmod_std.vcc
View file @
d0a23b2b
...
...
@@ -538,12 +538,14 @@ Example::
$Function VOID set_ip_tos(INT tos)
Sets the IP type-of-service (TOS) field for the current session to
*tos*. Silently ignored if the listen address is a Unix domain socket.
Please note that the TOS field is not removed by the end of the
request so probably want to set it on every request should you utilize
it.
Sets the Differentiated Services Codepoint (DSCP) / IPv4 Type of
Service (TOS) / IPv6 Traffic Class (TCLASS) byte for the current
session to *tos*. Silently ignored if the listen address is a Unix
domain socket.
Please note that setting the traffic class affects all requests on the
same http1.1 / http2 TCP connection and, in particular, is not removed
at the end of the request.
Example::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment