djbdnscurve6 53
djbdnscurve6
Loading...
Searching...
No Matches
dnsip.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 "dnsip"
8
9unsigned int flagedns0 = 0;
10unsigned int msgsize = MSGSIZE;
11
12static char seed[128];
13static stralloc fqdn;
14static stralloc out;
15
16int main(int argc,char **argv)
17{
18 int i;
19 char ip4str[IP4_FMT];
20 char ip6str[IP6_FMT];
21
23
24 if (*argv) ++argv;
25
26 while (*argv) {
27 if (!stralloc_copys(&fqdn,*argv))
28 logmsg(WHO,111,FATAL,"out of memory");
29
30 if ((i = dns_ip6(&out,&fqdn)) > 0) {
31 for (i = 0; i + 16 <= out.len; i += 16) {
32 if (ip6_isv4mapped(out.s + i)) continue;
33 buffer_put(buffer_1,ip6str,ip6_fmt(ip6str,out.s + i));
34 buffer_puts(buffer_1," ");
35 }
36 }
37
38 if ((i = dns_ip4(&out,&fqdn)) > 0)
39 for (i = 0; i + 4 <= out.len; i += 4) {
40 buffer_put(buffer_1,ip4str,ip4_fmt(ip4str,out.s + i));
41 buffer_puts(buffer_1," ");
42 }
43
44 ++argv;
45 buffer_puts(buffer_1,"\n");
46 }
47
48 buffer_flush(buffer_1);
49 _exit(0);
50}
int main()
Definition: axfrdns.c:326
#define MSGSIZE
Definition: dns.h:47
int dns_ip4(stralloc *out, stralloc *fqdn)
Definition: dns_ip.c:42
int dns_ip6(stralloc *out, stralloc *fqdn)
Definition: dns_ip.c:133
void dns_random_init(const char data[128])
Definition: dns_random.c:36
uint32 seed[32]
Definition: dnscache-conf.c:36
unsigned int flagedns0
Definition: dnsip.c:9
unsigned int msgsize
Definition: dnsip.c:10
#define WHO
Definition: dnsip.c:7
char ip6str[IP6_FMT]
Definition: tinydns-edit.c:69
char ip4str[IP4_FMT]
Definition: tinydns-edit.c:68