djbdnscurve6 45
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
9static char seed[128];
10
11static stralloc in;
12static stralloc fqdn;
13static stralloc out;
14char ip4[IP4_FMT];
15char ip6[IP6_FMT];
16
17int main(int argc,char **argv)
18{
19 int i;
20
22
23 if (*argv) ++argv;
24
25 while (*argv) {
26 if (!stralloc_copys(&in,*argv))
27 logmsg(WHO,111,FATAL,"out of memory");
28
29 if (dns_ip6_qualify(&out,&fqdn,&in) < 0)
30 logmsg(WHO,111,FATAL,B("unable to find IPv6 address for: ",*argv));
31
32 buffer_put(buffer_1,fqdn.s,fqdn.len);
33 buffer_puts(buffer_1,"\n");
34
35 for (i = 0; i + 16 <= out.len; i += 16) {
36 if (ip6_isv4mapped(out.s + i)) continue;
37 buffer_put(buffer_1,ip6,ip6_fmt(ip6,out.s + i));
38 buffer_puts(buffer_1," ");
39 }
40 buffer_puts(buffer_1,"\n");
41
42 if (dns_ip4_qualify(&out,&fqdn,&in) < 0)
43 logmsg(WHO,111,FATAL,B("unable to find IPv4 address for: ",*argv));
44
45 for (i = 0; i + 4 <= out.len; i += 4) {
46 buffer_put(buffer_1,ip4,ip4_fmt(ip4,out.s + i));
47 buffer_puts(buffer_1," ");
48 }
49 buffer_puts(buffer_1,"\n");
50
51 ++argv;
52 }
53
54 buffer_flush(buffer_1);
55 _exit(0);
56}
int main()
Definition: axfrdns.c:323
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:37
uint32 seed[32]
Definition: dnscache-conf.c:36
char ip4[IP4_FMT]
Definition: dnsipq.c:14
char ip6[IP6_FMT]
Definition: dnsipq.c:15
#define WHO
Definition: dnsipq.c:7