ndb/cs: add -6 flag for v6 only lookups and "ipv4" control message to toggle v4 lookups.

This commit is contained in:
cinap_lenrek 2018-07-10 19:57:55 +02:00
parent a8a6429204
commit 24611cf5ed
2 changed files with 23 additions and 3 deletions

View file

@ -35,7 +35,7 @@ query, ipquery, mkhash, mkdb, mkhosts, cs, csquery, dns, dnstcp, dnsquery, dnsde
.br
.B ndb/cs
[
.B -4n
.B -46n
] [
.B -f
.I dbfile
@ -257,10 +257,18 @@ The options are:
Only look up IPv4 addresses (A records) when consulting DNS.
The default is to also look up v6 addresses (AAAA records).
Writing
.L ipv4
to
.B /net/cs
will toggle IP v4 look-ups.
.TP
.B -6
Only look up IPv6 addresses in DNS.
Writing
.L ipv6
to
.B /net/cs
will toggle IP v6 look-ups.
toggles v6 lookups.
.TP
.B -f
supplies the name of the data base file to use,

View file

@ -196,7 +196,7 @@ nstrcpy(char *to, char *from, int len)
void
usage(void)
{
fprint(2, "usage: %s [-dn] [-f ndb-file] [-x netmtpt]\n", argv0);
fprint(2, "usage: %s [-46dn] [-f ndb-file] [-x netmtpt]\n", argv0);
exits("usage");
}
@ -238,6 +238,9 @@ main(int argc, char *argv[])
case '4':
lookipvers = V4;
break;
case '6':
lookipvers = V6;
break;
case 'd':
debug = 1;
break;
@ -799,6 +802,15 @@ rwrite(Job *job, Mfile *mf)
goto send;
}
/*
* toggle ipv4 lookups
*/
if(strncmp(job->request.data, "ipv4", 4)==0){
lookipvers ^= V4;
syslog(1, logfile, "ipv4lookups %d", (lookipvers & V4) != 0);
goto send;
}
/*
* toggle ipv6 lookups
*/