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
2d6df8e6
Commit
2d6df8e6
authored
Oct 01, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only do the "feature dns" DNS-lookup if/when necessary.
Spotted by: Willy Tarreau <w@1wt.eu>
parent
5e263a0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
37 deletions
+36
-37
vtc.h
bin/varnishtest/vtc.h
+0
-1
vtc_main.c
bin/varnishtest/vtc_main.c
+0
-35
vtc_misc.c
bin/varnishtest/vtc_misc.c
+36
-1
No files found.
bin/varnishtest/vtc.h
View file @
2d6df8e6
...
...
@@ -82,7 +82,6 @@ extern char *vmod_path;
extern
struct
vsb
*
params_vsb
;
extern
int
leave_temp
;
extern
int
vtc_witness
;
extern
int
feature_dns
;
extern
int
ign_unknown_macro
;
void
init_server
(
void
);
...
...
bin/varnishtest/vtc_main.c
View file @
2d6df8e6
...
...
@@ -97,7 +97,6 @@ char *vmod_path = NULL;
struct
vsb
*
params_vsb
=
NULL
;
int
leave_temp
;
int
vtc_witness
=
0
;
int
feature_dns
;
/**********************************************************************
* Parse a -D option argument into a name/val pair, and insert
...
...
@@ -430,39 +429,6 @@ i_mode(void)
AZ
(
putenv
(
strdup
(
"MALLOC_CONF=abort:true,junk:true"
)));
}
/**********************************************************************
* Most test-cases use only numeric IP#'s but a few requires non-demented
* DNS services. This is a basic sanity check for those.
*/
static
int
v_matchproto_
(
vss_resolved_f
)
dns_cb
(
void
*
priv
,
const
struct
suckaddr
*
sa
)
{
char
abuf
[
VTCP_ADDRBUFSIZE
];
char
pbuf
[
VTCP_PORTBUFSIZE
];
int
*
ret
=
priv
;
VTCP_name
(
sa
,
abuf
,
sizeof
abuf
,
pbuf
,
sizeof
pbuf
);
if
(
strcmp
(
abuf
,
"192.0.2.255"
))
{
fprintf
(
stderr
,
"DNS-test: Wrong response: %s
\n
"
,
abuf
);
*
ret
=
-
1
;
}
else
if
(
*
ret
==
0
)
*
ret
=
1
;
return
(
0
);
}
static
int
dns_works
(
void
)
{
int
ret
=
0
,
error
;
const
char
*
msg
;
error
=
VSS_resolver
(
"dns-canary.freebsd.dk"
,
NULL
,
dns_cb
,
&
ret
,
&
msg
);
if
(
error
||
msg
!=
NULL
||
ret
!=
1
)
return
(
0
);
return
(
1
);
}
/**********************************************************************
* Figure out what IP related magic
*/
...
...
@@ -682,7 +648,6 @@ main(int argc, char * const *argv)
AZ
(
VSB_finish
(
params_vsb
));
feature_dns
=
dns_works
();
ip_magic
();
if
(
iflg
)
...
...
bin/varnishtest/vtc_misc.c
View file @
2d6df8e6
...
...
@@ -47,6 +47,8 @@
#include "vnum.h"
#include "vre.h"
#include "vtcp.h"
#include "vss.h"
#include "vtim.h"
/* SECTION: vtest vtest
...
...
@@ -338,6 +340,39 @@ cmd_delay(CMD_ARGS)
VTIM_sleep
(
f
);
}
/**********************************************************************
* Most test-cases use only numeric IP#'s but a few requires non-demented
* DNS services. This is a basic sanity check for those.
*/
static
int
v_matchproto_
(
vss_resolved_f
)
dns_cb
(
void
*
priv
,
const
struct
suckaddr
*
sa
)
{
char
abuf
[
VTCP_ADDRBUFSIZE
];
char
pbuf
[
VTCP_PORTBUFSIZE
];
int
*
ret
=
priv
;
VTCP_name
(
sa
,
abuf
,
sizeof
abuf
,
pbuf
,
sizeof
pbuf
);
if
(
strcmp
(
abuf
,
"192.0.2.255"
))
{
fprintf
(
stderr
,
"DNS-test: Wrong response: %s
\n
"
,
abuf
);
*
ret
=
-
1
;
}
else
if
(
*
ret
==
0
)
*
ret
=
1
;
return
(
0
);
}
static
int
dns_works
(
void
)
{
int
ret
=
0
,
error
;
const
char
*
msg
;
error
=
VSS_resolver
(
"dns-canary.freebsd.dk"
,
NULL
,
dns_cb
,
&
ret
,
&
msg
);
if
(
error
||
msg
!=
NULL
||
ret
!=
1
)
return
(
0
);
return
(
1
);
}
/* SECTION: feature feature
*
* Test that the required feature(s) for a test are available, and skip
...
...
@@ -424,7 +459,7 @@ cmd_feature(CMD_ARGS)
}
FEATURE
(
"pcre_jit"
,
VRE_has_jit
);
FEATURE
(
"64bit"
,
sizeof
(
void
*
)
==
8
);
FEATURE
(
"dns"
,
feature_dns
);
FEATURE
(
"dns"
,
dns_works
()
);
FEATURE
(
"topbuild"
,
iflg
);
FEATURE
(
"root"
,
!
geteuid
());
FEATURE
(
"user_varnish"
,
getpwnam
(
"varnish"
)
!=
NULL
);
...
...
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