-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathunbound.patch
More file actions
67 lines (63 loc) · 2.04 KB
/
Copy pathunbound.patch
File metadata and controls
67 lines (63 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Written and placed in public domain by Jeffrey Walton.
# This patch fixes some issues with Unbound.
--- cachedb/cachedb.c
+++ cachedb/cachedb.c
@@ -85,6 +85,16 @@
#endif
#endif /* be64toh */
+# if __BIG_ENDIAN__
+# define OUR_BE64TOH(n) (n)
+# define OUR_HTOBE64(n) (n)
+# else
+# define OUR_HI32(n) ((uint32_t)(((uint64_t)(n)) >> 32))
+# define OUR_LO32(n) ((uint32_t)(n))
+# define OUR_BE64TOH(n) ((((uint64_t)htonl(OUR_LO32(n)) << 32)) | htonl(OUR_HI32(n)))
+# define OUR_HTOBE64(n) ((((uint64_t)htonl(OUR_LO32(n)) << 32)) | htonl(OUR_HI32(n)))
+# endif
+
/** the unit test testframe for cachedb, its module state contains
* a cache for a couple queries (in memory). */
struct testframe_moddata {
@@ -407,8 +426,8 @@
/* qstate->return_msg->rep->ttl contains that relative shortest ttl */
timestamp = (uint64_t)*qstate->env->now;
expiry = timestamp + (uint64_t)qstate->return_msg->rep->ttl;
- timestamp = htobe64(timestamp);
- expiry = htobe64(expiry);
+ timestamp = OUR_HTOBE64(timestamp);
+ expiry = OUR_HTOBE64(expiry);
oldlim = sldns_buffer_limit(buf);
if(oldlim + sizeof(timestamp)+sizeof(expiry) >=
sldns_buffer_capacity(buf))
@@ -431,7 +450,7 @@
return 0;
sldns_buffer_read_at(buf, sldns_buffer_limit(buf)-sizeof(expiry),
&expiry, sizeof(expiry));
- expiry = be64toh(expiry);
+ expiry = OUR_BE64TOH(expiry);
if((time_t)expiry < *qstate->env->now &&
!qstate->env->cfg->serve_expired)
@@ -491,8 +510,8 @@
sldns_buffer_read_at(buf, lim-sizeof(expiry), &expiry, sizeof(expiry));
sldns_buffer_read_at(buf, lim-sizeof(expiry)-sizeof(timestamp),
×tamp, sizeof(timestamp));
- expiry = be64toh(expiry);
- timestamp = be64toh(timestamp);
+ expiry = OUR_BE64TOH(expiry);
+ timestamp = OUR_BE64TOH(timestamp);
/* parse DNS packet */
regional_free_all(qstate->env->scratch);
--- services/listen_dnsport.c
+++ services/listen_dnsport.c
@@ -817,6 +817,12 @@
{
int ds;
+#ifndef IPV6_TCLASS
+ /* define to continue the compile */
+ #define IPV6_TCLASS 0
+ return NULL;
+#endif
+
if(dscp == 0)
return NULL;
ds = dscp << 2;