djbdnscurve6 53
djbdnscurve6
Loading...
Searching...
No Matches
dnsipq.c
Go to the documentation of this file.
1#include "buffer.h"
2#include "exit.h"
3#include "logmsg.h"
4#include "ip.h"
5#include "dns.h"
6
7#define WHO "dnsipq"
8
9unsigned int flagedns0 = 0;
10unsigned int msgsize = MSGSIZE;
11
12static char seed[128];
13static stralloc in;
14static stralloc fqdn;
15static stralloc out;
16char ip4[IP4_FMT];
17char ip6[IP6_FMT];
18
19int main(int argc,char **argv)
20{
21 int i;
22
24
25 if (*argv) ++argv;
26
27 while (*argv) {
28 if (!stralloc_copys(&in,*argv))
29 logmsg(WHO,111,FATAL,"out of memory");
30
31 if (dns_ip6_qualify(&out,&fqdn,&in) < 0)
32 logmsg(WHO,111,FATAL,B("unable to find IPv6 address for: ",*argv));
33
34 buffer_put(buffer_1,fqdn.s,fqdn.len);
35 buffer_puts(buffer_1,"\n");
36
37 for (i = 0; i + 16 <= out.len; i += 16) {
38 if (ip6_isv4mapped(out.s + i)) continue;
39 buffer_put(buffer_1,ip6,ip6_fmt(ip6,out.s + i));
40 buffer_puts(buffer_1," ");
41 }
42 buffer_puts(buffer_1,"\n");
43
44 if (dns_ip4_qualify(&out,&fqdn,&in) < 0)
45 logmsg(WHO,111,FATAL,B("unable to find IPv4 address for: ",*argv));
46
47 for (i = 0; i + 4 <= out.len; i += 4) {
48 buffer_put(buffer_1,ip4,ip4_fmt(ip4,out.s + i));
49 buffer_puts(buffer_1," ");
50 }
51 buffer_puts(buffer_1,"\n");
52
53 ++argv;
54 }
55
56 buffer_flush(buffer_1);
57 _exit(0);
58}
int main()
Definition: axfrdns.c:326
#define MSGSIZE
Definition: dns.h:47
int dns_ip4_qualify(stralloc *ipout, stralloc *fqdn, const stralloc *in)
Definition: dns_ipq.c:109
int dns_ip6_qualify(stralloc *ipout, stralloc *fqdn, const stralloc *in)
Definition: dns_ipq.c:157
void dns_random_init(const char data[128])
Definition: dns_random.c:36
uint32 seed[32]
Definition: dnscache-conf.c:36
char ip4[IP4_FMT]
Definition: dnsipq.c:16
unsigned int flagedns0
Definition: dnsipq.c:9
char ip6[IP6_FMT]
Definition: dnsipq.c:17
unsigned int msgsize
Definition: dnsipq.c:10
#define WHO
Definition: dnsipq.c:7