summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2018-11-20 03:42:57 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2018-11-20 03:42:57 +0000
commit285951b2a7b540f7a11af4695ddbfe1c93aa44ab (patch)
tree6c07ddbadf9c98cf4390b989b610be6d747220d5
parentcb028df38695a3f5d506afd8c7f27a982c56ab19 (diff)
move a magic constant into a magic define
-rw-r--r--usr.sbin/rebound/rebound.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/rebound/rebound.c b/usr.sbin/rebound/rebound.c
index 6ccc69c0ab8..311607ccd6f 100644
--- a/usr.sbin/rebound/rebound.c
+++ b/usr.sbin/rebound/rebound.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rebound.c,v 1.101 2018/10/26 06:03:03 deraadt Exp $ */
+/* $OpenBSD: rebound.c,v 1.102 2018/11/20 03:42:56 tedu Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -43,6 +43,12 @@
#define MINIMUM(a,b) (((a)<(b))?(a):(b))
+/*
+ * TTL for permanently cached records.
+ * They don't expire, but need something to put in the response.
+ */
+#define CACHETTL 10
+
uint16_t randomid(void);
union sockun {
@@ -203,7 +209,7 @@ freecacheent(struct dnscache *ent)
}
/*
- * names end with either a nul byte, or a two byte 0xc0 pointer
+ * names end with either a nul byte or a two byte 0xc0 pointer
*/
static size_t
dnamelen(const unsigned char *p, size_t len)
@@ -677,7 +683,7 @@ preloadcache(const char *name, uint16_t type, void *rdata, uint16_t rdatalen)
p += 2;
memcpy(p, &class, 2);
p += 2;
- ttl = htonl(10);
+ ttl = htonl(CACHETTL);
memcpy(p, &ttl, 4);
p += 4;
len = htons(rdatalen);