Commit 78c6b983 authored by Mark Andrews's avatar Mark Andrews

Provide more summary outputs.

Allow dead servers to be summarized as "all timeout".
Allow lame servers to be summarized as "all servfail" or "all refused".
parent 85fda9c2
Pipeline #13843 passed with stages
in 1 minute and 15 seconds
......@@ -117,6 +117,7 @@ static int icmp6 = -1;
static int ipv4only = 0;
static int ipv6only = 0;
static int all = 0;
static int allok = 0;
static int bad = 0;
static int badtag = 0;
......@@ -1155,11 +1156,26 @@ printandfree(struct summary *summary) {
jsonsafe(summary->ns, safe, sizeof(safe));
printf(", \"servername\": \"%s\"", safe);
}
if (allok && summary->allok) {
if ((allok || all) && summary->allok) {
printf(", \"summary\": \"all ok\" }");
freesummary(summary);
return;
}
if (all && summary->allrefused) {
printf(", \"summary\": \"all refused\" }");
freesummary(summary);
return;
}
if (all && summary->allservfail) {
printf(", \"summary\": \"all refused\" }");
freesummary(summary);
return;
}
if (all && summary->alltimeout) {
printf(", \"summary\": \"all timeout\" }");
freesummary(summary);
return;
}
printf( ", \"tests\": { ");
for (i = 0; i < sizeof(opts)/sizeof(opts[0]); i++) {
if ((opts[i].what & what) == 0)
......@@ -1197,8 +1213,14 @@ printandfree(struct summary *summary) {
return;
}
printf("%s. @%s (%s.):", summary->zone, addrbuf, summary->ns);
if (allok && summary->allok)
if ((allok || all) && summary->allok)
printf(" all ok");
else if (all && summary->allrefused)
printf(" all refused");
else if (all && summary->allservfail)
printf(" all servfail");
else if (all && summary->alltimeout)
printf(" all timeout");
else
for (i = 0; i < sizeof(opts)/sizeof(opts[0]); i++) {
if ((opts[i].what & what) == 0)
......@@ -2829,6 +2851,8 @@ process(struct workitem *item, unsigned char *buf, int buflen, int port) {
return;
}
item->summary->alltimeout = 0;
if (seenopt)
item->summary->seenopt = 1;
......@@ -2901,8 +2925,11 @@ process(struct workitem *item, unsigned char *buf, int buflen, int port) {
addtag(item, "version-not-zero"), ok = 0;
if (seenopt &&
((ednsvers < opts[item->test].version && rcode != ns_r_badvers) ||
(ednsvers >= opts[item->test].version && rcode == ns_r_badvers)))
(ednsvers >= opts[item->test].version && rcode == ns_r_badvers))) {
item->summary->allrefused = 0;
item->summary->allservfail = 0;
addtag(item, "badversion"), ok = 0;
}
if (!seenopt && opts[item->test].udpsize)
addtag(item, "noopt"), ok = 0;
if (seenopt && opts[item->test].udpsize == 0)
......@@ -3940,11 +3967,12 @@ main(int argc, char **argv) {
int on = 1;
int port = 53;
while ((n = getopt(argc, argv, "46abBcdDeEfgGi:I:jLm:nopP:r:RstTuU:")) != -1) {
while ((n = getopt(argc, argv, "46aAbBcdDeEfgGi:I:jLm:nopP:r:RstTuU:")) != -1) {
switch (n) {
case '4': ipv4only = 1; ipv6only = 0; break;
case '6': ipv6only = 1; ipv4only = 0; break;
case 'a': allok = 1; break;
case 'A': all = 1; break;
case 'b': bad = 1; break;
case 'B': badtag = 1; break;
case 'c': what |= COMM; break;
......@@ -4025,6 +4053,7 @@ main(int argc, char **argv) {
printf("\t-4: IPv4 servers only\n");
printf("\t-6: IPv6 servers only\n");
printf("\t-a: only emit all ok\n");
printf("\t-A: only emit all (ok|refused|servfail|timeout)\n");
printf("\t-b: only emit bad servers\n");
printf("\t-B: only emit bad tests\n");
printf("\t-c: add common queries\n");
......
......@@ -41,6 +41,10 @@ Options are order dependent.
**-a**
: only emit 'all ok' rather than a result for each sub test.
**-A**
: only emit 'all (ok|refused|servfail|timeout)' rather than a result
for each sub test taking into account EDNS version processing.
**-b**
: only emit bad servers.
......
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