Commit 5ab633d5 authored by Mark Andrews's avatar Mark Andrews

Merge branch '316-move-named-t-processing-to-its-own-function-v9_11' into 'v9_11'

Resolve "move named -T processing to its own function"

Closes #316

See merge request !343
parents c123936d f10ad9c3
Pipeline #2180 passed with stages
in 9 minutes and 50 seconds
......@@ -2,6 +2,9 @@
if available, to configure the test interfaces on
linux. [GL #302]
4962. [cleanup] Move 'named -T' processing to its own function.
[GL #316]
4958. [bug] Remove redundant space from NSEC3 record. [GL #281]
4955. [cleanup] Silence cppcheck warnings in lib/dns/master.c.
......
......@@ -455,6 +455,90 @@ parse_fuzz_arg(void) {
}
}
static void
parse_T_opt(char *option) {
const char *p;
char *last = NULL;
/*
* force the server to behave (or misbehave) in
* specified ways for testing purposes.
*
* clienttest: make clients single shot with their
* own memory context.
* delay=xxxx: delay client responses by xxxx ms to
* simulate remote servers.
* dscp=x: check that dscp values are as
* expected and assert otherwise.
*/
if (!strcmp(option, "clienttest")) {
ns_g_clienttest = ISC_TRUE;
} else if (!strncmp(option, "delay=", 6)) {
ns_g_delay = atoi(option + 6);
} else if (!strcmp(option, "dropedns")) {
ns_g_dropedns = ISC_TRUE;
} else if (!strncmp(option, "dscp=", 5)) {
isc_dscp_check_value = atoi(option + 5);
} else if (!strcmp(option, "fixedlocal")) {
ns_g_fixedlocal = ISC_TRUE;
} else if (!strcmp(option, "keepstderr")) {
ns_g_keepstderr = ISC_TRUE;
} else if (!strcmp(option, "noaa")) {
ns_g_noaa = ISC_TRUE;
} else if (!strcmp(option, "noedns")) {
ns_g_noedns = ISC_TRUE;
} else if (!strcmp(option, "nonearest")) {
ns_g_nonearest = ISC_TRUE;
} else if (!strcmp(option, "nosoa")) {
ns_g_nosoa = ISC_TRUE;
} else if (!strcmp(option, "nosyslog")) {
ns_g_nosyslog = ISC_TRUE;
} else if (!strcmp(option, "notcp")) {
ns_g_notcp = ISC_TRUE;
} else if (!strcmp(option, "maxudp512")) {
maxudp = 512;
} else if (!strcmp(option, "maxudp1460")) {
maxudp = 1460;
} else if (!strncmp(option, "maxudp=", 7)) {
maxudp = atoi(option + 7);
} else if (!strncmp(option, "mkeytimers=", 11)) {
p = strtok_r(option + 11, "/", &last);
if (p == NULL) {
ns_main_earlyfatal("bad mkeytimer");
}
dns_zone_mkey_hour = atoi(p);
if (dns_zone_mkey_hour == 0) {
ns_main_earlyfatal("bad mkeytimer");
}
p = strtok_r(NULL, "/", &last);
if (p == NULL) {
dns_zone_mkey_day = (24 * dns_zone_mkey_hour);
dns_zone_mkey_month = (30 * dns_zone_mkey_day);
return;
}
dns_zone_mkey_day = atoi(p);
if (dns_zone_mkey_day < dns_zone_mkey_hour)
ns_main_earlyfatal("bad mkeytimer");
p = strtok_r(NULL, "/", &last);
if (p == NULL) {
dns_zone_mkey_month = (30 * dns_zone_mkey_day);
return;
}
dns_zone_mkey_month = atoi(p);
if (dns_zone_mkey_month < dns_zone_mkey_day) {
ns_main_earlyfatal("bad mkeytimer");
}
} else if (!strncmp(option, "tat=", 4)) {
ns_g_tat_interval = atoi(option + 4);
} else {
fprintf(stderr, "unknown -T flag '%s\n", option);
}
}
static void
parse_command_line(int argc, char *argv[]) {
int ch;
......@@ -572,94 +656,7 @@ parse_command_line(int argc, char *argv[]) {
ns_g_chrootdir = isc_commandline_argument;
break;
case 'T': /* NOT DOCUMENTED */
/*
* force the server to behave (or misbehave) in
* specified ways for testing purposes.
*
* clienttest: make clients single shot with their
* own memory context.
* delay=xxxx: delay client responses by xxxx ms to
* simulate remote servers.
* dscp=x: check that dscp values are as
* expected and assert otherwise.
*/
if (!strcmp(isc_commandline_argument, "clienttest"))
ns_g_clienttest = ISC_TRUE;
else if (!strcmp(isc_commandline_argument, "nosoa"))
ns_g_nosoa = ISC_TRUE;
else if (!strcmp(isc_commandline_argument, "noaa"))
ns_g_noaa = ISC_TRUE;
else if (!strcmp(isc_commandline_argument, "maxudp512"))
maxudp = 512;
else if (!strcmp(isc_commandline_argument, "maxudp1460"))
maxudp = 1460;
else if (!strcmp(isc_commandline_argument, "dropedns"))
ns_g_dropedns = ISC_TRUE;
else if (!strcmp(isc_commandline_argument, "noedns"))
ns_g_noedns = ISC_TRUE;
else if (!strncmp(isc_commandline_argument,
"maxudp=", 7))
maxudp = atoi(isc_commandline_argument + 7);
else if (!strncmp(isc_commandline_argument,
"delay=", 6))
ns_g_delay = atoi(isc_commandline_argument + 6);
else if (!strcmp(isc_commandline_argument, "nosyslog"))
ns_g_nosyslog = ISC_TRUE;
else if (!strcmp(isc_commandline_argument, "nonearest"))
ns_g_nonearest = ISC_TRUE;
else if (!strncmp(isc_commandline_argument, "dscp=", 5))
isc_dscp_check_value =
atoi(isc_commandline_argument + 5);
else if (!strncmp(isc_commandline_argument,
"mkeytimers=", 11))
{
p = strtok(isc_commandline_argument + 11, "/");
if (p == NULL)
ns_main_earlyfatal("bad mkeytimer");
dns_zone_mkey_hour = atoi(p);
if (dns_zone_mkey_hour == 0)
ns_main_earlyfatal("bad mkeytimer");
p = strtok(NULL, "/");
if (p == NULL) {
dns_zone_mkey_day =
(24 * dns_zone_mkey_hour);
dns_zone_mkey_month =
(30 * dns_zone_mkey_day);
break;
}
dns_zone_mkey_day = atoi(p);
if (dns_zone_mkey_day < dns_zone_mkey_hour)
ns_main_earlyfatal("bad mkeytimer");
p = strtok(NULL, "/");
if (p == NULL) {
dns_zone_mkey_month =
(30 * dns_zone_mkey_day);
break;
}
dns_zone_mkey_month = atoi(p);
if (dns_zone_mkey_month < dns_zone_mkey_day)
ns_main_earlyfatal("bad mkeytimer");
} else if (!strcmp(isc_commandline_argument, "notcp")) {
ns_g_notcp = ISC_TRUE;
} else if (!strncmp(isc_commandline_argument,
"tat=", 4))
{
ns_g_tat_interval =
atoi(isc_commandline_argument + 4);
} else if (!strcmp(isc_commandline_argument,
"keepstderr"))
{
ns_g_keepstderr = ISC_TRUE;
} else if (!strcmp(isc_commandline_argument,
"fixedlocal"))
{
ns_g_fixedlocal = ISC_TRUE;
} else {
fprintf(stderr, "unknown -T flag '%s\n",
isc_commandline_argument);
}
parse_T_opt(isc_commandline_argument);
break;
case 'U':
ns_g_udpdisp = parse_int(isc_commandline_argument,
......
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