Commit Diff
Diff:
d91e568ec838521f5b934081550fb77f31a682ee
1e8325ae1657d692f60590dabda7ef18f8e9e2c4
Commit:
1e8325ae1657d692f60590dabda7ef18f8e9e2c4
Tree:
0d36a83c0bfc8249213c648ad208c472a981b1a6
Author:
pbug <pbug@delphinusdns.org>
Committer:
pbug <pbug@delphinusdns.org>
Date:
Sun Mar 28 09:48:29 2010 UTC
Message:
* make NetBSD 5.0.1 work again (it leaves ttl at 0 in my tests) * update README, take out some OS's that I have no access to currently Darwin is likely to not work so I took it out. * in the README there was a lot of stuff written that didn't need to be there. This patch will keep it short and simple. Tested on NetBSD 5.0.1 Compiles on OpenBSD, Ubuntu, NetBSD
blob - 80527cc83653cde1d8306af890ab1e17a10b02f9
blob + 7eefb8d0d9495e74b385f14d1be0b65b675bfd4c
--- README
+++ README
@@ -1,4 +1,4 @@
-$Id: README,v 1.12 2010/03/18 09:14:14 pbug Exp $
+$Id: README,v 1.13 2010/03/28 09:48:29 pbug Exp $
1. README
2. WHY WILDCARDNS?
@@ -11,19 +11,14 @@ $Id: README,v 1.12 2010/03/18 09:14:14 pbug Exp $
1. README
---------
-Wildcarddns is a small nameserver that can be installed on a bastion host or
-firewall. It does not recurse nor search. Where functionality is missing
-there was probably a reason for that. It was intended to work with pf
-firewalling software so that users have to authenticate to the firewall first
-and then their dns gets redirected to a recursing and searching nameserver
-that sees the Internet. With the Linux port it needs to use netfilter
-instead of pf. This program is written to a BSD Style License and borrows
-code from OpenBSD. Sleepycat's BerkeleyDB is also used for the main database.
+Wildcarddns is a small authoritative nameserver. It does not recurse nor
+search. This program is written to a BSD Style License. Sleepycat's
+BerkeleyDB is also used for the main in-memory database.
2. WHY WILDCARDDNS?
-------------------
-DNS is very simple. Yet implementation of DNS servers is not so simple.
+DNS is simple. Yet implementation of DNS servers is not so simple.
Wildcarddns is written for research into the DNS system so that perhaps one
day the author has a better understanding of it. Comparing wildcarddns to
other DNS implementations is not fair since many of those implementation
@@ -43,7 +38,7 @@ To install type make, followed by make install.
(In linux type make -f Makefile.linux, make a user named "named" for the
chroot to work).
-Under OpenSuse 10.3 and Ubuntu 7.10 I noticed the following files missing:
+Under OpenSuse 10.3 and Ubuntu I noticed the following files missing:
cvs, gcc development and sleepycat's berkeley db (4.5) development. These
had to be install prior to making wildcarddnsd. You basically know when you
need to install these when make barfs with db.h missing (or in extreme cases
@@ -64,30 +59,18 @@ straight forward.
------------------+--------------------+---------------------+
Operating System: | makes and compiles | responds to queries |
------------------+--------------------+---------------------+
-Linux Redhat EL 5 | yes with db4 | yes |
-------------------+--------------------+---------------------+
-Redhat 9 (Shrike) | yes | yes with -b |
-------------------+--------------------+---------------------+
-Linux Ubuntu 7.10 |yes with 2 apt-gets | yes |
-------------------+--------------------+---------------------+
OpenSuse 10.3 | yes | yes |
------------------+--------------------+---------------------+
FreeBSD 7.2 | yes | yes |
------------------+--------------------+---------------------+
-FreeBSD 6.3 | yes | yes |
+NetBSD 5.1 | yes* | yes |
------------------+--------------------+---------------------+
-NetBSD 5.1 | no* | no |
-------------------+--------------------+---------------------+
OpenBSD 4.6 | yes | yes |
------------------+--------------------+---------------------+
-Mac OS X 10.3 | yes | unknown |
-------------------+--------------------+---------------------+
-DragonFlyBSD 1.10 | yes | yes |
-------------------+--------------------+---------------------+
Ubuntu 9.04 | yes | yes |
------------------+--------------------+---------------------+
-* earlier versions of wildcarddns worked (without TTL code)
+* there was a period in time that NetBSD didn't compile
5. EXAMPLES
-----------
@@ -99,6 +82,7 @@ in the directory "examples" are a few examples from wo
-------------------
[stay tuned]
+A lot it can't do.
7. WARNING
----------
blob - 378a149d8a6e06eb4fa80aeb01ae888756b130e0
blob + fd2034adf342fb8aa4d2310b7d233c3b01124892
--- main.c
+++ main.c
@@ -104,7 +104,7 @@ struct tcps {
} *tn1, *tn2, *tnp;
-static const char rcsid[] = "$Id: main.c,v 1.45 2010/03/27 15:40:10 pbug Exp $";
+static const char rcsid[] = "$Id: main.c,v 1.46 2010/03/28 09:48:29 pbug Exp $";
/*
* MAIN - set up arguments, set up database, set up sockets, call mainloop
@@ -277,8 +277,13 @@ main(int argc, char *argv[])
}
if (res->ai_family == AF_INET) {
+#ifdef __NetBSD__
+ if (setsockopt(udp[i], IPPROTO_IP, IP_TTL,
+ &on, sizeof(on)) < 0) {
+#else
if (setsockopt(udp[i], IPPROTO_IP, IP_RECVTTL,
&on, sizeof(on)) < 0) {
+#endif
syslog(LOG_INFO, "setsockopt: %m");
}
}
@@ -385,8 +390,13 @@ main(int argc, char *argv[])
}
if (pifap->ifa_addr->sa_family == AF_INET) {
+#ifdef __NetBSD__
+ if (setsockopt(udp[i], IPPROTO_IP, IP_TTL,
+ &on, sizeof(on)) < 0) {
+#else
if (setsockopt(udp[i], IPPROTO_IP, IP_RECVTTL,
&on, sizeof(on)) < 0) {
+#endif
syslog(LOG_INFO, "setsockopt: %m");
}
}
@@ -1375,7 +1385,7 @@ mainloop(int *udp, int *tcp, int sockcount, char **ide
struct sockaddr_in6 sin6;
} sockaddr_large;
- int fromlen = sizeof(sockaddr_large);
+ socklen_t fromlen = sizeof(sockaddr_large);
struct sockaddr *from = (void *)&sockaddr_large;
struct sockaddr_in *sin;
@@ -1907,9 +1917,13 @@ tcpnxdomain:
cmsg != NULL;
cmsg = CMSG_NXTHDR(&msgh,cmsg)) {
if (cmsg->cmsg_level == IPPROTO_IP
-#ifdef __linux__
+#ifdef __linux__
&& cmsg->cmsg_type == IP_TTL) {
+#elif __NetBSD__
+ && cmsg->cmsg_type == IP_TTL) {
+
#else
+
&& cmsg->cmsg_type == IP_RECVTTL) {
#endif
blob - ffdad9c085d44434dc1d4f14d455c2552f569895
blob + 590f4750b73e164a4408f781e4c4765ed9882f90
--- parse.c
+++ parse.c
@@ -74,7 +74,7 @@ struct cmd_lookup {
static u_int32_t config = 0;
-static const char rcsid[] = "$Id: parse.c,v 1.20 2010/03/27 15:40:10 pbug Exp $";
+static const char rcsid[] = "$Id: parse.c,v 1.21 2010/03/28 09:48:29 pbug Exp $";
/*
* PARSE_FILE - parse the configfile XXX rewrite me in yacc :(
@@ -171,7 +171,7 @@ parse_file(DB *db, char *file)
start = &buf[0];
- while (*start != '\n' && isspace(*start))
+ while (*start != '\n' && isspace((int)*start))
start++;
starttoken = p = start; /* XXX */
repomaster@centroid.eu