2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Implement new -T options for xfer system tests

'-T transferinsecs' makes named interpret the max-transfer-time-out,
max-transfer-idle-out, max-transfer-time-in and max-transfer-idle-in
configuration options as seconds instead of minutes.

'-T transferslowly' makes named to sleep for one second for every
xfrout message.

'-T transferstuck' makes named to sleep for one minute for every
xfrout message.
This commit is contained in:
Aram Sargsyan
2023-04-17 12:22:38 +00:00
committed by Ondřej Surý
parent d2377f8e04
commit dfaecfd752
4 changed files with 82 additions and 18 deletions

View File

@@ -133,6 +133,9 @@ static bool nonearest = false;
static bool nosoa = false;
static bool notcp = false;
static bool sigvalinsecs = false;
static bool transferinsecs = false;
static bool transferslowly = false;
static bool transferstuck = false;
/*
* -4 and -6
@@ -765,6 +768,12 @@ parse_T_opt(char *option) {
}
} else if (!strcmp(option, "sigvalinsecs")) {
sigvalinsecs = true;
} else if (!strcmp(option, "transferinsecs")) {
transferinsecs = true;
} else if (!strcmp(option, "transferslowly")) {
transferslowly = true;
} else if (!strcmp(option, "transferstuck")) {
transferstuck = true;
} else if (!strncmp(option, "tat=", 4)) {
named_g_tat_interval = atoi(option + 4);
} else {
@@ -1311,6 +1320,15 @@ setup(void) {
if (sigvalinsecs) {
ns_server_setoption(sctx, NS_SERVER_SIGVALINSECS, true);
}
if (transferinsecs) {
ns_server_setoption(sctx, NS_SERVER_TRANSFERINSECS, true);
}
if (transferslowly) {
ns_server_setoption(sctx, NS_SERVER_TRANSFERSLOWLY, true);
}
if (transferstuck) {
ns_server_setoption(sctx, NS_SERVER_TRANSFERSTUCK, true);
}
}
static void

View File

@@ -905,6 +905,8 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
int seconds;
dns_ttl_t maxttl = 0; /* unlimited */
dns_zone_t *mayberaw = (raw != NULL) ? raw : zone;
bool transferinsecs = ns_server_getoption(named_g_server->sctx,
NS_SERVER_TRANSFERINSECS);
i = 0;
if (zconfig != NULL) {
@@ -1312,12 +1314,16 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL;
result = named_config_get(maps, "max-transfer-time-out", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setmaxxfrout(zone, cfg_obj_asuint32(obj) * 60);
dns_zone_setmaxxfrout(
zone, transferinsecs ? cfg_obj_asuint32(obj)
: cfg_obj_asuint32(obj) * 60);
obj = NULL;
result = named_config_get(maps, "max-transfer-idle-out", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setidleout(zone, cfg_obj_asuint32(obj) * 60);
dns_zone_setidleout(zone, transferinsecs
? cfg_obj_asuint32(obj)
: cfg_obj_asuint32(obj) * 60);
obj = NULL;
result = named_config_get(maps, "max-journal-size", &obj);
@@ -1913,12 +1919,16 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL;
result = named_config_get(maps, "max-transfer-time-in", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setmaxxfrin(mayberaw, cfg_obj_asuint32(obj) * 60);
dns_zone_setmaxxfrin(
mayberaw, transferinsecs ? cfg_obj_asuint32(obj)
: cfg_obj_asuint32(obj) * 60);
obj = NULL;
result = named_config_get(maps, "max-transfer-idle-in", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL);
dns_zone_setidlein(mayberaw, cfg_obj_asuint32(obj) * 60);
dns_zone_setidlein(mayberaw,
transferinsecs ? cfg_obj_asuint32(obj)
: cfg_obj_asuint32(obj) * 60);
obj = NULL;
result = named_config_get(maps, "max-refresh-time", &obj);

View File

@@ -32,20 +32,23 @@
#include <ns/types.h>
#define NS_SERVER_LOGQUERIES 0x00000001U /*%< log queries */
#define NS_SERVER_NOAA 0x00000002U /*%< -T noaa */
#define NS_SERVER_NOSOA 0x00000004U /*%< -T nosoa */
#define NS_SERVER_NONEAREST 0x00000008U /*%< -T nonearest */
#define NS_SERVER_NOEDNS 0x00000020U /*%< -T noedns */
#define NS_SERVER_DROPEDNS 0x00000040U /*%< -T dropedns */
#define NS_SERVER_NOTCP 0x00000080U /*%< -T notcp */
#define NS_SERVER_DISABLE4 0x00000100U /*%< -6 */
#define NS_SERVER_DISABLE6 0x00000200U /*%< -4 */
#define NS_SERVER_FIXEDLOCAL 0x00000400U /*%< -T fixedlocal */
#define NS_SERVER_SIGVALINSECS 0x00000800U /*%< -T sigvalinsecs */
#define NS_SERVER_EDNSFORMERR 0x00001000U /*%< -T ednsformerr (STD13) */
#define NS_SERVER_EDNSNOTIMP 0x00002000U /*%< -T ednsnotimp */
#define NS_SERVER_EDNSREFUSED 0x00004000U /*%< -T ednsrefused */
#define NS_SERVER_LOGQUERIES 0x00000001U /*%< log queries */
#define NS_SERVER_NOAA 0x00000002U /*%< -T noaa */
#define NS_SERVER_NOSOA 0x00000004U /*%< -T nosoa */
#define NS_SERVER_NONEAREST 0x00000008U /*%< -T nonearest */
#define NS_SERVER_NOEDNS 0x00000020U /*%< -T noedns */
#define NS_SERVER_DROPEDNS 0x00000040U /*%< -T dropedns */
#define NS_SERVER_NOTCP 0x00000080U /*%< -T notcp */
#define NS_SERVER_DISABLE4 0x00000100U /*%< -6 */
#define NS_SERVER_DISABLE6 0x00000200U /*%< -4 */
#define NS_SERVER_FIXEDLOCAL 0x00000400U /*%< -T fixedlocal */
#define NS_SERVER_SIGVALINSECS 0x00000800U /*%< -T sigvalinsecs */
#define NS_SERVER_EDNSFORMERR 0x00001000U /*%< -T ednsformerr (STD13) */
#define NS_SERVER_EDNSNOTIMP 0x00002000U /*%< -T ednsnotimp */
#define NS_SERVER_EDNSREFUSED 0x00004000U /*%< -T ednsrefused */
#define NS_SERVER_TRANSFERINSECS 0x00008000U /*%< -T transferinsecs */
#define NS_SERVER_TRANSFERSLOWLY 0x00010000U /*%< -T transferslowly */
#define NS_SERVER_TRANSFERSTUCK 0x00020000U /*%< -T transferstuck */
/*%
* Type for callback function to get hostname.

View File

@@ -1534,6 +1534,22 @@ sendstream(xfrout_ctx_t *xfr) {
xfrout_log(xfr, ISC_LOG_DEBUG(8),
"sending TCP message of %d bytes", used.length);
/* System test helper options to simulate network issues. */
if (ns_server_getoption(xfr->client->manager->sctx,
NS_SERVER_TRANSFERSLOWLY))
{
/* Sleep for a bit over a second. */
select(0, NULL, NULL, NULL,
&(struct timeval){ 1, 1000 });
}
if (ns_server_getoption(xfr->client->manager->sctx,
NS_SERVER_TRANSFERSTUCK))
{
/* Sleep for a bit over a minute. */
select(0, NULL, NULL, NULL,
&(struct timeval){ 60, 1000 });
}
isc_nmhandle_attach(xfr->client->handle,
&xfr->client->sendhandle);
if (xfr->idletime > 0) {
@@ -1546,6 +1562,23 @@ sendstream(xfrout_ctx_t *xfr) {
xfr->cbytes = used.length;
} else {
xfrout_log(xfr, ISC_LOG_DEBUG(8), "sending IXFR UDP response");
/* System test helper options to simulate network issues. */
if (ns_server_getoption(xfr->client->manager->sctx,
NS_SERVER_TRANSFERSLOWLY))
{
/* Sleep for a bit over a second. */
select(0, NULL, NULL, NULL,
&(struct timeval){ 1, 1000 });
}
if (ns_server_getoption(xfr->client->manager->sctx,
NS_SERVER_TRANSFERSTUCK))
{
/* Sleep for a bit over a minute. */
select(0, NULL, NULL, NULL,
&(struct timeval){ 60, 1000 });
}
ns_client_send(xfr->client);
xfr->stream->methods->pause(xfr->stream);
isc_nmhandle_detach(&xfr->client->reqhandle);