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
4ac50ab2
Commit
4ac50ab2
authored
Nov 15, 2021
by
Dridi Boukelmoune
Committed by
Martin Blix Grydeland
Nov 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vca: Log the outcome of sockopt inheritance
parent
ca928ab3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
21 deletions
+61
-21
cache_acceptor.c
bin/varnishd/cache/cache_acceptor.c
+44
-9
l00000.vtc
bin/varnishtest/tests/l00000.vtc
+1
-1
r01804.vtc
bin/varnishtest/tests/r01804.vtc
+15
-10
r02722.vtc
bin/varnishtest/tests/r02722.vtc
+1
-1
No files found.
bin/varnishd/cache/cache_acceptor.c
View file @
4ac50ab2
...
@@ -234,15 +234,27 @@ vca_sock_opt_test(const struct listen_sock *ls, const struct sess *sp)
...
@@ -234,15 +234,27 @@ vca_sock_opt_test(const struct listen_sock *ls, const struct sess *sp)
for
(
n
=
0
;
n
<
n_sock_opts
;
n
++
)
{
for
(
n
=
0
;
n
<
n_sock_opts
;
n
++
)
{
so
=
&
sock_opts
[
n
];
so
=
&
sock_opts
[
n
];
ch
=
&
ls
->
conn_heritage
[
n
];
ch
=
&
ls
->
conn_heritage
[
n
];
if
(
ch
->
sess_set
)
if
(
ch
->
sess_set
)
{
continue
;
/* Already set, no need to retest */
VSL
(
SLT_Debug
,
sp
->
vxid
,
if
(
so
->
level
==
IPPROTO_TCP
&&
ls
->
uds
)
"sockopt: Not testing nonhereditary %s for %s=%s"
,
so
->
strname
,
ls
->
name
,
ls
->
endpoint
);
continue
;
continue
;
}
if
(
so
->
level
==
IPPROTO_TCP
&&
ls
->
uds
)
{
VSL
(
SLT_Debug
,
sp
->
vxid
,
"sockopt: Not testing incompatible %s for %s=%s"
,
so
->
strname
,
ls
->
name
,
ls
->
endpoint
);
continue
;
}
memset
(
&
tmp
,
0
,
sizeof
tmp
);
memset
(
&
tmp
,
0
,
sizeof
tmp
);
l
=
so
->
sz
;
l
=
so
->
sz
;
i
=
getsockopt
(
sp
->
fd
,
so
->
level
,
so
->
optname
,
&
tmp
,
&
l
);
i
=
getsockopt
(
sp
->
fd
,
so
->
level
,
so
->
optname
,
&
tmp
,
&
l
);
if
(
i
==
0
&&
memcmp
(
&
tmp
,
so
->
arg
,
so
->
sz
))
if
(
i
==
0
&&
memcmp
(
&
tmp
,
so
->
arg
,
so
->
sz
))
{
VSL
(
SLT_Debug
,
sp
->
vxid
,
"sockopt: Test confirmed %s non heredity for %s=%s"
,
so
->
strname
,
ls
->
name
,
ls
->
endpoint
);
ch
->
sess_set
=
1
;
ch
->
sess_set
=
1
;
}
if
(
i
&&
errno
!=
ENOPROTOOPT
)
if
(
i
&&
errno
!=
ENOPROTOOPT
)
VTCP_Assert
(
i
);
VTCP_Assert
(
i
);
}
}
...
@@ -253,21 +265,44 @@ vca_sock_opt_set(const struct listen_sock *ls, const struct sess *sp)
...
@@ -253,21 +265,44 @@ vca_sock_opt_set(const struct listen_sock *ls, const struct sess *sp)
{
{
struct
conn_heritage
*
ch
;
struct
conn_heritage
*
ch
;
struct
sock_opt
*
so
;
struct
sock_opt
*
so
;
unsigned
vxid
;
int
n
,
sock
;
int
n
,
sock
;
CHECK_OBJ_NOTNULL
(
ls
,
LISTEN_SOCK_MAGIC
);
CHECK_OBJ_NOTNULL
(
ls
,
LISTEN_SOCK_MAGIC
);
CHECK_OBJ_ORNULL
(
sp
,
SESS_MAGIC
);
sock
=
sp
!=
NULL
?
sp
->
fd
:
ls
->
sock
;
if
(
sp
!=
NULL
)
{
CHECK_OBJ
(
sp
,
SESS_MAGIC
);
sock
=
sp
->
fd
;
vxid
=
sp
->
vxid
;
}
else
{
sock
=
ls
->
sock
;
vxid
=
0
;
}
for
(
n
=
0
;
n
<
n_sock_opts
;
n
++
)
{
for
(
n
=
0
;
n
<
n_sock_opts
;
n
++
)
{
so
=
&
sock_opts
[
n
];
so
=
&
sock_opts
[
n
];
ch
=
&
ls
->
conn_heritage
[
n
];
ch
=
&
ls
->
conn_heritage
[
n
];
if
(
so
->
level
==
IPPROTO_TCP
&&
ls
->
uds
)
if
(
so
->
level
==
IPPROTO_TCP
&&
ls
->
uds
)
{
VSL
(
SLT_Debug
,
vxid
,
"sockopt: Not setting incompatible %s for %s=%s"
,
so
->
strname
,
ls
->
name
,
ls
->
endpoint
);
continue
;
continue
;
if
(
sp
==
NULL
&&
ch
->
listen_mod
==
so
->
mod
)
}
if
(
sp
==
NULL
&&
ch
->
listen_mod
==
so
->
mod
)
{
VSL
(
SLT_Debug
,
vxid
,
"sockopt: Not setting unmodified %s for %s=%s"
,
so
->
strname
,
ls
->
name
,
ls
->
endpoint
);
continue
;
continue
;
if
(
sp
!=
NULL
&&
!
ch
->
sess_set
)
}
if
(
sp
!=
NULL
&&
!
ch
->
sess_set
)
{
VSL
(
SLT_Debug
,
sp
->
vxid
,
"sockopt: %s may be inherited for %s=%s"
,
so
->
strname
,
ls
->
name
,
ls
->
endpoint
);
continue
;
continue
;
}
VSL
(
SLT_Debug
,
vxid
,
"sockopt: Setting %s for %s=%s"
,
so
->
strname
,
ls
->
name
,
ls
->
endpoint
);
VTCP_Assert
(
setsockopt
(
sock
,
VTCP_Assert
(
setsockopt
(
sock
,
so
->
level
,
so
->
optname
,
so
->
arg
,
so
->
sz
));
so
->
level
,
so
->
optname
,
so
->
arg
,
so
->
sz
));
if
(
sp
==
NULL
)
if
(
sp
==
NULL
)
...
...
bin/varnishtest/tests/l00000.vtc
View file @
4ac50ab2
...
@@ -11,7 +11,7 @@ varnish v1 -vcl+backend {
...
@@ -11,7 +11,7 @@ varnish v1 -vcl+backend {
logexpect l1 -v v1 -g session {
logexpect l1 -v v1 -g session {
expect 0 1000 Begin sess
expect 0 1000 Begin sess
expect 0 = SessOpen
expect 0 = SessOpen
expect
0
= Link "req 1001"
expect
*
= Link "req 1001"
expect 0 = SessClose
expect 0 = SessClose
expect 0 = End
expect 0 = End
...
...
bin/varnishtest/tests/r01804.vtc
View file @
4ac50ab2
...
@@ -9,15 +9,11 @@ server s1 {
...
@@ -9,15 +9,11 @@ server s1 {
varnish v1 -arg "-afoo=127.0.0.1:0,PROXY" -vcl+backend {
varnish v1 -arg "-afoo=127.0.0.1:0,PROXY" -vcl+backend {
} -start
} -start
logexpect l1 -v v1 -d 0 -g session {
logexpect l1 -v v1 -g session {
expect * * Begin {^sess .* PROXY$}
expect * 1000 Begin {^sess .* PROXY$}
expect * = SessOpen {^.* foo .*}
expect 0 = SessOpen {^.* foo .*}
expect * = Proxy {^1 }
expect * = Proxy {^1 }
expect * * Begin {^req}
expect * 1001 Begin {^req}
expect * * Begin {^sess .* PROXY$}
expect * = SessOpen {^.* foo .*}
expect * = Proxy {^2 }
expect * * Begin {^req}
} -start
} -start
client c1 {
client c1 {
...
@@ -26,6 +22,15 @@ client c1 {
...
@@ -26,6 +22,15 @@ client c1 {
rxresp
rxresp
} -run
} -run
logexpect l1 -wait
logexpect l2 -v v1 -g session {
expect * 1003 Begin {^sess .* PROXY$}
expect 0 = SessOpen {^.* foo .*}
expect * = Proxy {^2 }
expect * 1004 Begin {^req}
} -start
client c2 {
client c2 {
# good IPv4
# good IPv4
sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a"
sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a"
...
@@ -38,4 +43,4 @@ client c2 {
...
@@ -38,4 +43,4 @@ client c2 {
rxresp
rxresp
} -run
} -run
logexpect l
1
-wait
logexpect l
2
-wait
bin/varnishtest/tests/r02722.vtc
View file @
4ac50ab2
...
@@ -9,7 +9,7 @@ server s0 {
...
@@ -9,7 +9,7 @@ server s0 {
txresp
txresp
} -dispatch
} -dispatch
varnish v1 -arg {-a
:0 -a "
${tmpdir}/v1.sock"}
varnish v1 -arg {-a
TCP=:0 -a "UDS=
${tmpdir}/v1.sock"}
varnish v1 -cliok "param.set debug +flush_head"
varnish v1 -cliok "param.set debug +flush_head"
varnish v1 -cliok "param.set timeout_idle 1"
varnish v1 -cliok "param.set timeout_idle 1"
varnish v1 -vcl+backend { } -start
varnish v1 -vcl+backend { } -start
...
...
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