static uint32_t default_ttl = 0;
static bool default_ttl_set = false;
static bool checknames = true;
+static const char *resolvconf = RESOLV_CONF;
typedef struct nsu_requestinfo {
dns_message_t *msg;
isc_log_setdebuglevel(glctx, logdebuglevel);
- result = irs_resconf_load(gmctx, RESOLV_CONF, &resconf);
+ result = irs_resconf_load(gmctx, resolvconf, &resconf);
if (result != ISC_R_SUCCESS && result != ISC_R_FILENOTFOUND) {
- fatal("parse of %s failed", RESOLV_CONF);
+ fatal("parse of %s failed", resolvconf);
}
nslist = irs_resconf_getnameservers(resconf);
fprintf(stderr, "nsupdate %s\n", PACKAGE_VERSION);
}
-#define PARSE_ARGS_FMT "46dDML:y:ghilovk:p:Pr:R::t:Tu:V"
+#define PARSE_ARGS_FMT "46C:dDghilL:Mok:p:Pr:R:t:Tu:vVy:"
static void
pre_parse_args(int argc, char **argv) {
fprintf(stderr, "%s: invalid argument -%c\n",
argv[0], isc_commandline_option);
}
- fprintf(stderr, "usage: nsupdate [-dDi] [-L level] [-l]"
- "[-g | -o | -y keyname:secret | -k "
- "keyfile] "
+ fprintf(stderr, "usage: nsupdate [-CdDi] [-L level] "
+ "[-l] [-g | -o | -y keyname:secret "
+ "| -k keyfile] [-p port] "
"[-v] [-V] [-P] [-T] [-4 | -6] "
"[filename]\n");
exit(1);
fatal("can't find IPv6 networking");
}
break;
+ case 'C':
+ resolvconf = isc_commandline_argument;
+ break;
case 'd':
debugging = true;
break;
break;
case 'R':
- fatal("The -R options has been deprecated.\n");
+ fatal("The -R option has been deprecated.");
break;
default:
grep "NSEC3PARAM has excessive iterations (> 150)" nsupdate.out-$n >/dev/null || ret=1
[ $ret = 0 ] || { echo_i "failed"; status=1; }
+n=`expr $n + 1`
+ret=0
+echo_i "check nsupdate retries with another server on REFUSED response ($n)"
+# resolv.conf uses 10.53.0.1 followed by 10.53.0.3; example is only
+# served by 10.53.0.3, so we should fail over to the second server;
+# that's what we're testing for. (failure is still expected, however,
+# because the address lookup for the primary doesn't use the overridden
+# resolv.conf file).
+$NSUPDATE -D -C resolv.conf -p ${PORT} << EOF > nsupdate.out-$n 2>&1 && ret=1
+zone example
+update add a 3600 IN A 1.2.3.4
+send
+EOF
+grep '10.53.0.1.*REFUSED' nsupdate.out-$n > /dev/null || ret=1
+grep 'Reply from SOA query' nsupdate.out-$n > /dev/null || ret=1
+[ $ret = 0 ] || { echo_i "failed"; status=1; }
+
if ! $FEATURETEST --gssapi ; then
echo_i "SKIPPED: GSSAPI tests"
else