*ret = 0;
}
+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 (!strcmp(option, "dropedns")) {
+ ns_g_dropedns = ISC_TRUE;
+ } 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 {
+ fprintf(stderr, "unknown -T flag '%s\n", option);
+ }
+}
+
static void
parse_command_line(int argc, char *argv[]) {
int ch;
ns_g_chrootdir = isc_commandline_argument;
break;
case 'T': /* NOT DOCUMENTED */
- /*
- * clienttest: make clients single shot with their
- * own memory context.
- */
- 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 (!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,
- "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 (!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,