Commit Diff
Diff:
00c899138bf0acbaa7093b128ad7bdada83cadbe
5079e58349d41b9bc50292fcc4201888e3d58ded
Commit:
5079e58349d41b9bc50292fcc4201888e3d58ded
Tree:
80863c5acddb9d46b0bcc56ff76acb0e420fbf9c
Author:
pbug <pbug@delphinusdns.org>
Committer:
pbug <pbug@delphinusdns.org>
Date:
Sat Nov 6 17:29:38 2010 UTC
Message:
* res_random.c for better random number generators, taken from OpenBSD BSD license.
blob - 9c31d92736589ebac7117ed5c7fa5a44c2dcceb1
blob + e29be83bd5c2a849e98ab4c0f5c385efc124c6be
--- Makefile.bsd
+++ Makefile.bsd
@@ -1,6 +1,6 @@
PROG=wildcarddnsd
-SRCS=main.c parse.c reply.c additional.c region.c wildcard.c recurse.c
+SRCS=main.c parse.c reply.c additional.c region.c wildcard.c recurse.c res_random.c
#CFLAGS= -DDEBUG -g -Wall
CFLAGS= -Wall -g
blob - 773f52194b7f4d9090d1ac066a6a411a62a335ef
blob + 6fe251398ba24ecb7a2d6d43a4af13b1b36a04a9
--- Makefile.linux
+++ Makefile.linux
@@ -14,7 +14,8 @@ build:
$(CC) $(CFLAGS) -c wildcard.c
$(CC) $(CFLAGS) -c recurse.c
$(CC) $(CFLAGS) -c bsd-arc4random.c
- $(CC) $(CFLAGS) -o wildcarddnsd additional.o main.o parse.o reply.o region.o wildcard.o recurse.o bsd-arc4random.o $(LDADD)
+ $(CC) $(CFLAGS) -c res_random.c
+ $(CC) $(CFLAGS) -o wildcarddnsd additional.o main.o parse.o reply.o region.o wildcard.o recurse.o bsd-arc4random.o res_random.o $(LDADD)
install:
blob - e89b9e0b437f82c9c84dc65df16d72d9a4876c8c
blob + 89220a154fd14f54ad667edb689edb5b98ff9cc2
--- recurse.c
+++ recurse.c
@@ -63,6 +63,8 @@ extern void reply_txt(struct sreply *sreply);
extern int memcasecmp(u_char *, u_char *, int);
extern int get_soa(DB *, struct question *, struct domain *, int);
extern void reply_noerror(struct sreply *);
+extern unsigned int res_randomid(void);
+
void remove_zone(DB *db, struct domain *sd);
int contains(u_char *a, u_char *b);
int level(u_char *p);
@@ -85,7 +87,7 @@ struct recurseentry {
} *rn1, *rn2, *rnp;
-static const char rcsid[] = "$Id: recurse.c,v 1.30 2010/10/11 19:47:58 pbug Exp $";
+static const char rcsid[] = "$Id: recurse.c,v 1.31 2010/11/06 17:29:38 pbug Exp $";
/*
* INIT_RECURSE - initialize the recurse singly linked list
@@ -1678,7 +1680,7 @@ netlookup(DB *db, struct recurses *sr)
return (-1);
}
- sr->port = arc4random() & 0xffff;
+ sr->port = res_randomid() & 0xffff;
/*
* we have to avoid picking servers already
* running ..
@@ -1686,7 +1688,7 @@ netlookup(DB *db, struct recurses *sr)
if (sr->port < 1024)
sr->port += 1024;
- sr->id = arc4random() & 0xffff;
+ sr->id = res_randomid() & 0xffff;
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
@@ -2162,7 +2164,7 @@ netlookup6(DB *db, struct recurses *sr)
return (-1);
}
- sr->port = arc4random() & 0xffff;
+ sr->port = res_randomid() & 0xffff;
/*
* we have to avoid picking servers already
* running ..
@@ -2170,7 +2172,7 @@ netlookup6(DB *db, struct recurses *sr)
if (sr->port < 1024)
sr->port += 1024;
- sr->id = arc4random() & 0xffff;
+ sr->id = res_randomid() & 0xffff;
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
repomaster@centroid.eu