[exim-cvs] Increase buffer size used for DNS responses. Bug…

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Increase buffer size used for DNS responses. Bug 2329
Gitweb: https://git.exim.org/exim.git/commitdiff/75c121f07a85b4029458f11b113a4655114af126
Commit:     75c121f07a85b4029458f11b113a4655114af126
Parent:     1e1d5443ae8072e23f83230ee3f1ece792dbf62f
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Fri Oct 12 20:07:44 2018 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri Oct 12 20:09:01 2018 +0100


    Increase buffer size used for DNS responses.  Bug 2329
---
 doc/doc-txt/ChangeLog     |   5 +
 src/exim_monitor/em_hdr.h |   9 +-
 src/src/dns.c             |   6 +-
 src/src/exim.h            |  12 -
 src/src/structs.h         |   5 +-
 test/stderr/0020          | 550 ++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 568 insertions(+), 19 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 6f16fed..b4aae22 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -137,6 +137,11 @@ JH/28 Bug 2314: Fire msg:fail:delivery event even when error is being ignored.
 JH/29 Bug 2322: A "fail" command in a non-system filter (file) now fires the
       msg:fail:internal event.  Developement by Matthias Kurz.


+JH/30 Bug 2329: Increase buffer size used for dns lookup from 2k, which was
+      far too smal for todays use of crypto signatures stored there.  Go all
+      the way to the max DNS message size of 64kB, even though this might be
+      overmuch for IOT constrained device use.
+


Exim version 4.91
-----------------
diff --git a/src/exim_monitor/em_hdr.h b/src/exim_monitor/em_hdr.h
index 6729436..ada9f36 100644
--- a/src/exim_monitor/em_hdr.h
+++ b/src/exim_monitor/em_hdr.h
@@ -87,11 +87,12 @@ anything. */

#include <pcre.h>

-/* Includes from the main source of Exim. We need to have MAXPACKET defined for
-the benefit of structs.h. One of these days I should tidy up this interface so
-that this kind of kludge isn't needed. */
+/* Includes from the main source of Exim. One of these days I should tidy up
+this interface so that this kind of kludge isn't needed. */

-#define MAXPACKET 1024
+#ifndef NS_MAXMSG
+# define NS_MAXMSG 65535
+#endif
typedef void hctx;

#include "config.h"
diff --git a/src/src/dns.c b/src/src/dns.c
index 297b8b8..0f0b435 100644
--- a/src/src/dns.c
+++ b/src/src/dns.c
@@ -639,6 +639,10 @@ up nameservers that produce this error continually, so there is the option of
providing a list of domains for which this is treated as a non-existent
host.

+The dns_answer structure is pretty big; enough to hold a max-sized DNS message
+- so best allocated from fast-release memory.  As of writing, all our callers
+use a stack-auto variable.
+
 Arguments:
   dnsa      pointer to dns_answer structure
   name      name to look up
@@ -1101,7 +1105,7 @@ switch (type)
       && (h->rcode == NOERROR || h->rcode == NXDOMAIN)
       && ntohs(h->qdcount) == 1 && ntohs(h->ancount) == 0
       && ntohs(h->nscount) >= 1)
-        dnsa->answerlen = MAXPACKET;
+        dnsa->answerlen = sizeof(dnsa->answer);


       for (rr = dns_next_rr(dnsa, &dnss, RESET_AUTHORITY);
        rr; rr = dns_next_rr(dnsa, &dnss, RESET_NEXT)
diff --git a/src/src/exim.h b/src/src/exim.h
index 0de0595..ca6221f 100644
--- a/src/src/exim.h
+++ b/src/src/exim.h
@@ -284,18 +284,6 @@ disabused of the notion. Luckily, since EX_OK is not used, it didn't matter.] */
 #include <arpa/nameser.h>



-/* If arpa/nameser.h defines a maximum name server packet size, use it,
-provided it is greater than 2048. Otherwise go for a default. PACKETSZ was used
-for this, but it seems that NS_PACKETSZ is coming into use. */
-
-#if defined(NS_PACKETSZ) && NS_PACKETSZ >= 2048
- #define MAXPACKET NS_PACKETSZ
-#elif defined(PACKETSZ) && PACKETSZ >= 2048
- #define MAXPACKET PACKETSZ
-#else
- #define MAXPACKET 2048
-#endif
-
/* While IPv6 is still young the definitions of T_AAAA and T_A6 may not be
included in arpa/nameser.h. Fudge them here. */

diff --git a/src/src/structs.h b/src/src/structs.h
index 1ac455c..48f475a 100644
--- a/src/src/structs.h
+++ b/src/src/structs.h
@@ -743,11 +743,12 @@ typedef struct {
   const uschar *data;                   /* pointer to data */
 } dns_record;


-/* Structure for holding the result of a DNS query. */
+/* Structure for holding the result of a DNS query. A touch over
+64k big, so take care to release as soon as possible. */

 typedef struct {
   int     answerlen;              /* length of the answer */
-  uschar  answer[MAXPACKET];      /* the answer itself */
+  uschar  answer[NS_MAXMSG];      /* the answer itself */
 } dns_answer;


/* Structure for holding the intermediate data while scanning a DNS answer
diff --git a/test/stderr/0020 b/test/stderr/0020
index dc674fc..7578b74 100644
--- a/test/stderr/0020
+++ b/test/stderr/0020
@@ -3,26 +3,576 @@
>>> looking up host name for 10.250.104.42
>>> IP address lookup yielded "manyhome.test.ex"
>>> checking addresses for manyhome.test.ex

+>>> 10.250.107.163
+>>> 10.250.109.49
+>>> 10.250.105.65
+>>> 10.250.105.225
+>>> 10.250.106.7
+>>> 10.250.107.0
+>>> 10.250.109.30
+>>> 10.250.110.11
+>>> 10.250.110.80
+>>> 10.250.111.143
+>>> 10.250.105.194
+>>> 10.250.106.43
+>>> 10.250.107.128
+>>> 10.250.107.199
+>>> 10.250.109.68
+>>> 10.250.110.153
+>>> 10.250.106.3
+>>> 10.250.107.91
+>>> 10.250.107.146
+>>> 10.250.108.234
+>>> 10.250.109.222
+>>> 10.250.111.36
+>>> 10.250.111.178
+>>> 10.250.105.97
+>>> 10.250.107.28
+>>> 10.250.107.41
+>>> 10.250.107.59
+>>> 10.250.107.63
+>>> 10.250.108.54
+>>> 10.250.109.34
+>>> 10.250.110.124
+>>> 10.250.105.0
+>>> 10.250.106.15
+>>> 10.250.107.207
+>>> 10.250.107.239
+>>> 10.250.110.166
+>>> 10.250.111.34
+>>> 10.250.109.196
+>>> 10.250.111.7
+>>> 10.250.111.33
+>>> 10.250.110.31
+>>> 10.250.110.40
+>>> 10.250.111.87
+>>> 10.250.111.179
+>>> 10.250.105.178
+>>> 10.250.108.171
+>>> 10.250.106.148
+>>> 10.250.106.221
+>>> 10.250.109.46
+>>> 10.250.109.144
+>>> 10.250.104.144
+>>> 10.250.104.72
+>>> 10.250.105.133
+>>> 10.250.105.214
+>>> 10.250.107.223
+>>> 10.250.108.205
+>>> 10.250.109.91
+>>> 10.250.105.228
+>>> 10.250.106.20
+>>> 10.250.106.198
+>>> 10.250.108.161
+>>> 10.250.108.184
+>>> 10.250.109.183
+>>> 10.250.110.189
+>>> 10.250.104.179
+>>> 10.250.105.111
+>>> 10.250.105.164
+>>> 10.250.108.39
+>>> 10.250.107.198
+>>> 10.250.109.137
+>>> 10.250.108.142
+>>> 10.250.110.192
+>>> 10.250.110.226
+>>> 10.250.111.226
+>>> 10.250.105.26
+>>> 10.250.106.92
+>>> 10.250.109.7
+>>> 10.250.109.207
+>>> 10.250.111.167
+>>> 10.250.106.171
+>>> 10.250.106.203
+>>> 10.250.110.8
+>>> 10.250.110.249
+>>> 10.250.110.151
+>>> 10.250.105.58
+>>> 10.250.109.8
+>>> 10.250.109.170
+>>> 10.250.104.63
+>>> 10.250.106.184
+>>> 10.250.107.49
+>>> 10.250.107.79
+>>> 10.250.109.40
+>>> 10.250.109.254
+>>> 10.250.111.203
+>>> 10.250.107.186
+>>> 10.250.110.24
+>>> 10.250.104.119
+>>> 10.250.106.242
+>>> 10.250.105.76
+>>> 10.250.106.206
+>>> 10.250.108.187
+>>> 10.250.110.179
+>>> 10.250.105.18
+>>> 10.250.106.91
+>>> 10.250.108.226
+>>> 10.250.111.247
>>> 10.250.104.51

+>>> 10.250.104.164
+>>> 10.250.104.247
+>>> 10.250.105.47
+>>> 10.250.105.155
+>>> 10.250.104.75
+>>> 10.250.111.128
+>>> 10.250.104.73
+>>> 10.250.105.69
+>>> 10.250.108.57
+>>> 10.250.109.214
+>>> 10.250.104.149
+>>> 10.250.104.170
+>>> 10.250.105.84
+>>> 10.250.107.149
+>>> 10.250.110.167
+>>> 10.250.110.238
>>> 10.250.104.17

+>>> 10.250.104.212
+>>> 10.250.107.179
+>>> 10.250.107.215
+>>> 10.250.109.192
+>>> 10.250.109.202
+>>> 10.250.111.243
+>>> 10.250.105.116
+>>> 10.250.111.93
+>>> 10.250.105.162
+>>> 10.250.108.1
+>>> 10.250.108.27
+>>> 10.250.111.81
+>>> 10.250.111.122
+>>> 10.250.106.56
+>>> 10.250.106.106
+>>> 10.250.107.69
+>>> 10.250.108.148
+>>> 10.250.109.217
+>>> 10.250.111.164
+>>> 10.250.111.180
+>>> 10.250.104.155
+>>> 10.250.107.74
+>>> 10.250.108.252
+>>> 10.250.110.198
+>>> 10.250.111.159
+>>> 10.250.104.198
+>>> 10.250.105.38
+>>> 10.250.107.8
+>>> 10.250.107.122
+>>> 10.250.109.111
>>> 10.250.104.2

+>>> 10.250.105.213
+>>> 10.250.106.36
+>>> 10.250.107.25
+>>> 10.250.110.175
+>>> 10.250.107.80
+>>> 10.250.108.137
+>>> 10.250.110.6
+>>> 10.250.110.119
+>>> 10.250.105.43
+>>> 10.250.105.171
+>>> 10.250.108.14
+>>> 10.250.105.120
+>>> 10.250.111.186
+>>> 10.250.111.215
+>>> 10.250.105.208
+>>> 10.250.108.240
+>>> 10.250.111.17
+>>> 10.250.104.116
+>>> 10.250.108.55
+>>> 10.250.105.174
+>>> 10.250.107.45
+>>> 10.250.109.134
+>>> 10.250.109.152
+>>> 10.250.110.174
+>>> 10.250.111.37
+>>> 10.250.104.210
+>>> 10.250.104.239
+>>> 10.250.104.255
+>>> 10.250.105.85
+>>> 10.250.109.200
+>>> 10.250.111.145
+>>> 10.250.108.135
+>>> 10.250.109.199
+>>> 10.250.104.196
+>>> 10.250.105.67
+>>> 10.250.105.102
+>>> 10.250.107.89
+>>> 10.250.109.77
+>>> 10.250.109.232
+>>> 10.250.110.3
+>>> 10.250.110.41
+>>> 10.250.108.13
+>>> 10.250.108.131
+>>> 10.250.109.154
+>>> 10.250.111.146
+>>> 10.250.105.7
+>>> 10.250.109.0
+>>> 10.250.111.249
+>>> 10.250.105.14
+>>> 10.250.106.235
+>>> 10.250.107.111
+>>> 10.250.109.161
+>>> 10.250.104.97
+>>> 10.250.104.113
+>>> 10.250.105.204
+>>> 10.250.106.250
+>>> 10.250.109.205
+>>> 10.250.110.65
+>>> 10.250.111.40
>>> 10.250.104.26

+>>> 10.250.104.125
+>>> 10.250.105.103
+>>> 10.250.106.100
+>>> 10.250.107.195
+>>> 10.250.108.73
+>>> 10.250.110.196
+>>> 10.250.108.192
+>>> 10.250.105.241
+>>> 10.250.108.64
+>>> 10.250.110.173
+>>> 10.250.105.28
+>>> 10.250.108.5
+>>> 10.250.111.191
+>>> 10.250.110.133
+>>> 10.250.111.89
+>>> 10.250.110.113
+>>> 10.250.111.244
+>>> 10.250.104.151
+>>> 10.250.104.237
+>>> 10.250.106.32
+>>> 10.250.106.65
+>>> 10.250.107.64
+>>> 10.250.108.56
+>>> 10.250.109.16
+>>> 10.250.104.120
+>>> 10.250.107.48
+>>> 10.250.110.90
+>>> 10.250.110.246
+>>> 10.250.104.124
+>>> 10.250.105.160
+>>> 10.250.106.122
+>>> 10.250.106.237
+>>> 10.250.107.4
+>>> 10.250.107.210
+>>> 10.250.108.11
+>>> 10.250.110.237
+>>> 10.250.106.71
+>>> 10.250.107.26
+>>> 10.250.110.19
+>>> 10.250.110.154
+>>> 10.250.105.23
+>>> 10.250.105.173
+>>> 10.250.106.181
+>>> 10.250.108.243
+>>> 10.250.110.168
+>>> 10.250.104.127
+>>> 10.250.105.183
+>>> 10.250.111.105
+>>> 10.250.107.118
+>>> 10.250.109.129
+>>> 10.250.111.216
+>>> 10.250.111.230
>>> 10.250.104.8

+>>> 10.250.109.153
+>>> 10.250.104.192
+>>> 10.250.108.238
+>>> 10.250.108.244
+>>> 10.250.108.251
+>>> 10.250.110.201
+>>> 10.250.106.118
+>>> 10.250.106.245
+>>> 10.250.108.105
+>>> 10.250.110.148
+>>> 10.250.105.16
+>>> 10.250.108.183
+>>> 10.250.111.41
+>>> 10.250.111.56
+>>> 10.250.105.238
+>>> 10.250.106.13
+>>> 10.250.111.73
>>> 10.250.104.18
>>> 10.250.104.25

+>>> 10.250.105.227
+>>> 10.250.108.147
+>>> 10.250.111.49
+>>> 10.250.104.115
+>>> 10.250.105.131
+>>> 10.250.106.233
+>>> 10.250.107.55
+>>> 10.250.104.76
+>>> 10.250.106.153
+>>> 10.250.109.75
+>>> 10.250.111.131
+>>> 10.250.111.142
+>>> 10.250.106.41
+>>> 10.250.108.86
+>>> 10.250.108.136
+>>> 10.250.104.231
+>>> 10.250.108.210
+>>> 10.250.108.212
+>>> 10.250.110.67
>>> 10.250.104.21

+>>> 10.250.106.6
+>>> 10.250.106.64
+>>> 10.250.107.43
+>>> 10.250.107.231
+>>> 10.250.111.44
+>>> 10.250.108.68
+>>> 10.250.109.147
+>>> 10.250.110.224
+>>> 10.250.111.181
+>>> 10.250.105.6
+>>> 10.250.106.68
+>>> 10.250.110.84
+>>> 10.250.110.120
+>>> 10.250.104.145
+>>> 10.250.105.202
+>>> 10.250.110.181
+>>> 10.250.105.153
+>>> 10.250.107.46
+>>> 10.250.109.188
+>>> 10.250.111.152
+>>> 10.250.104.185
+>>> 10.250.105.30
+>>> 10.250.111.60
+>>> 10.250.107.220
+>>> 10.250.109.231
+>>> 10.250.110.98
+>>> 10.250.111.238
>>> 10.250.104.39

+>>> 10.250.105.125
+>>> 10.250.107.9
+>>> 10.250.109.243
+>>> 10.250.111.51
+>>> 10.250.111.222
+>>> 10.250.104.187
+>>> 10.250.104.226
+>>> 10.250.106.50
+>>> 10.250.108.196
+>>> 10.250.110.122
+>>> 10.250.105.78
+>>> 10.250.105.106
+>>> 10.250.105.158
+>>> 10.250.106.154
+>>> 10.250.108.114
+>>> 10.250.109.240
+>>> 10.250.110.112
+>>> 10.250.106.141
+>>> 10.250.108.20
+>>> 10.250.108.145
+>>> 10.250.110.145
>>> 10.250.104.32

+>>> 10.250.105.137
+>>> 10.250.106.246
+>>> 10.250.107.194
+>>> 10.250.107.243
+>>> 10.250.109.48
+>>> 10.250.104.123
+>>> 10.250.107.84
+>>> 10.250.107.134
+>>> 10.250.109.11
+>>> 10.250.111.63
>>> 10.250.104.29

+>>> 10.250.105.91
+>>> 10.250.105.135
+>>> 10.250.105.192
+>>> 10.250.108.143
+>>> 10.250.109.108
+>>> 10.250.109.226
+>>> 10.250.110.96
+>>> 10.250.110.128
+>>> 10.250.106.72
+>>> 10.250.107.24
+>>> 10.250.109.167
+>>> 10.250.109.206
+>>> 10.250.105.223
+>>> 10.250.108.223
+>>> 10.250.109.112
+>>> 10.250.110.225
>>> 10.250.104.23

+>>> 10.250.104.251
+>>> 10.250.109.255
+>>> 10.250.111.235
+>>> 10.250.106.134
+>>> 10.250.106.137
+>>> 10.250.106.215
+>>> 10.250.108.36
+>>> 10.250.111.14
+>>> 10.250.106.158
+>>> 10.250.106.160
+>>> 10.250.109.238
+>>> 10.250.104.66
+>>> 10.250.105.34
>>> 10.250.104.43

+>>> 10.250.105.230
+>>> 10.250.106.234
+>>> 10.250.111.45
+>>> 10.250.107.138
+>>> 10.250.107.141
+>>> 10.250.110.5
+>>> 10.250.110.108
+>>> 10.250.110.185
+>>> 10.250.104.103
+>>> 10.250.107.85
+>>> 10.250.109.84
+>>> 10.250.106.164
+>>> 10.250.109.125
+>>> 10.250.111.172
+>>> 10.250.104.91
+>>> 10.250.109.230
+>>> 10.250.106.38
+>>> 10.250.111.114
+>>> 10.250.111.166
+>>> 10.250.105.218
+>>> 10.250.110.52
+>>> 10.250.110.64
+>>> 10.250.111.26
+>>> 10.250.108.246
+>>> 10.250.111.80
+>>> 10.250.104.114
+>>> 10.250.107.184
+>>> 10.250.108.80
+>>> 10.250.108.110
+>>> 10.250.106.12
+>>> 10.250.107.66
+>>> 10.250.107.150
+>>> 10.250.109.43
+>>> 10.250.104.70
+>>> 10.250.105.229
+>>> 10.250.106.48
+>>> 10.250.107.177
+>>> 10.250.110.123
+>>> 10.250.111.82
>>> 10.250.104.46

+>>> 10.250.109.159
+>>> 10.250.111.130
+>>> 10.250.104.225
+>>> 10.250.105.159
+>>> 10.250.106.83
+>>> 10.250.111.123
+>>> 10.250.105.60
+>>> 10.250.105.130
+>>> 10.250.108.0
+>>> 10.250.109.124
+>>> 10.250.110.95
+>>> 10.250.110.253
+>>> 10.250.111.24
+>>> 10.250.111.223
+>>> 10.250.107.124
+>>> 10.250.108.146
+>>> 10.250.110.21
+>>> 10.250.110.232
+>>> 10.250.105.144
+>>> 10.250.105.253
+>>> 10.250.108.72
+>>> 10.250.109.42
+>>> 10.250.106.10
+>>> 10.250.108.198
+>>> 10.250.104.154
+>>> 10.250.105.10
+>>> 10.250.105.166
+>>> 10.250.106.81
+>>> 10.250.106.155
+>>> 10.250.106.67
+>>> 10.250.106.140
+>>> 10.250.111.120
+>>> 10.250.104.216
+>>> 10.250.104.220
+>>> 10.250.107.98
+>>> 10.250.107.246
+>>> 10.250.106.142
+>>> 10.250.107.182
+>>> 10.250.108.206
+>>> 10.250.108.239
+>>> 10.250.109.130
+>>> 10.250.110.158
+>>> 10.250.111.236
+>>> 10.250.107.88
+>>> 10.250.110.126
+>>> 10.250.110.197
+>>> 10.250.110.223
+>>> 10.250.104.199
+>>> 10.250.106.74
+>>> 10.250.107.39
+>>> 10.250.107.240
+>>> 10.250.111.254
+>>> 10.250.104.214
+>>> 10.250.104.233
+>>> 10.250.105.24
+>>> 10.250.106.214
+>>> 10.250.110.92
+>>> 10.250.110.164
>>> 10.250.104.28

+>>> 10.250.104.118
+>>> 10.250.107.54
+>>> 10.250.107.158
+>>> 10.250.109.53
+>>> 10.250.109.82
+>>> 10.250.110.83
>>> 10.250.104.4

+>>> 10.250.106.161
+>>> 10.250.107.34
+>>> 10.250.107.112
+>>> 10.250.109.250
+>>> 10.250.111.158
+>>> 10.250.105.221
+>>> 10.250.107.214
+>>> 10.250.108.237
+>>> 10.250.110.46
+>>> 10.250.110.213
+>>> 10.250.110.241
+>>> 10.250.109.71
+>>> 10.250.111.65
+>>> 10.250.105.129
+>>> 10.250.105.150
+>>> 10.250.107.228
+>>> 10.250.104.95
+>>> 10.250.110.131
+>>> 10.250.109.171
>>> 10.250.104.41

+>>> 10.250.107.191
+>>> 10.250.109.203
+>>> 10.250.110.160
+>>> 10.250.105.250
+>>> 10.250.106.183
+>>> 10.250.111.208
>>> 10.250.104.15

+>>> 10.250.105.206
+>>> 10.250.107.225
+>>> 10.250.107.232
+>>> 10.250.111.177
>>> 10.250.104.14

+>>> 10.250.106.34
+>>> 10.250.107.44
+>>> 10.250.107.157
+>>> 10.250.108.19
+>>> 10.250.108.236
+>>> 10.250.111.59
+>>> 10.250.104.201
+>>> 10.250.108.83
+>>> 10.250.108.95
+>>> 10.250.108.163
+>>> 10.250.108.221
+>>> 10.250.109.220
+>>> 10.250.108.9
+>>> 10.250.109.86
+>>> 10.250.109.93
+>>> 10.250.104.223
+>>> 10.250.105.140
+>>> 10.250.106.16
+>>> 10.250.107.137
+>>> 10.250.108.120
+>>> 10.250.110.43
+>>> 10.250.111.140
>>> 10.250.104.45

+>>> 10.250.107.129
+>>> 10.250.110.242
+>>> 10.250.111.47
+>>> 10.250.106.193
+>>> 10.250.109.97
+>>> 10.250.104.153
+>>> 10.250.105.201
+>>> 10.250.107.175
+>>> 10.250.105.105
+>>> 10.250.111.151
>>> 10.250.104.42 OK
>>> host in host_reject_connection? no (option unset)
>>> host in sender_unqualified_hosts? no (option unset)