djbdnscurve6 45
djbdnscurve6
Loading...
Searching...
No Matches
serverok.c
Go to the documentation of this file.
1#include <sys/types.h>
2#include <sys/stat.h>
3#include "byte.h"
4#include "stralloc.h"
5#include "serverok.h"
6#include "ip.h"
7
8static char fnserver[4 + IPFMT];
9static char fncurve[4 + IPFMT];
10
11/* -1 no curve server
12 1 omitt server */
13
14int serverok(char ip[16])
15{
16 struct stat st;
17
18 fnserver[0] = fncurve[0] = 'i';
19 fnserver[1] = fncurve[1] = 'p';
20 fnserver[2] = fncurve[2] = '/';
21 fnserver[3] = '%';
22 fncurve[3] = '-';
23
24 if (byte_equal(ip,12,V4mappedprefix)) {
25 fnserver[4 + ip4_fmt(fnserver + 4,ip + 12)] = 0;
26 fncurve[4 + ip4_fmt(fncurve + 4,ip + 12)] = 0;
27 } else {
28 fnserver[4 + ip6_fmt(fnserver + 4,ip)] = 0;
29 fncurve[4 + ip6_fmt(fncurve + 4,ip)] = 0;
30 }
31
32 if (stat(fnserver,&st) == 0) return 1;
33 if (stat(fncurve,&st) == 0) return -1;
34
35 return 0;
36}
char ip[16]
Definition: axfrdns.c:125
int serverok(char ip[16])
Definition: serverok.c:14