mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-08-17 21:25:50 +02:00
Compare commits
530
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1daad9d9c0 | ||
|
|
af93d6033c | ||
|
|
46eeced066 | ||
|
|
70c8f304c2 | ||
|
|
1a2b78e51a | ||
|
|
54d0ed9a70 | ||
|
|
d56aef7b33 | ||
|
|
accc4a6f68 | ||
|
|
39de97e176 | ||
|
|
05e118b7d5 | ||
|
|
174604914f | ||
|
|
d265c02f69 | ||
|
|
17e5bba504 | ||
|
|
5ab9b9c8f9 | ||
|
|
09375e16e7 | ||
|
|
22290ac234 | ||
|
|
86c4c11ca2 | ||
|
|
63c07d13ce | ||
|
|
e8ec432579 | ||
|
|
ad864b0f7e | ||
|
|
cafc73a74f | ||
|
|
8c04c2e187 | ||
|
|
27b5d25703 | ||
|
|
dbd816fafb | ||
|
|
47653ae679 | ||
|
|
3d2156dacc | ||
|
|
25319e6737 | ||
|
|
7359d84e2f | ||
|
|
5f08751b3b | ||
|
|
60e8c22040 | ||
|
|
a742415b5c | ||
|
|
7b5262ccd2 | ||
|
|
c3da97fb35 | ||
|
|
844b5e71b1 | ||
|
|
172260232e | ||
|
|
c155cfc8bc | ||
|
|
447b6a1149 | ||
|
|
7070c35e11 | ||
|
|
dd03b668c5 | ||
|
|
1dff4206d5 | ||
|
|
bbe76430fe | ||
|
|
2c9bf883c9 | ||
|
|
59f5480df1 | ||
|
|
bc06ab0377 | ||
|
|
668bcfc499 | ||
|
|
9229c58c2f | ||
|
|
c89323ef93 | ||
|
|
4f68378640 | ||
|
|
ff23baadcc | ||
|
|
7c128d5013 | ||
|
|
b279987e9f | ||
|
|
8ecb52c532 | ||
|
|
28912ed659 | ||
|
|
f24f631838 | ||
|
|
42730aad99 | ||
|
|
8def9c1043 | ||
|
|
ecf4deedbe | ||
|
|
139ab47dc6 | ||
|
|
608f82a1cd | ||
|
|
5cbf6d059b | ||
|
|
a11fbf9ca0 | ||
|
|
30a339d1a8 | ||
|
|
92e1ec3444 | ||
|
|
62eea87455 | ||
|
|
30602d5d59 | ||
|
|
b23ed42b55 | ||
|
|
784d659e91 | ||
|
|
4df60a1343 | ||
|
|
ca38a8bd55 | ||
|
|
6e9d8fb22c | ||
|
|
35140bb612 | ||
|
|
de82245d3e | ||
|
|
3922eed584 | ||
|
|
efb9c02d54 | ||
|
|
04fa474ac3 | ||
|
|
3c87eb6c49 | ||
|
|
fcc7f9dae0 | ||
|
|
654a9160f5 | ||
|
|
682ad09bc4 | ||
|
|
ffb54322cb | ||
|
|
cc763c103b | ||
|
|
9053ee101d | ||
|
|
0b0a580422 | ||
|
|
b4a089ff0d | ||
|
|
ee6f5c5b51 | ||
|
|
c2299a3c5f | ||
|
|
255d669e58 | ||
|
|
c07e17fda3 | ||
|
|
d8928e1b19 | ||
|
|
01dd4a3568 | ||
|
|
1550bc65f3 | ||
|
|
4011c3861b | ||
|
|
58c2cc2740 | ||
|
|
87296966ae | ||
|
|
eed924d7be | ||
|
|
36d5a75848 | ||
|
|
5996f3b2a9 | ||
|
|
5e2a137562 | ||
|
|
5a154aeb78 | ||
|
|
5ecf75d623 | ||
|
|
797ef20155 | ||
|
|
f7b911b120 | ||
|
|
5feb72d1eb | ||
|
|
22ac684cd9 | ||
|
|
e2dc829258 | ||
|
|
f5a97a3e8f | ||
|
|
790cb51775 | ||
|
|
eaee99fa3b | ||
|
|
583eabb13e | ||
|
|
4a746142cf | ||
|
|
62230b5e04 | ||
|
|
b25ebf0be2 | ||
|
|
35c3a25896 | ||
|
|
6457e97255 | ||
|
|
05e9f914c5 | ||
|
|
046143af20 | ||
|
|
c71f33ead4 | ||
|
|
0bc54677db | ||
|
|
003658eea0 | ||
|
|
15b14306ed | ||
|
|
daab92e954 | ||
|
|
f378068b32 | ||
|
|
e9582487d9 | ||
|
|
c4c8a65ff2 | ||
|
|
f8796f94f4 | ||
|
|
ecb9db442d | ||
|
|
bc7ac1981a | ||
|
|
57f309ab1d | ||
|
|
dd8e44ac37 | ||
|
|
9997255caa | ||
|
|
79f4ca6a28 | ||
|
|
78cc3d8ae1 | ||
|
|
5e62750fcd | ||
|
|
289f13bc25 | ||
|
|
8c5b3d3c8f | ||
|
|
e430e8cef8 | ||
|
|
95da05c4bc | ||
|
|
c9dbc9907a | ||
|
|
6976832ffe | ||
|
|
2fe65ab2b5 | ||
|
|
4e8ae039fa | ||
|
|
c140638659 | ||
|
|
0b30fca935 | ||
|
|
f41a92daf5 | ||
|
|
93e8ff1bb0 | ||
|
|
04e45f98d6 | ||
|
|
08c580bb32 | ||
|
|
d748bca7de | ||
|
|
a3a1119f54 | ||
|
|
74505ea3f2 | ||
|
|
98c4161631 | ||
|
|
4bc34509fa | ||
|
|
f625bfdd15 | ||
|
|
93ffd44608 | ||
|
|
fcf1157fa4 | ||
|
|
488aee467a | ||
|
|
ba340cd07a | ||
|
|
1eb0eea744 | ||
|
|
25ea68e730 | ||
|
|
881245fa9d | ||
|
|
d7a6b3f914 | ||
|
|
f794810a5f | ||
|
|
758a42643a | ||
|
|
fdfa7b2793 | ||
|
|
a6b302f117 | ||
|
|
498cc8ab88 | ||
|
|
a032ac2f61 | ||
|
|
a72fe210ca | ||
|
|
573ce5a4de | ||
|
|
4dca799fbf | ||
|
|
f2ae3e8167 | ||
|
|
d0f2287d44 | ||
|
|
5533861c28 | ||
|
|
2bdb094f7b | ||
|
|
25a2e1da5a | ||
|
|
ea85e23516 | ||
|
|
c5fe4a8bf3 | ||
|
|
2e9fa86c76 | ||
|
|
e238b47b0a | ||
|
|
8cf752e577 | ||
|
|
2645b3e634 | ||
|
|
e5e0a1c857 | ||
|
|
b20f11c6a7 | ||
|
|
614cbb3e92 | ||
|
|
a0b58301ca | ||
|
|
9fb312ec32 | ||
|
|
c60c5d188e | ||
|
|
39bbb1c9e9 | ||
|
|
abe1057c41 | ||
|
|
32a9e3a225 | ||
|
|
e922bf901a | ||
|
|
66b2b90f43 | ||
|
|
a26f3d70dc | ||
|
|
2584075a94 | ||
|
|
68103c0ffb | ||
|
|
5d2ef1f925 | ||
|
|
1b773f682f | ||
|
|
bc54fa3e58 | ||
|
|
b3254d663b | ||
|
|
cf72b1a55d | ||
|
|
64fba64826 | ||
|
|
46345c0809 | ||
|
|
236d4cea25 | ||
|
|
cb978ff7be | ||
|
|
00ae321bf4 | ||
|
|
f3a4dad2c8 | ||
|
|
a2e4d07a4b | ||
|
|
fb4a5492da | ||
|
|
b3e4186cf2 | ||
|
|
45ef5b2ad6 | ||
|
|
cbe4354928 | ||
|
|
57b3409e2a | ||
|
|
322b68dbf4 | ||
|
|
c9d34cdecf | ||
|
|
67897d9c0d | ||
|
|
560e1d7e8a | ||
|
|
05c403f805 | ||
|
|
b7f7a772fb | ||
|
|
e9d7301b0a | ||
|
|
eb696dc385 | ||
|
|
f64d9d0e43 | ||
|
|
741e28309e | ||
|
|
7e315dafcf | ||
|
|
61be6bc238 | ||
|
|
cf7ececb83 | ||
|
|
c007b34cc1 | ||
|
|
224d547178 | ||
|
|
a29d966678 | ||
|
|
023c2b7dd9 | ||
|
|
dcb871a755 | ||
|
|
6f0a64d3a2 | ||
|
|
eb3114596c | ||
|
|
9f44640fa7 | ||
|
|
8ef0b0ff30 | ||
|
|
1c2a8d977c | ||
|
|
1797024a4e | ||
|
|
d75bca38f9 | ||
|
|
18523f7620 | ||
|
|
e399b79baa | ||
|
|
aac3c03f72 | ||
|
|
3b8cc374e7 | ||
|
|
8b274b92aa | ||
|
|
6b69130f36 | ||
|
|
c3f180eebb | ||
|
|
bf3c0e07d6 | ||
|
|
67eb2bbc32 | ||
|
|
cf19a76bf6 | ||
|
|
2a6a51c465 | ||
|
|
95db04a64c | ||
|
|
f26b55ea7e | ||
|
|
01c1bd13db | ||
|
|
8ec31ebbcc | ||
|
|
723a54f948 | ||
|
|
599aec4a23 | ||
|
|
9d66b48885 | ||
|
|
38c435e0c2 | ||
|
|
7b406bc70a | ||
|
|
89845bca03 | ||
|
|
78216e8d02 | ||
|
|
118c2c60d8 | ||
|
|
179ec8ad20 | ||
|
|
89f459c8a1 | ||
|
|
a34fe6ea8a | ||
|
|
6021182b64 | ||
|
|
e0a0eafef0 | ||
|
|
40f8fe2815 | ||
|
|
71cab42c9b | ||
|
|
2e149c4ced | ||
|
|
b701d70147 | ||
|
|
7963430481 | ||
|
|
ca36fd0110 | ||
|
|
4c4671a63f | ||
|
|
0db4fd57a7 | ||
|
|
f54f117885 | ||
|
|
21477ad68a | ||
|
|
dccbb4e518 | ||
|
|
45f74a1497 | ||
|
|
f10b2c0b33 | ||
|
|
1aa6413b32 | ||
|
|
d437ccb141 | ||
|
|
3070cf38f0 | ||
|
|
d2f9be56a5 | ||
|
|
317f97fe8e | ||
|
|
67c16277ee | ||
|
|
0066333685 | ||
|
|
6df29c32e4 | ||
|
|
f042f0dd5d | ||
|
|
391e1912de | ||
|
|
3c79358ff7 | ||
|
|
7d9caee481 | ||
|
|
c188d259d6 | ||
|
|
d332a19aa0 | ||
|
|
bfc0ddd0e0 | ||
|
|
13a1ed01fd | ||
|
|
4e8095062b | ||
|
|
fe6b110393 | ||
|
|
9633600fff | ||
|
|
2e24678204 | ||
|
|
a71d4eab36 | ||
|
|
885cde085a | ||
|
|
654d66d6a7 | ||
|
|
56b100a692 | ||
|
|
518504ff5c | ||
|
|
6351307ab4 | ||
|
|
0a848d686c | ||
|
|
595eab57de | ||
|
|
14f178e486 | ||
|
|
60035e31a2 | ||
|
|
3088075574 | ||
|
|
e76cd88470 | ||
|
|
5c0fe2154f | ||
|
|
76280e3b7e | ||
|
|
907ee56090 | ||
|
|
4ed18b1108 | ||
|
|
afc09709ad | ||
|
|
c1128af87e | ||
|
|
6325974a0b | ||
|
|
d1a68958a9 | ||
|
|
9d406d199f | ||
|
|
ecbeaed66c | ||
|
|
1601f2fd6f | ||
|
|
f98a1e2d32 | ||
|
|
cb3b649707 | ||
|
|
75c811cc35 | ||
|
|
d7fec82eaa | ||
|
|
6070d61076 | ||
|
|
96df860673 | ||
|
|
2eaed3573b | ||
|
|
b014aac438 | ||
|
|
1f0f85b59a | ||
|
|
b9603c178a | ||
|
|
780de8fd15 | ||
|
|
6575585b07 | ||
|
|
4df876c700 | ||
|
|
1f9172697c | ||
|
|
b65fa84ea5 | ||
|
|
4a38afe99b | ||
|
|
66b70b945b | ||
|
|
dc84dc08c0 | ||
|
|
4987cb525c | ||
|
|
165e6710e5 | ||
|
|
1e8551e1ce | ||
|
|
dd89196f9b | ||
|
|
8d71f58837 | ||
|
|
567e3933bc | ||
|
|
d57466c316 | ||
|
|
ba4ff40d9d | ||
|
|
1bd8583d3f | ||
|
|
8360afa15f | ||
|
|
da9ddfe2d1 | ||
|
|
d9e6fd3bac | ||
|
|
153fd4a7f6 | ||
|
|
66b24c3cb2 | ||
|
|
6ef058f9b0 | ||
|
|
6d77834955 | ||
|
|
233fb4466e | ||
|
|
e495a41bc1 | ||
|
|
1c49e9ac97 | ||
|
|
75bce22b30 | ||
|
|
4cc482e222 | ||
|
|
807a1c5b74 | ||
|
|
d9b715bbd7 | ||
|
|
b4b641807b | ||
|
|
271445fa4d | ||
|
|
22a622f8f5 | ||
|
|
816c6a513b | ||
|
|
7276cf7dd0 | ||
|
|
8f4957a0e0 | ||
|
|
5c4fbf10b1 | ||
|
|
cccba6e2c7 | ||
|
|
0a6ad89984 | ||
|
|
2adfe6bdba | ||
|
|
a29b2ad908 | ||
|
|
12e20eb5f4 | ||
|
|
339d94b643 | ||
|
|
52894339df | ||
|
|
3a754ae461 | ||
|
|
f12b7a8dd9 | ||
|
|
12c9c68dce | ||
|
|
8ccc01a2f6 | ||
|
|
fa3f1a60ec | ||
|
|
910bad74ea | ||
|
|
ef10cae6eb | ||
|
|
eca8b049ac | ||
|
|
35f3d4ecb1 | ||
|
|
109fbe2350 | ||
|
|
4c7edee5f3 | ||
|
|
e24f653871 | ||
|
|
3f598364c9 | ||
|
|
8e772c37b2 | ||
|
|
0a8c4943f5 | ||
|
|
ac59d6d96a | ||
|
|
1085e72135 | ||
|
|
8452c8cd5d | ||
|
|
3352f687cd | ||
|
|
4d10a37247 | ||
|
|
c79d732647 | ||
|
|
601355d9b0 | ||
|
|
0720e1a9a1 | ||
|
|
fa21f6e524 | ||
|
|
df9db1a0ee | ||
|
|
36c46a8f71 | ||
|
|
560f4aab03 | ||
|
|
bec7e7a552 | ||
|
|
553e2de09b | ||
|
|
e36a4b1bc5 | ||
|
|
8c8667d9f7 | ||
|
|
f13263d045 | ||
|
|
77f49a5510 | ||
|
|
8413dd946e | ||
|
|
18a7df3d5c | ||
|
|
9717ad2be8 | ||
|
|
efb19fd26a | ||
|
|
bc4770ea7d | ||
|
|
01792e928e | ||
|
|
11ecb5183b | ||
|
|
ad620622a5 | ||
|
|
5e9b6092d0 | ||
|
|
1e503c6430 | ||
|
|
5e1e389a15 | ||
|
|
8a3ef34194 | ||
|
|
e7939029f8 | ||
|
|
ac4534f3e0 | ||
|
|
dd8dcfb317 | ||
|
|
75565262f7 | ||
|
|
cd57530efd | ||
|
|
091050add6 | ||
|
|
42599b7044 | ||
|
|
ecd677ebbe | ||
|
|
367c2abbf3 | ||
|
|
6fb53c7c93 | ||
|
|
62228ae450 | ||
|
|
5dd34e6145 | ||
|
|
776643e6d7 | ||
|
|
50336bddbe | ||
|
|
e3d6aaf697 | ||
|
|
788cd9d6ee | ||
|
|
10880d861f | ||
|
|
147d47eee7 | ||
|
|
e56a5b72cb | ||
|
|
c6b987a816 | ||
|
|
e652a69a69 | ||
|
|
3668d64b47 | ||
|
|
6c7526f53b | ||
|
|
8c7781fb24 | ||
|
|
590facc3d8 | ||
|
|
03e53f14b0 | ||
|
|
4642bcb0bc | ||
|
|
698b9df9de | ||
|
|
ae83a2b706 | ||
|
|
6cf3327d8d | ||
|
|
62298b8bfc | ||
|
|
c12752d6fc | ||
|
|
0f90647174 | ||
|
|
d1df3df96a | ||
|
|
6b5f246343 | ||
|
|
b1c920bc8a | ||
|
|
6f1c044381 | ||
|
|
46df44f321 | ||
|
|
0000843c32 | ||
|
|
99eb762c24 | ||
|
|
18b9d266d5 | ||
|
|
53e29fb8b4 | ||
|
|
4f325d281b | ||
|
|
867dfc0563 | ||
|
|
e4ba18f3f2 | ||
|
|
27d8ffb0f3 | ||
|
|
c73dc79252 | ||
|
|
9d5b202720 | ||
|
|
831864df59 | ||
|
|
ecc77998fd | ||
|
|
130f5e4ad1 | ||
|
|
7a7487b094 | ||
|
|
0615e05e6d | ||
|
|
38fe29b9fd | ||
|
|
fcdfcbe82e | ||
|
|
67624a8ee0 | ||
|
|
3c2fe2fe5e | ||
|
|
51cc8aadd6 | ||
|
|
23f95e7cb7 | ||
|
|
5dcbb54e63 | ||
|
|
2bda842014 | ||
|
|
6003dcc291 | ||
|
|
423b4d8893 | ||
|
|
e8e24d3810 | ||
|
|
366e8c4477 | ||
|
|
eeefe9ac45 | ||
|
|
38c6664caf | ||
|
|
36ccd87840 | ||
|
|
8adc2929e8 | ||
|
|
a4f769e214 | ||
|
|
6888c78e1e | ||
|
|
67a4310b36 | ||
|
|
6f8d6c0df4 | ||
|
|
9de8eb6882 | ||
|
|
23077d5a2b | ||
|
|
003aebc9fe | ||
|
|
8e96826ca8 | ||
|
|
acfe235c37 | ||
|
|
9d4983eb00 | ||
|
|
c18b201463 | ||
|
|
7f41877b41 | ||
|
|
f07c72f8d7 | ||
|
|
27090c3ea7 | ||
|
|
48c0528720 | ||
|
|
1ec79bc23f | ||
|
|
b9c39a46b4 | ||
|
|
6d62769b03 | ||
|
|
e84f5ee7dc | ||
|
|
e7da8f089e | ||
|
|
f437de11a6 | ||
|
|
be7105336a | ||
|
|
28af5566b2 | ||
|
|
2bd83fd0cf | ||
|
|
fc3f9a1b96 | ||
|
|
0b41b77549 | ||
|
|
7b9969f8e4 | ||
|
|
bcd1ac7599 | ||
|
|
36785a154b | ||
|
|
5b0fd59e76 | ||
|
|
9a9df2478d | ||
|
|
1314b95ce7 | ||
|
|
43d228c5bc | ||
|
|
d11d56b0b3 | ||
|
|
8e447003fd | ||
|
|
a66bad688b | ||
|
|
f555a5c6a0 | ||
|
|
8bda8efb99 | ||
|
|
1d7e299c27 | ||
|
|
2480336ef3 |
+113
-61
@@ -45,6 +45,11 @@ UB_ON_WINDOWS=@UB_ON_WINDOWS@
|
||||
WITH_PYTHONMODULE=@WITH_PYTHONMODULE@
|
||||
WITH_PYUNBOUND=@WITH_PYUNBOUND@
|
||||
PYTHON_SITE_PKG=@PYTHON_SITE_PKG@
|
||||
EXPORT_ALL_SYMBOLS=@EXPORT_ALL_SYMBOLS@
|
||||
|
||||
# override $U variable which is used by autotools for deansification (for
|
||||
# K&R C compilers), but causes problems if $U is defined in the env).
|
||||
U=
|
||||
|
||||
SWIG=@SWIG@
|
||||
YACC=@YACC@
|
||||
@@ -71,9 +76,18 @@ BUILD=build/
|
||||
|
||||
WINDRES=@WINDRES@
|
||||
LINT=splint
|
||||
LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list -Dglob64=glob -Dglobfree64=globfree
|
||||
LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list
|
||||
#-Dglob64=glob -Dglobfree64=globfree
|
||||
# compat with openssl linux edition.
|
||||
LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray
|
||||
LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned"
|
||||
# compat with NetBSD
|
||||
ifeq "$(shell uname)" "NetBSD"
|
||||
LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_
|
||||
endif
|
||||
# compat with OpenBSD
|
||||
LINTFLAGS+="-Dsigset_t=long"
|
||||
# FreeBSD8
|
||||
LINTFLAGS+="-D__uint16_t=uint16_t"
|
||||
|
||||
INSTALL=$(srcdir)/install-sh
|
||||
ifeq "$(WITH_PYTHONMODULE)" "yes"
|
||||
@@ -93,15 +107,29 @@ UNITTEST_SRC=$(patsubst $(srcdir)/%,%, \
|
||||
testcode/readhex.c testcode/ldns-testpkts.c smallapp/worker_cb.c \
|
||||
$(COMMON_SRC)
|
||||
UNITTEST_OBJ=$(addprefix $(BUILD),$(UNITTEST_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
DAEMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/daemon/*.c)) \
|
||||
$(COMMON_SRC)
|
||||
|
||||
DAEMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/daemon/*.c))
|
||||
ifneq "$(EXPORT_ALL_SYMBOLS)" "yes"
|
||||
DAEMON_SRC+=$(COMMON_SRC)
|
||||
endif
|
||||
DAEMON_OBJ=$(addprefix $(BUILD),$(DAEMON_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
CHECKCONF_SRC=smallapp/unbound-checkconf.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
|
||||
CHECKCONF_SRC=smallapp/unbound-checkconf.c smallapp/worker_cb.c
|
||||
ifneq "$(EXPORT_ALL_SYMBOLS)" "yes"
|
||||
CHECKCONF_SRC+=$(COMMON_SRC)
|
||||
endif
|
||||
CHECKCONF_OBJ=$(addprefix $(BUILD),$(CHECKCONF_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
CONTROL_SRC=smallapp/unbound-control.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
|
||||
CONTROL_SRC=smallapp/unbound-control.c smallapp/worker_cb.c
|
||||
ifneq "$(EXPORT_ALL_SYMBOLS)" "yes"
|
||||
CONTROL_SRC+=$(COMMON_SRC)
|
||||
endif
|
||||
CONTROL_OBJ=$(addprefix $(BUILD),$(CONTROL_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
|
||||
HOST_SRC=smallapp/unbound-host.c
|
||||
HOST_OBJ=$(addprefix $(BUILD),$(HOST_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
HOST_OBJ=$(addprefix $(BUILD),$(HOST_SRC:.c=.lo)) $(filter-out $(BUILD)compat/ctime_r.lo, $(COMPAT_OBJ))
|
||||
UBANCHOR_SRC=smallapp/unbound-anchor.c
|
||||
UBANCHOR_OBJ=$(addprefix $(BUILD),$(UBANCHOR_SRC:.c=.lo)) $(filter-out $(BUILD)compat/ctime_r.lo, $(COMPAT_OBJ))
|
||||
TESTBOUND_SRC=testcode/testbound.c testcode/ldns-testpkts.c \
|
||||
daemon/worker.c daemon/acl_list.c daemon/daemon.c daemon/stats.c \
|
||||
testcode/replay.c testcode/fake_event.c $(filter-out util/netevent.c \
|
||||
@@ -109,6 +137,8 @@ TESTBOUND_SRC=testcode/testbound.c testcode/ldns-testpkts.c \
|
||||
TESTBOUND_OBJ=$(addprefix $(BUILD),$(TESTBOUND_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
LOCKVERIFY_SRC=testcode/lock_verify.c smallapp/worker_cb.c $(COMMON_SRC)
|
||||
LOCKVERIFY_OBJ=$(addprefix $(BUILD),$(LOCKVERIFY_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
PETAL_SRC=testcode/petal.c
|
||||
PETAL_OBJ=$(addprefix $(BUILD),$(PETAL_SRC:.c=.lo)) $(filter-out $(BUILD)compat/ctime_r.lo, $(COMPAT_OBJ))
|
||||
PKTVIEW_SRC=testcode/pktview.c testcode/readhex.c smallapp/worker_cb.c \
|
||||
$(COMMON_SRC)
|
||||
PKTVIEW_OBJ=$(addprefix $(BUILD),$(PKTVIEW_SRC:.c=.lo)) $(COMPAT_OBJ)
|
||||
@@ -133,7 +163,7 @@ ALL_SRC=$(sort $(COMMON_SRC) $(UNITTEST_SRC) $(DAEMON_SRC) \
|
||||
$(TESTBOUND_SRC) $(LOCKVERIFY_SRC) $(PKTVIEW_SRC) $(SIGNIT_SRC) \
|
||||
$(MEMSTATS_SRC) $(CHECKCONF_SRC) $(LIBUNBOUND_SRC) $(HOST_SRC) \
|
||||
$(ASYNCLOOK_SRC) $(STREAMTCP_SRC) $(PERF_SRC) $(DELAYER_SRC) \
|
||||
$(HARVEST_SRC) $(CONTROL_SRC))
|
||||
$(HARVEST_SRC) $(CONTROL_SRC) $(UBANCHOR_SRC) $(PETAL_SRC))
|
||||
ALL_OBJ=$(addprefix $(BUILD),$(ALL_SRC:.c=.lo) \
|
||||
$(addprefix compat/,$(LIBOBJS:.o=.lo))) $(COMPAT_OBJ)
|
||||
|
||||
@@ -141,6 +171,7 @@ ifeq "$(UB_ON_WINDOWS)" "yes"
|
||||
DAEMON_SRC+=winrc/win_svc.c winrc/w_inst.c
|
||||
DAEMON_OBJ+=$(BUILD)winrc/rsrc_unbound.o $(BUILD)winrc/win_svc.lo
|
||||
HOST_OBJ+=$(BUILD)winrc/rsrc_unbound_host.o
|
||||
UBANCHOR_OBJ+=$(BUILD)winrc/rsrc_unbound_anchor.o
|
||||
CONTROL_OBJ+=$(BUILD)winrc/rsrc_unbound_control.o
|
||||
CHECKCONF_OBJ+=$(BUILD)winrc/rsrc_unbound_checkconf.o
|
||||
|
||||
@@ -161,8 +192,6 @@ ifeq "$(UB_ON_WINDOWS)" "yes"
|
||||
|
||||
$(BUILD)%.o: $(srcdir)/%.rc $(srcdir)/config.h
|
||||
$(INFO) Resource $<
|
||||
@if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
|
||||
then (cd $(ldnsdir); $(MAKE) copy-headers); fi
|
||||
@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
|
||||
$Q$(WINDRES) $(CPPFLAGS) $< $@
|
||||
endif
|
||||
@@ -171,56 +200,81 @@ COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK=$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(staticexe) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS))
|
||||
LINK_LIB=$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS) $(staticexe) -version-number @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined)
|
||||
|
||||
.PHONY: clean realclean doc lint all install uninstall tests test download_ldns strip lib
|
||||
.PHONY: clean realclean doc lint all install uninstall tests test strip lib longtest longcheck check
|
||||
|
||||
$(BUILD)%.lo: $(srcdir)/%.c
|
||||
$(INFO) Build $<
|
||||
@if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
|
||||
then (cd $(ldnsdir); $(MAKE) copy-headers); fi
|
||||
@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
|
||||
$Q$(COMPILE) -o $@ -c $<
|
||||
|
||||
all: $(COMMON_OBJ) unbound$(EXEEXT) unbound-checkconf$(EXEEXT) lib unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-control-setup $(WINAPPS)
|
||||
all: $(COMMON_OBJ) unbound$(EXEEXT) unbound-checkconf$(EXEEXT) lib unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup $(WINAPPS)
|
||||
|
||||
TEST_BIN=$(addsuffix $(EXEEXT),asynclook delayer harvest lock-verify \
|
||||
memstats perf pktview signit streamtcp testbound unittest)
|
||||
memstats perf petal pktview signit streamtcp testbound unittest)
|
||||
tests: all $(TEST_BIN)
|
||||
|
||||
test: tests
|
||||
check: test
|
||||
longcheck: longtest
|
||||
|
||||
test: unittest$(EXEEXT) testbound$(EXEEXT)
|
||||
./unittest$(EXEEXT)
|
||||
./testbound$(EXEEXT) -s
|
||||
for x in testdata/*.rpl; do echo -n "$$x "; if ./testbound$(EXEEXT) -p $$x >/dev/null 2>&1; then echo OK; else echo failed; exit 1; fi done
|
||||
@echo test OK
|
||||
|
||||
longtest: tests
|
||||
if test -x "`which bash`"; then bash testcode/do-tests.sh; else sh testcode/do-tests.sh; fi
|
||||
|
||||
lib: libunbound.la
|
||||
|
||||
ifeq ($(patsubst ldns-src%,ldns-src,$(ldnsdir)),ldns-src)
|
||||
ldnslib=$(ldnsdir)/lib/libldns.a
|
||||
$(ldnslib): $(ldnsdir)/lib
|
||||
$(ldnsdir)/lib:
|
||||
@if test ! -z "$(ldnsdir)"; \
|
||||
then (cd $(ldnsdir) && $(MAKE)); fi
|
||||
else
|
||||
ldnslib=
|
||||
UBSYMS+=-export-symbols $(srcdir)/libunbound/ubsyms.def
|
||||
CLUBSYMS=-export-symbols $(BUILD)clubsyms.def
|
||||
EXTRALINK=
|
||||
ifeq "$(EXPORT_ALL_SYMBOLS)" "yes"
|
||||
UBSYMS=
|
||||
CLUBSYMS=
|
||||
EXTRALINK=-L. -L.libs -lunbound
|
||||
endif
|
||||
|
||||
libunbound.la: $(LIBUNBOUND_OBJ) $(ldnslib)
|
||||
libunbound.la: $(LIBUNBOUND_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK_LIB) -export-symbols $(srcdir)/libunbound/ubsyms.def -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)
|
||||
ifeq ($(CHECKLOCK_SRC),)
|
||||
$Q$(LINK_LIB) $(UBSYMS) -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)
|
||||
else
|
||||
cp $(srcdir)/libunbound/ubsyms.def $(BUILD)clubsyms.def
|
||||
echo lock_protect >> $(BUILD)clubsyms.def
|
||||
echo lock_unprotect >> $(BUILD)clubsyms.def
|
||||
echo lock_get_mem >> $(BUILD)clubsyms.def
|
||||
echo checklock_start >> $(BUILD)clubsyms.def
|
||||
echo checklock_stop >> $(BUILD)clubsyms.def
|
||||
echo checklock_lock >> $(BUILD)clubsyms.def
|
||||
echo checklock_unlock >> $(BUILD)clubsyms.def
|
||||
echo checklock_init >> $(BUILD)clubsyms.def
|
||||
echo checklock_thrcreate >> $(BUILD)clubsyms.def
|
||||
echo checklock_thrjoin >> $(BUILD)clubsyms.def
|
||||
$Q$(LINK_LIB) $(CLUBSYMS) -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)
|
||||
endif
|
||||
|
||||
unbound$(EXEEXT): $(DAEMON_OBJ) $(ldnslib)
|
||||
unbound$(EXEEXT): $(DAEMON_OBJ) libunbound.la
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(DAEMON_OBJ)) -lssl $(LIBS)
|
||||
$Q$(LINK) -o $@ $(sort $(DAEMON_OBJ)) $(EXTRALINK) -lssl $(LIBS)
|
||||
|
||||
unbound-checkconf$(EXEEXT): $(CHECKCONF_OBJ) $(ldnslib)
|
||||
unbound-checkconf$(EXEEXT): $(CHECKCONF_OBJ) libunbound.la
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(CHECKCONF_OBJ)) $(LIBS)
|
||||
$Q$(LINK) -o $@ $(sort $(CHECKCONF_OBJ)) $(EXTRALINK) -lssl $(LIBS)
|
||||
|
||||
unbound-control$(EXEEXT): $(CONTROL_OBJ) $(ldnslib)
|
||||
unbound-control$(EXEEXT): $(CONTROL_OBJ) libunbound.la
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(CONTROL_OBJ)) -lssl $(LIBS)
|
||||
$Q$(LINK) -o $@ $(sort $(CONTROL_OBJ)) $(EXTRALINK) -lssl $(LIBS)
|
||||
|
||||
unbound-host$(EXEEXT): $(HOST_OBJ) libunbound.la $(ldnslib)
|
||||
unbound-host$(EXEEXT): $(HOST_OBJ) libunbound.la
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(HOST_OBJ)) -L. -L.libs -lunbound $(LIBS)
|
||||
|
||||
unbound-anchor$(EXEEXT): $(UBANCHOR_OBJ) libunbound.la
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(UBANCHOR_OBJ)) -L. -L.libs -lunbound -lexpat -lssl $(LIBS)
|
||||
|
||||
unbound-service-install$(EXEEXT): $(SVCINST_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(SVCINST_OBJ)) $(LIBS)
|
||||
@@ -229,51 +283,55 @@ unbound-service-remove$(EXEEXT): $(SVCUNINST_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(SVCUNINST_OBJ)) $(LIBS)
|
||||
|
||||
anchor-update$(EXEEXT): $(ANCHORUPD_OBJ) libunbound.la $(ldnslib)
|
||||
anchor-update$(EXEEXT): $(ANCHORUPD_OBJ) libunbound.la
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(ANCHORUPD_OBJ)) -L. -L.libs -lunbound $(LIBS)
|
||||
|
||||
unittest$(EXEEXT): $(UNITTEST_OBJ) $(ldnslib)
|
||||
unittest$(EXEEXT): $(UNITTEST_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(UNITTEST_OBJ)) $(LIBS)
|
||||
|
||||
testbound$(EXEEXT): $(TESTBOUND_OBJ) $(ldnslib)
|
||||
testbound$(EXEEXT): $(TESTBOUND_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(TESTBOUND_OBJ)) -lssl $(LIBS)
|
||||
|
||||
lock-verify$(EXEEXT): $(LOCKVERIFY_OBJ) $(ldnslib)
|
||||
lock-verify$(EXEEXT): $(LOCKVERIFY_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(LOCKVERIFY_OBJ)) $(LIBS)
|
||||
|
||||
pktview$(EXEEXT): $(PKTVIEW_OBJ) $(ldnslib)
|
||||
petal$(EXEEXT): $(PETAL_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(PETAL_OBJ)) -lssl $(LIBS)
|
||||
|
||||
pktview$(EXEEXT): $(PKTVIEW_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(PKTVIEW_OBJ)) $(LIBS)
|
||||
|
||||
signit$(EXEEXT): $(SIGNIT_OBJ) $(ldnslib)
|
||||
signit$(EXEEXT): $(SIGNIT_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(SIGNIT_OBJ)) $(LIBS)
|
||||
|
||||
memstats$(EXEEXT): $(MEMSTATS_OBJ) $(ldnslib)
|
||||
memstats$(EXEEXT): $(MEMSTATS_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(MEMSTATS_OBJ)) $(LIBS)
|
||||
|
||||
asynclook$(EXEEXT): $(ASYNCLOOK_OBJ) $(ldnslib) libunbound.la
|
||||
asynclook$(EXEEXT): $(ASYNCLOOK_OBJ) libunbound.la
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(ASYNCLOOK_OBJ)) $(LIBS) -L. -L.libs -lunbound
|
||||
|
||||
streamtcp$(EXEEXT): $(STREAMTCP_OBJ) $(ldnslib)
|
||||
streamtcp$(EXEEXT): $(STREAMTCP_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(STREAMTCP_OBJ)) $(LIBS)
|
||||
|
||||
perf$(EXEEXT): $(PERF_OBJ) $(ldnslib)
|
||||
perf$(EXEEXT): $(PERF_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(PERF_OBJ)) $(LIBS)
|
||||
|
||||
delayer$(EXEEXT): $(DELAYER_OBJ) $(ldnslib)
|
||||
delayer$(EXEEXT): $(DELAYER_OBJ)
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(DELAYER_OBJ)) $(LIBS)
|
||||
|
||||
harvest$(EXEEXT): $(HARVEST_OBJ) $(ldnslib) libunbound.la
|
||||
harvest$(EXEEXT): $(HARVEST_OBJ) libunbound.la
|
||||
$(INFO) Link $@
|
||||
$Q$(LINK) -o $@ $(sort $(HARVEST_OBJ)) $(LIBS) -L. -L.libs -lunbound
|
||||
|
||||
@@ -326,7 +384,7 @@ util/configparser.c util/configparser.h: $(srcdir)/util/configparser.y
|
||||
|
||||
clean:
|
||||
rm -f *.o *.d *.lo *~ tags
|
||||
rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-control-setup libunbound.la
|
||||
rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup libunbound.la
|
||||
rm -rf autom4te.cache .libs build doc/html doc/xml
|
||||
|
||||
realclean: clean
|
||||
@@ -334,7 +392,6 @@ realclean: clean
|
||||
rm -f configure config.sub config.guess ltmain.sh aclocal.m4 libtool
|
||||
rm -f util/configlexer.c util/configparser.c util/configparser.h
|
||||
rm -f $(TEST_BIN)
|
||||
if test -d ldns-src; then rm -rf ldns-src; fi
|
||||
rm -f Makefile
|
||||
|
||||
$(BUILD)%.lint: $(srcdir)/%.c
|
||||
@@ -363,8 +420,9 @@ strip:
|
||||
$(STRIP) unbound-checkconf$(EXEEXT)
|
||||
$(STRIP) unbound-control$(EXEEXT)
|
||||
$(STRIP) unbound-host$(EXEEXT)
|
||||
$(STRIP) unbound-anchor$(EXEEXT)
|
||||
|
||||
install:
|
||||
install: all
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(sbindir)
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8
|
||||
@@ -377,6 +435,7 @@ install:
|
||||
$(LIBTOOL) --mode=install cp unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT)
|
||||
$(LIBTOOL) --mode=install cp unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT)
|
||||
$(LIBTOOL) --mode=install cp unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT)
|
||||
$(LIBTOOL) --mode=install cp unbound-anchor$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-anchor$(EXEEXT)
|
||||
ifeq "$(WITH_PYTHONMODULE)" "yes"
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
|
||||
$(INSTALL) -c -m 644 pythonmod/unboundmodule.py $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
|
||||
@@ -385,10 +444,12 @@ ifeq "$(WITH_PYUNBOUND)" "yes"
|
||||
$(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
|
||||
$(INSTALL) -c -m 644 libunbound/python/unbound.py $(DESTDIR)$(PYTHON_SITE_PKG)/unbound.py
|
||||
$(LIBTOOL) --mode=install cp _unbound.la $(DESTDIR)$(PYTHON_SITE_PKG)
|
||||
$(LIBTOOL) --mode=finish $(DESTDIR)$(PYTHON_SITE_PKG)
|
||||
endif
|
||||
$(INSTALL) -c -m 644 doc/unbound.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound-anchor.8 $(DESTDIR)$(mandir)/man8
|
||||
$(INSTALL) -c -m 644 doc/unbound.conf.5 $(DESTDIR)$(mandir)/man5
|
||||
$(INSTALL) -c -m 644 $(srcdir)/doc/unbound-host.1 $(DESTDIR)$(mandir)/man1
|
||||
$(INSTALL) -c -m 644 doc/libunbound.3 $(DESTDIR)$(mandir)/man3
|
||||
@@ -399,8 +460,8 @@ endif
|
||||
$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
|
||||
|
||||
uninstall:
|
||||
rm -f -- $(DESTDIR)$(sbindir)/unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control-setup
|
||||
rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8
|
||||
rm -f -- $(DESTDIR)$(sbindir)/unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-anchor$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control-setup
|
||||
rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-anchor.8
|
||||
rm -f -- $(DESTDIR)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3
|
||||
rm -f -- $(DESTDIR)$(includedir)/unbound.h
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libunbound.la
|
||||
@@ -414,23 +475,14 @@ endif
|
||||
@echo
|
||||
@echo "You still need to remove "`dirname $(DESTDIR)$(configfile)`" , $(DESTDIR)$(configfile) by hand"
|
||||
|
||||
download_ldns:
|
||||
svn export https://www.nlnetlabs.nl/svn/ldns/trunk/makedist.sh ldns_makedist.sh
|
||||
./ldns_makedist.sh -s -d https://www.nlnetlabs.nl/svn/ldns/trunk
|
||||
mv ldns-[0-9]*.tar.gz ldns-src.tar.gz
|
||||
rm ldns-*.tar.gz.sha1 ldns_makedist.sh
|
||||
|
||||
iana_update:
|
||||
curl -o port-numbers.tmp http://www.iana.org/assignments/port-numbers
|
||||
awk '/Unassigned|Reserved/ {next;} { match($$0, "[0-9]+/udp"); if (RLENGTH > 0) print substr($$0, RSTART, RLENGTH - 4) ","}' port-numbers.tmp | sort -nu > portslist.tmp
|
||||
cat portslist.tmp > util/iana_ports.inc
|
||||
curl -o port-numbers.tmp http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml
|
||||
awk '/<record>/ {p=0;} /<protocol>udp/ {p=1;} /<protocol>[^u]/ {p=0;} /Decomissioned|Decommissioned|Removed|De-registered|unassigned|Unassigned|Reserved/ {u=1;} /<number>/ { if(u==1) {u=0;} else { if(p==1) { match($$0,/[0-9]+/); print substr($$0, RSTART, RLENGTH) ","}}}' port-numbers.tmp | sort -nu > util/iana_ports.inc
|
||||
rm -f port-numbers.tmp portslist.tmp
|
||||
|
||||
# Automatic dependencies.
|
||||
$(BUILD)%.d: $(srcdir)/%.c
|
||||
$(INFO) Depend $<
|
||||
@if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
|
||||
then (cd $(ldnsdir); $(MAKE) copy-headers); fi
|
||||
@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
|
||||
$Q$(SHELL) -ec '$(CC) $(DEPFLAG) $(CPPFLAGS) $(CFLAGS) $< | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.lo $@ : !g'\'' > $@; [ -s $@ ] || rm -f $@'
|
||||
|
||||
|
||||
Vendored
+563
-475
File diff suppressed because it is too large
Load Diff
+143
-21
@@ -2,8 +2,17 @@
|
||||
# Copyright 2009, Wouter Wijngaards, NLnet Labs.
|
||||
# BSD licensed.
|
||||
#
|
||||
# Version 4
|
||||
# Changelog
|
||||
# Version 14
|
||||
# 2011-08-01 Fix nonblock test (broken at v13).
|
||||
# 2011-08-01 Fix autoconf 2.68 warnings
|
||||
# 2011-06-23 Add ACX_CHECK_FLTO to check -flto.
|
||||
# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66.
|
||||
# 2010-07-02 Add check for ss_family (for minix).
|
||||
# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS.
|
||||
# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end.
|
||||
# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl
|
||||
# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN
|
||||
# 2010-01-20 added AHX_COONFIG_STRLCAT
|
||||
# 2009-07-14 U_CHAR detection improved for windows crosscompile.
|
||||
# added ACX_FUNC_MALLOC
|
||||
# fixup some #if to #ifdef
|
||||
@@ -26,6 +35,7 @@
|
||||
# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX.
|
||||
# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax.
|
||||
# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax.
|
||||
# ACX_CHECK_FLTO - see if cc supports -flto and use it if so.
|
||||
# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved.
|
||||
# ACX_TYPE_U_CHAR - u_char type.
|
||||
# ACX_TYPE_RLIM_T - rlim_t type.
|
||||
@@ -55,6 +65,7 @@
|
||||
# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype
|
||||
# AHX_CONFIG_INET_ATON - inet_aton compat prototype
|
||||
# AHX_CONFIG_MEMMOVE - memmove compat prototype
|
||||
# AHX_CONFIG_STRLCAT - strlcat compat prototype
|
||||
# AHX_CONFIG_STRLCPY - strlcpy compat prototype
|
||||
# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype
|
||||
# AHX_CONFIG_W32_SLEEP - w32 compat for sleep
|
||||
@@ -67,6 +78,9 @@
|
||||
# AHX_CONFIG_FLAG_OMITTED - define omitted flag
|
||||
# AHX_CONFIG_FLAG_EXT - define omitted extension flag
|
||||
# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags
|
||||
# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters.
|
||||
# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED.
|
||||
# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family
|
||||
#
|
||||
|
||||
dnl Escape backslashes as \\, for C:\ paths, for the C preprocessor defines.
|
||||
@@ -96,7 +110,7 @@ cache=`echo $1 | sed 'y%.=/+-%___p_%'`
|
||||
AC_CACHE_VAL(cv_prog_cc_flag_$cache,
|
||||
[
|
||||
echo 'void f(){}' >conftest.c
|
||||
if test -z "`$CC -$1 -c conftest.c 2>&1`"; then
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS -$1 -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_$cache=yes"
|
||||
else
|
||||
eval "cv_prog_cc_flag_$cache=no"
|
||||
@@ -140,18 +154,18 @@ AC_CACHE_VAL(cv_prog_cc_flag_needed_$cache,
|
||||
[
|
||||
echo '$2' > conftest.c
|
||||
echo 'void f(){}' >>conftest.c
|
||||
if test -z "`$CC $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_needed_$cache=no"
|
||||
else
|
||||
[
|
||||
if test -z "`$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`"; then
|
||||
if test -z "`$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`"; then
|
||||
eval "cv_prog_cc_flag_needed_$cache=yes"
|
||||
else
|
||||
eval "cv_prog_cc_flag_needed_$cache=fail"
|
||||
#echo 'Test with flag fails too!'
|
||||
#cat conftest.c
|
||||
#echo "$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
|
||||
#echo `$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
|
||||
#echo "$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
|
||||
#echo `$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
|
||||
#exit 1
|
||||
fi
|
||||
]
|
||||
@@ -167,8 +181,8 @@ if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then
|
||||
AC_MSG_RESULT(no)
|
||||
#echo 'Test with flag is no!'
|
||||
#cat conftest.c
|
||||
#echo "$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
|
||||
#echo `$CC $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
|
||||
#echo "$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1"
|
||||
#echo `$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`
|
||||
#exit 1
|
||||
:
|
||||
$4
|
||||
@@ -373,6 +387,16 @@ int test() {
|
||||
|
||||
])dnl End of ACX_DETERMINE_EXT_FLAGS_UNBOUND
|
||||
|
||||
dnl Check if CC supports -flto.
|
||||
dnl in a way that supports clang and suncc (that flag does something else,
|
||||
dnl but fails to link). It sets it in CFLAGS if it works.
|
||||
AC_DEFUN([ACX_CHECK_FLTO],
|
||||
[AC_MSG_CHECKING([if $CC supports -flto])
|
||||
BAKCFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -flto"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [AC_MSG_RESULT(yes)], [CFLAGS="$BAKCFLAGS" ; AC_MSG_RESULT(no)])
|
||||
])
|
||||
|
||||
dnl Check the printf-format attribute (if any)
|
||||
dnl result in HAVE_ATTR_FORMAT.
|
||||
dnl Make sure you also include the AHX_CONFIG_FORMAT_ATTRIBUTE.
|
||||
@@ -551,12 +575,14 @@ AC_ARG_ENABLE(rpath,
|
||||
[ --disable-rpath disable hardcoded rpath (default=enabled)],
|
||||
enable_rpath=$enableval, enable_rpath=yes)
|
||||
if test "x$enable_rpath" = xno; then
|
||||
AC_MSG_RESULT([Fixing libtool for -rpath problems.])
|
||||
dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.])
|
||||
AC_CONFIG_COMMANDS([disable-rpath], [
|
||||
sed < libtool > libtool-2 \
|
||||
's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/'
|
||||
mv libtool-2 libtool
|
||||
chmod 755 libtool
|
||||
libtool="./libtool"
|
||||
])
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -589,6 +615,7 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
||||
dnl assume /usr/include is already in the include-path.
|
||||
if test "$ssldir" != "/usr"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$ssldir/include"
|
||||
LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include"
|
||||
fi
|
||||
break;
|
||||
fi
|
||||
@@ -601,11 +628,13 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
||||
dnl assume /usr is already in the lib and dynlib paths.
|
||||
if test "$ssldir" != "/usr" -a "$ssldir" != ""; then
|
||||
LDFLAGS="$LDFLAGS -L$ssldir/lib"
|
||||
LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib"
|
||||
ACX_RUNTIME_PATH_ADD([$ssldir/lib])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto])
|
||||
LIBS="$LIBS -lcrypto"
|
||||
LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto"
|
||||
AC_TRY_LINK(, [
|
||||
int HMAC_CTX_init(void);
|
||||
(void)HMAC_CTX_init();
|
||||
@@ -617,7 +646,9 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
||||
AC_MSG_RESULT(no)
|
||||
# check if -lwsock32 or -lgdi32 are needed.
|
||||
BAKLIBS="$LIBS"
|
||||
BAKSSLLIBS="$LIBSSL_LIBS"
|
||||
LIBS="$LIBS -lgdi32"
|
||||
LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32"
|
||||
AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
|
||||
AC_TRY_LINK([], [
|
||||
int HMAC_CTX_init(void);
|
||||
@@ -629,7 +660,9 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
LIBS="$BAKLIBS"
|
||||
LIBSSL_LIBS="$BAKSSLLIBS"
|
||||
LIBS="$LIBS -ldl"
|
||||
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
|
||||
AC_MSG_CHECKING([if -lcrypto needs -ldl])
|
||||
AC_TRY_LINK([], [
|
||||
int HMAC_CTX_init(void);
|
||||
@@ -647,6 +680,12 @@ AC_DEFUN([ACX_SSL_CHECKS], [
|
||||
fi
|
||||
AC_SUBST(HAVE_SSL)
|
||||
AC_SUBST(RUNTIME_PATH)
|
||||
# openssl engine functionality needs dlopen().
|
||||
BAKLIBS="$LIBS"
|
||||
AC_SEARCH_LIBS([dlopen], [dl])
|
||||
if test "$LIBS" != "$BAKLIBS"; then
|
||||
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
|
||||
fi
|
||||
fi
|
||||
AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT])
|
||||
@@ -729,7 +768,7 @@ AC_DEFUN([ACX_CHECK_GETADDRINFO_WITH_INCLUDES],
|
||||
AC_MSG_CHECKING(for getaddrinfo)
|
||||
ac_cv_func_getaddrinfo=no
|
||||
AC_LINK_IFELSE(
|
||||
[
|
||||
[AC_LANG_SOURCE([[
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
@@ -743,14 +782,14 @@ int main() {
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
],
|
||||
]])],
|
||||
dnl this case on linux, solaris, bsd
|
||||
[ac_cv_func_getaddrinfo="yes"],
|
||||
dnl no quick getaddrinfo, try mingw32 and winsock2 library.
|
||||
ORIGLIBS="$LIBS"
|
||||
LIBS="$LIBS -lws2_32"
|
||||
AC_LINK_IFELSE(
|
||||
AC_LANG_PROGRAM(
|
||||
[AC_LANG_PROGRAM(
|
||||
[
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
@@ -759,7 +798,7 @@ AC_LANG_PROGRAM(
|
||||
[
|
||||
(void)getaddrinfo(NULL, NULL, NULL, NULL);
|
||||
]
|
||||
),
|
||||
)],
|
||||
[
|
||||
ac_cv_func_getaddrinfo="yes"
|
||||
dnl already: LIBS="$LIBS -lws2_32"
|
||||
@@ -823,7 +862,8 @@ if echo $target | grep mingw32 >/dev/null; then
|
||||
AC_MSG_RESULT([no (windows)])
|
||||
AC_DEFINE([NONBLOCKING_IS_BROKEN], 1, [Define if the network stack does not fully support nonblocking io (causes lower performance).])
|
||||
else
|
||||
AC_RUN_IFELSE(AC_LANG_PROGRAM([
|
||||
AC_RUN_IFELSE([
|
||||
AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -847,7 +887,9 @@ AC_RUN_IFELSE(AC_LANG_PROGRAM([
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
],[[
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int port;
|
||||
int sfd, cfd;
|
||||
int num = 10;
|
||||
@@ -940,7 +982,9 @@ AC_RUN_IFELSE(AC_LANG_PROGRAM([
|
||||
|
||||
close(sfd);
|
||||
close(cfd);
|
||||
]]), [
|
||||
return 0;
|
||||
}
|
||||
]])], [
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
@@ -980,13 +1024,13 @@ AC_DEFUN([ACX_FUNC_IOCTLSOCKET],
|
||||
[
|
||||
# check ioctlsocket
|
||||
AC_MSG_CHECKING(for ioctlsocket)
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM([
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
], [
|
||||
(void)ioctlsocket(0, 0, NULL);
|
||||
]), [
|
||||
])], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available])
|
||||
],[AC_MSG_RESULT(no)])
|
||||
@@ -1088,6 +1132,16 @@ void *memmove(void *dest, const void *src, size_t n);
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl provide strlcat compat prototype.
|
||||
dnl $1: unique name for compat code
|
||||
AC_DEFUN([AHX_CONFIG_STRLCAT],
|
||||
[
|
||||
#ifndef HAVE_STRLCAT
|
||||
#define strlcat strlcat_$1
|
||||
size_t strlcat(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl provide strlcpy compat prototype.
|
||||
dnl $1: unique name for compat code
|
||||
AC_DEFUN([AHX_CONFIG_STRLCPY],
|
||||
@@ -1158,7 +1212,7 @@ AC_DEFUN([ACX_CFLAGS_STRIP],
|
||||
[
|
||||
if echo $CFLAGS | grep " $1" >/dev/null 2>&1; then
|
||||
CFLAGS="`echo $CFLAGS | sed -e 's/ $1//g'`"
|
||||
AC_DEFINE(AS_TR_CPP(OMITTED_$1), 1, Put $1 define in config.h)
|
||||
AC_DEFINE(m4_bpatsubst(OMITTED_$1,[[-=]],_), 1, Put $1 define in config.h)
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1189,7 +1243,7 @@ AC_DEFUN([AHX_CONFIG_FLAG_OMITTED],
|
||||
dnl Wrapper for AHX_CONFIG_FLAG_OMITTED for -D style flags
|
||||
dnl $1: the -DNAME or -DNAME=value string.
|
||||
AC_DEFUN([AHX_CONFIG_FLAG_EXT],
|
||||
[AHX_CONFIG_FLAG_OMITTED(AS_TR_CPP(OMITTED_$1),m4_bpatsubst(m4_bpatsubst($1,-D,),=.*$,),m4_if(m4_bregexp($1,=),-1,1,m4_bpatsubst($1,^.*=,)))
|
||||
[AHX_CONFIG_FLAG_OMITTED(m4_bpatsubst(OMITTED_$1,[[-=]],_),m4_bpatsubst(m4_bpatsubst($1,-D,),=.*$,),m4_if(m4_bregexp($1,=),-1,1,m4_bpatsubst($1,^.*=,)))
|
||||
])
|
||||
|
||||
dnl config.h part to define omitted cflags, use with ACX_STRIP_EXT_FLAGS.
|
||||
@@ -1204,4 +1258,72 @@ AHX_CONFIG_FLAG_EXT(-D_ALL_SOURCE)
|
||||
AHX_CONFIG_FLAG_EXT(-D_LARGEFILE_SOURCE=1)
|
||||
])
|
||||
|
||||
dnl check if memcmp is using signed characters and replace if so.
|
||||
AC_DEFUN([ACX_CHECK_MEMCMP_SIGNED],
|
||||
[AC_MSG_CHECKING([if memcmp compares unsigned])
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
int main(void)
|
||||
{
|
||||
char a = 255, b = 0;
|
||||
if(memcmp(&a, &b, 1) < 0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
]])], [AC_MSG_RESULT([yes]) ],
|
||||
[ AC_MSG_RESULT([no])
|
||||
AC_DEFINE([MEMCMP_IS_BROKEN], [1], [Define if memcmp() does not compare unsigned bytes])
|
||||
AC_LIBOBJ([memcmp])
|
||||
], [ AC_MSG_RESULT([cross-compile no])
|
||||
AC_DEFINE([MEMCMP_IS_BROKEN], [1], [Define if memcmp() does not compare unsigned bytes])
|
||||
AC_LIBOBJ([memcmp])
|
||||
]) ])
|
||||
|
||||
dnl define memcmp to its replacement, pass unique id for program as arg
|
||||
AC_DEFUN([AHX_MEMCMP_BROKEN], [
|
||||
#ifdef MEMCMP_IS_BROKEN
|
||||
# ifdef memcmp
|
||||
# undef memcmp
|
||||
# endif
|
||||
#define memcmp memcmp_$1
|
||||
int memcmp(const void *x, const void *y, size_t n);
|
||||
#endif
|
||||
])
|
||||
|
||||
dnl ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family
|
||||
AC_DEFUN([ACX_CHECK_SS_FAMILY],
|
||||
[AC_CHECK_MEMBER([struct sockaddr_storage.ss_family], [], [
|
||||
AC_CHECK_MEMBER([struct sockaddr_storage.__ss_family], [
|
||||
AC_DEFINE([ss_family], [__ss_family], [Fallback member name for socket family in struct sockaddr_storage])
|
||||
],, [AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
])
|
||||
], [AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
]) ])
|
||||
|
||||
dnl End of file
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ $ac_distutils_result])
|
||||
AC_MSG_CHECKING([for Python site-packages path])
|
||||
if test -z "$PYTHON_SITE_PKG"; then
|
||||
PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
|
||||
print distutils.sysconfig.get_python_lib(0,0);"`
|
||||
print distutils.sysconfig.get_python_lib(1,0);"`
|
||||
fi
|
||||
AC_MSG_RESULT([$PYTHON_SITE_PKG])
|
||||
AC_SUBST([PYTHON_SITE_PKG])
|
||||
|
||||
+4
-1
@@ -32,8 +32,11 @@ char *ctime_r(const time_t *timep, char *buf)
|
||||
}
|
||||
lock_basic_lock(&ctime_lock);
|
||||
result = ctime(timep);
|
||||
if(buf && result)
|
||||
if(buf && result) {
|
||||
if(strlen(result) > 10 && result[7]==' ' && result[8]=='0')
|
||||
result[8]=' '; /* fix error in windows ctime */
|
||||
strcpy(buf, result);
|
||||
}
|
||||
lock_basic_unlock(&ctime_lock);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* memcmp.c: memcmp compat implementation.
|
||||
*
|
||||
* Copyright (c) 2010, NLnet Labs. All rights reserved.
|
||||
*
|
||||
* See LICENSE for the license.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
int memcmp(const void *x, const void *y, size_t n);
|
||||
|
||||
int memcmp(const void *x, const void *y, size_t n)
|
||||
{
|
||||
const uint8_t* x8 = (const uint8_t*)x;
|
||||
const uint8_t* y8 = (const uint8_t*)y;
|
||||
size_t i;
|
||||
for(i=0; i<n; i++) {
|
||||
if(x8[i] < y8[i])
|
||||
return -1;
|
||||
else if(x8[i] > y8[i])
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
+34
-14
@@ -40,6 +40,9 @@
|
||||
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
||||
* and run snprintf for results.
|
||||
*
|
||||
* Wouter Wijngaards(wouter@nlnetlabs.nl) 2/09/2010 for unbound.
|
||||
* Limited support for %g. Does not do the exponents for the before-dot.
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
|
||||
@@ -75,7 +78,7 @@ static void fmtstr (char *buffer, size_t *currlen, size_t maxlen,
|
||||
static void fmtint (char *buffer, size_t *currlen, size_t maxlen,
|
||||
long value, int base, int min, int max, int flags);
|
||||
static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||
long double fvalue, int min, int max, int flags);
|
||||
long double fvalue, int min, int max, int flags, int conv);
|
||||
static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c );
|
||||
|
||||
int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
|
||||
@@ -313,7 +316,7 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
|
||||
else
|
||||
fvalue = va_arg (args, double);
|
||||
/* um, floating point? */
|
||||
fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
|
||||
fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags, 'f');
|
||||
break;
|
||||
case 'E':
|
||||
flags |= DP_F_UP;
|
||||
@@ -330,6 +333,7 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
|
||||
fvalue = va_arg (args, long double);
|
||||
else
|
||||
fvalue = va_arg (args, double);
|
||||
fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags, 'g');
|
||||
break;
|
||||
case 'c':
|
||||
dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
|
||||
@@ -554,7 +558,7 @@ static long compat_round (long double value)
|
||||
}
|
||||
|
||||
static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||
long double fvalue, int min, int max, int flags)
|
||||
long double fvalue, int min, int max, int flags, int conv)
|
||||
{
|
||||
int signvalue = 0;
|
||||
long double ufvalue;
|
||||
@@ -628,13 +632,26 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||
fconvert[fplace++] =
|
||||
(caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10];
|
||||
fracpart = (fracpart / 10);
|
||||
if(conv == 'g' && fplace == 1 && fconvert[0] == '0') {
|
||||
fplace = 0; /* skip trailing zeroes for %g */
|
||||
zpadlen ++;
|
||||
}
|
||||
} while(fracpart && (fplace < 20));
|
||||
if (fplace == 20) fplace--;
|
||||
fconvert[fplace] = 0;
|
||||
|
||||
/* -1 for decimal point, another -1 if we are printing a sign */
|
||||
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
|
||||
zpadlen = max - fplace;
|
||||
if(conv == 'f') {
|
||||
/* -1 for decimal point, another -1 if we are printing a sign */
|
||||
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
|
||||
zpadlen = max - fplace;
|
||||
} else if(conv == 'g') {
|
||||
/* zpadlen contains number of trailing zeroes removed */
|
||||
padlen = min - iplace - (max-zpadlen) - 1 - ((signvalue) ? 1 : 0);
|
||||
if(fplace == 0) {
|
||||
padlen += 1; /* add the decimal dot suppressed */
|
||||
zpadlen = 0;
|
||||
} else zpadlen = (max-zpadlen) - fplace;
|
||||
}
|
||||
if (zpadlen < 0)
|
||||
zpadlen = 0;
|
||||
if (padlen < 0)
|
||||
@@ -667,14 +684,14 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||
while (iplace > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
|
||||
|
||||
/*
|
||||
* Decimal point. This should probably use locale to find the correct
|
||||
* char to print out.
|
||||
*/
|
||||
dopr_outch (buffer, currlen, maxlen, '.');
|
||||
|
||||
while (fplace > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
|
||||
/* for %g do not output decimal point if no fraction is present */
|
||||
if(conv == 'f' || (conv == 'g' && fplace > 0)) {
|
||||
/*
|
||||
* Decimal point. This should probably use locale to find the correct
|
||||
* char to print out.
|
||||
*/
|
||||
dopr_outch (buffer, currlen, maxlen, '.');
|
||||
}
|
||||
|
||||
while (zpadlen > 0)
|
||||
{
|
||||
@@ -682,6 +699,9 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||
--zpadlen;
|
||||
}
|
||||
|
||||
while (fplace > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
|
||||
|
||||
while (padlen < 0)
|
||||
{
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
/** strptime workaround (for oa macos leopard)
|
||||
* This strptime follows the man strptime (2001-11-12)
|
||||
* conforming to SUSv2, POSIX.1-2001
|
||||
*
|
||||
* This very simple version of strptime has no:
|
||||
* - E alternatives
|
||||
* - O alternatives
|
||||
* - Glibc additions
|
||||
* - Does not process week numbers
|
||||
* - Does not properly processes year day
|
||||
*
|
||||
* LICENSE
|
||||
* Copyright (c) 2008, NLnet Labs, Matthijs Mekking
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of NLnetLabs nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
**/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef HAVE_CONFIG_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#ifndef STRPTIME_WORKS
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *abb_weekdays[] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", NULL
|
||||
};
|
||||
static const char *full_weekdays[] = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
"Thursday", "Friday", "Saturday", NULL
|
||||
};
|
||||
static const char *abb_months[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL
|
||||
};
|
||||
static const char *full_months[] = {
|
||||
"January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December", NULL
|
||||
};
|
||||
static const char *ampm[] = {
|
||||
"am", "pm", NULL
|
||||
};
|
||||
|
||||
static int
|
||||
match_string(const char **buf, const char **strs)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; strs[i] != NULL; i++) {
|
||||
int len = strlen(strs[i]);
|
||||
if (strncasecmp (*buf, strs[i], len) == 0) {
|
||||
*buf += len;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
str2int(const char **buf, int max)
|
||||
{
|
||||
int ret=0, count=0;
|
||||
|
||||
while (*buf[0] != '\0' && isdigit(*buf[0]) && count<max) {
|
||||
ret = ret*10 + (*buf[0] - '0');
|
||||
(*buf)++;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (!count)
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Converts the character string s to values which are stored in tm
|
||||
* using the format specified by format
|
||||
**/
|
||||
char *
|
||||
unbound_strptime(const char *s, const char *format, struct tm *tm)
|
||||
{
|
||||
int c, alt_format, ret;
|
||||
int split_year = 0;
|
||||
|
||||
while ((c = *format) != '\0') {
|
||||
alt_format = 0;
|
||||
|
||||
/* whitespace, literal or format */
|
||||
if (isspace(c)) { /* whitespace */
|
||||
/** whitespace matches zero or more whitespace characters in the
|
||||
* input string.
|
||||
**/
|
||||
while (isspace(*s))
|
||||
s++;
|
||||
}
|
||||
else if (c == '%') { /* format */
|
||||
format++;
|
||||
c = *format;
|
||||
switch (c) {
|
||||
case '%': /* %% is converted to % */
|
||||
if (*s != c) {
|
||||
return NULL;
|
||||
}
|
||||
s++;
|
||||
break;
|
||||
case 'a': /* weekday name, abbreviated or full */
|
||||
case 'A':
|
||||
ret = match_string(&s, full_weekdays);
|
||||
if (ret < 0)
|
||||
ret = match_string(&s, abb_weekdays);
|
||||
if (ret < 0) {
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_wday = ret;
|
||||
break;
|
||||
case 'b': /* month name, abbreviated or full */
|
||||
case 'B':
|
||||
case 'h':
|
||||
ret = match_string(&s, full_months);
|
||||
if (ret < 0)
|
||||
ret = match_string(&s, abb_months);
|
||||
if (ret < 0) {
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_mon = ret;
|
||||
break;
|
||||
case 'c': /* date and time representation */
|
||||
if (!(s = unbound_strptime(s, "%x %X", tm))) {
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'C': /* century number */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 0 || ret > 99) { /* must be in [00,99] */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (split_year) {
|
||||
tm->tm_year = ret*100 + (tm->tm_year%100);
|
||||
}
|
||||
else {
|
||||
tm->tm_year = ret*100 - TM_YEAR_BASE;
|
||||
split_year = 1;
|
||||
}
|
||||
break;
|
||||
case 'd': /* day of month */
|
||||
case 'e':
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 1 || ret > 31) { /* must be in [01,31] */
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_mday = ret;
|
||||
break;
|
||||
case 'D': /* equivalent to %m/%d/%y */
|
||||
if (!(s = unbound_strptime(s, "%m/%d/%y", tm))) {
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'H': /* hour */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 0 || ret > 23) { /* must be in [00,23] */
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_hour = ret;
|
||||
break;
|
||||
case 'I': /* 12hr clock hour */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 1 || ret > 12) { /* must be in [01,12] */
|
||||
return NULL;
|
||||
}
|
||||
if (ret == 12) /* actually [0,11] */
|
||||
ret = 0;
|
||||
tm->tm_hour = ret;
|
||||
break;
|
||||
case 'j': /* day of year */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 1 || ret > 366) { /* must be in [001,366] */
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_yday = ret;
|
||||
break;
|
||||
case 'm': /* month */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 1 || ret > 12) { /* must be in [01,12] */
|
||||
return NULL;
|
||||
}
|
||||
/* months go from 0-11 */
|
||||
tm->tm_mon = (ret-1);
|
||||
break;
|
||||
case 'M': /* minute */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 0 || ret > 59) { /* must be in [00,59] */
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_min = ret;
|
||||
break;
|
||||
case 'n': /* arbitrary whitespace */
|
||||
case 't':
|
||||
while (isspace(*s))
|
||||
s++;
|
||||
break;
|
||||
case 'p': /* am pm */
|
||||
ret = match_string(&s, ampm);
|
||||
if (ret < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (tm->tm_hour < 0 || tm->tm_hour > 11) { /* %I */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ret == 1) /* pm */
|
||||
tm->tm_hour += 12;
|
||||
break;
|
||||
case 'r': /* equivalent of %I:%M:%S %p */
|
||||
if (!(s = unbound_strptime(s, "%I:%M:%S %p", tm))) {
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'R': /* equivalent of %H:%M */
|
||||
if (!(s = unbound_strptime(s, "%H:%M", tm))) {
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'S': /* seconds */
|
||||
ret = str2int(&s, 2);
|
||||
/* 60 may occur for leap seconds */
|
||||
/* earlier 61 was also allowed */
|
||||
if (ret < 0 || ret > 60) { /* must be in [00,60] */
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_sec = ret;
|
||||
break;
|
||||
case 'T': /* equivalent of %H:%M:%S */
|
||||
if (!(s = unbound_strptime(s, "%H:%M:%S", tm))) {
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'U': /* week number, with the first Sun of Jan being w1 */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 0 || ret > 53) { /* must be in [00,53] */
|
||||
return NULL;
|
||||
}
|
||||
/** it is hard (and not necessary for nsd) to determine time
|
||||
* data from week number.
|
||||
**/
|
||||
break;
|
||||
case 'w': /* day of week */
|
||||
ret = str2int(&s, 1);
|
||||
if (ret < 0 || ret > 6) { /* must be in [0,6] */
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_wday = ret;
|
||||
break;
|
||||
case 'W': /* week number, with the first Mon of Jan being w1 */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 0 || ret > 53) { /* must be in [00,53] */
|
||||
return NULL;
|
||||
}
|
||||
/** it is hard (and not necessary for nsd) to determine time
|
||||
* data from week number.
|
||||
**/
|
||||
break;
|
||||
case 'x': /* date format */
|
||||
if (!(s = unbound_strptime(s, "%m/%d/%y", tm))) {
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'X': /* time format */
|
||||
if (!(s = unbound_strptime(s, "%H:%M:%S", tm))) {
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 'y': /* last two digits of a year */
|
||||
ret = str2int(&s, 2);
|
||||
if (ret < 0 || ret > 99) { /* must be in [00,99] */
|
||||
return NULL;
|
||||
}
|
||||
if (split_year) {
|
||||
tm->tm_year = ((tm->tm_year/100) * 100) + ret;
|
||||
}
|
||||
else {
|
||||
split_year = 1;
|
||||
|
||||
/** currently:
|
||||
* if in [0,68] we are in 21th century,
|
||||
* if in [69,99] we are in 20th century.
|
||||
**/
|
||||
if (ret < 69) /* 2000 */
|
||||
ret += 100;
|
||||
tm->tm_year = ret;
|
||||
}
|
||||
break;
|
||||
case 'Y': /* year */
|
||||
ret = str2int(&s, 4);
|
||||
if (ret < 0 || ret > 9999) {
|
||||
return NULL;
|
||||
}
|
||||
tm->tm_year = ret - TM_YEAR_BASE;
|
||||
break;
|
||||
case '\0':
|
||||
default: /* unsupported, cannot match format */
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else { /* literal */
|
||||
/* if input cannot match format, return NULL */
|
||||
if (*s != c)
|
||||
return NULL;
|
||||
s++;
|
||||
}
|
||||
|
||||
format++;
|
||||
}
|
||||
|
||||
/* return pointer to remainder of s */
|
||||
return (char*) s;
|
||||
}
|
||||
|
||||
#endif /* STRPTIME_WORKS */
|
||||
Vendored
+68
-128
@@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2009-04-27'
|
||||
timestamp='2009-11-20'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -27,16 +27,16 @@ timestamp='2009-04-27'
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Originally written by Per Bothner <per@bothner.com>.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# Originally written by Per Bothner. Please send patches (context
|
||||
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
||||
# entry.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# The plan is that this can be called by configure scripts if you
|
||||
# don't specify an explicit build system type.
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
||||
eval $set_cc_for_build
|
||||
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep __ELF__ >/dev/null
|
||||
| grep -q __ELF__
|
||||
then
|
||||
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
||||
# Return netbsd for either. FIX?
|
||||
@@ -333,6 +333,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
|
||||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit ;;
|
||||
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
|
||||
echo i386-pc-auroraux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
|
||||
eval $set_cc_for_build
|
||||
SUN_ARCH="i386"
|
||||
@@ -656,7 +659,7 @@ EOF
|
||||
# => hppa64-hp-hpux11.23
|
||||
|
||||
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
|
||||
grep __LP64__ >/dev/null
|
||||
grep -q __LP64__
|
||||
then
|
||||
HP_ARCH="hppa2.0w"
|
||||
else
|
||||
@@ -807,12 +810,12 @@ EOF
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit ;;
|
||||
*:Interix*:[3456]*)
|
||||
*:Interix*:*)
|
||||
case ${UNAME_MACHINE} in
|
||||
x86)
|
||||
echo i586-pc-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
EM64T | authenticamd | genuineintel)
|
||||
authenticamd | genuineintel | EM64T)
|
||||
echo x86_64-unknown-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
IA64)
|
||||
@@ -822,6 +825,9 @@ EOF
|
||||
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
|
||||
echo i${UNAME_MACHINE}-pc-mks
|
||||
exit ;;
|
||||
8664:Windows_NT:*)
|
||||
echo x86_64-pc-mks
|
||||
exit ;;
|
||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||
@@ -851,6 +857,20 @@ EOF
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||
EV56) UNAME_MACHINE=alphaev56 ;;
|
||||
PCA56) UNAME_MACHINE=alphapca56 ;;
|
||||
PCA57) UNAME_MACHINE=alphapca56 ;;
|
||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
@@ -873,6 +893,17 @@ EOF
|
||||
frv:Linux:*:*)
|
||||
echo frv-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
LIBC=gnu
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||
exit ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
@@ -882,78 +913,34 @@ EOF
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
mips:Linux:*:*)
|
||||
mips:Linux:*:* | mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips
|
||||
#undef mipsel
|
||||
#undef ${UNAME_MACHINE}
|
||||
#undef ${UNAME_MACHINE}el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mipsel
|
||||
CPU=${UNAME_MACHINE}el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips
|
||||
CPU=${UNAME_MACHINE}
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#undef CPU
|
||||
#undef mips64
|
||||
#undef mips64el
|
||||
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
|
||||
CPU=mips64el
|
||||
#else
|
||||
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
|
||||
CPU=mips64
|
||||
#else
|
||||
CPU=
|
||||
#endif
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^CPU/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
or32:Linux:*:*)
|
||||
echo or32-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
exit ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||
EV56) UNAME_MACHINE=alphaev56 ;;
|
||||
PCA56) UNAME_MACHINE=alphapca56 ;;
|
||||
PCA57) UNAME_MACHINE=alphapca56 ;;
|
||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
echo sparc-unknown-linux-gnu
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-gnu
|
||||
exit ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
# Look for CPU level
|
||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||
@@ -962,8 +949,11 @@ EOF
|
||||
*) echo hppa-unknown-linux-gnu ;;
|
||||
esac
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-gnu
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit ;;
|
||||
s390:Linux:*:* | s390x:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-linux
|
||||
@@ -986,66 +976,6 @@ EOF
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
# problems with other programs or directories called `ld' in the path.
|
||||
# Set LC_ALL=C to ensure ld outputs messages in English.
|
||||
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
|
||||
| sed -ne '/supported targets:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
s/.*supported targets: *//
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_targets" in
|
||||
elf32-i386)
|
||||
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
|
||||
;;
|
||||
a.out-i386-linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit ;;
|
||||
"")
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or
|
||||
# one that does not give us useful --help.
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
|
||||
exit ;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <features.h>
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
LIBC=gnu
|
||||
# else
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
# else
|
||||
LIBC=gnulibc1
|
||||
# endif
|
||||
#else
|
||||
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
LIBC=gnu
|
||||
#else
|
||||
LIBC=gnuaout
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
|
||||
/^LIBC/{
|
||||
s: ::g
|
||||
p
|
||||
}'`"
|
||||
test x"${LIBC}" != x && {
|
||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||
exit
|
||||
}
|
||||
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
|
||||
;;
|
||||
i*86:DYNIX/ptx:4*:*)
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||
# earlier versions are messed up and put the nodename in both
|
||||
@@ -1074,7 +1004,7 @@ EOF
|
||||
i*86:syllable:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-syllable
|
||||
exit ;;
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
|
||||
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
i*86:*DOS:*:*)
|
||||
@@ -1182,7 +1112,7 @@ EOF
|
||||
rs6000:LynxOS:2.*:*)
|
||||
echo rs6000-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
|
||||
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
|
||||
echo powerpc-unknown-lynxos${UNAME_RELEASE}
|
||||
exit ;;
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
@@ -1275,6 +1205,16 @@ EOF
|
||||
*:Darwin:*:*)
|
||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||
case $UNAME_PROCESSOR in
|
||||
i386)
|
||||
eval $set_cc_for_build
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
UNAME_PROCESSOR="x86_64"
|
||||
fi
|
||||
fi ;;
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
|
||||
+80
-24
@@ -6,6 +6,15 @@
|
||||
/* Pathname to the Unbound configuration file */
|
||||
#undef CONFIGFILE
|
||||
|
||||
/* configure flags */
|
||||
#undef CONFIGURE_BUILD_WITH
|
||||
|
||||
/* configure date */
|
||||
#undef CONFIGURE_DATE
|
||||
|
||||
/* configure target system */
|
||||
#undef CONFIGURE_TARGET
|
||||
|
||||
/* Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work
|
||||
*/
|
||||
#undef DARWIN_BROKEN_SETREUID
|
||||
@@ -37,6 +46,10 @@
|
||||
/* Define to 1 if you have the `daemon' function. */
|
||||
#undef HAVE_DAEMON
|
||||
|
||||
/* Define to 1 if you have the declaration of `sk_SSL_COMP_pop_free', and to 0
|
||||
if you don't. */
|
||||
#undef HAVE_DECL_SK_SSL_COMP_POP_FREE
|
||||
|
||||
/* Define to 1 if you have the declaration of
|
||||
`SSL_COMP_get_compression_methods', and to 0 if you don't. */
|
||||
#undef HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS
|
||||
@@ -68,9 +81,15 @@
|
||||
/* Define to 1 if you have the `EVP_sha512' function. */
|
||||
#undef HAVE_EVP_SHA512
|
||||
|
||||
/* Define to 1 if you have the `ev_default_loop' function. */
|
||||
#undef HAVE_EV_DEFAULT_LOOP
|
||||
|
||||
/* Define to 1 if you have the `ev_loop' function. */
|
||||
#undef HAVE_EV_LOOP
|
||||
|
||||
/* Define to 1 if you have the <expat.h> header file. */
|
||||
#undef HAVE_EXPAT_H
|
||||
|
||||
/* Define to 1 if you have the `fcntl' function. */
|
||||
#undef HAVE_FCNTL
|
||||
|
||||
@@ -131,6 +150,12 @@
|
||||
/* Define to 1 if you have the `kill' function. */
|
||||
#undef HAVE_KILL
|
||||
|
||||
/* Define to 1 if you have the `ldns_key_EVP_unload_gost' function. */
|
||||
#undef HAVE_LDNS_KEY_EVP_UNLOAD_GOST
|
||||
|
||||
/* Define to 1 if you have the <ldns/ldns.h> header file. */
|
||||
#undef HAVE_LDNS_LDNS_H
|
||||
|
||||
/* Define to 1 if you have the `ldns' library (-lldns). */
|
||||
#undef HAVE_LIBLDNS
|
||||
|
||||
@@ -213,6 +238,9 @@
|
||||
/* Define to 1 if you have the `setreuid' function. */
|
||||
#undef HAVE_SETREUID
|
||||
|
||||
/* Define to 1 if you have the `setrlimit' function. */
|
||||
#undef HAVE_SETRLIMIT
|
||||
|
||||
/* Define to 1 if you have the `setsid' function. */
|
||||
#undef HAVE_SETSID
|
||||
|
||||
@@ -228,6 +256,9 @@
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `socketpair' function. */
|
||||
#undef HAVE_SOCKETPAIR
|
||||
|
||||
/* Using Solaris threads */
|
||||
#undef HAVE_SOLARIS_THREADS
|
||||
|
||||
@@ -261,6 +292,9 @@
|
||||
/* Define to 1 if you have the `strlcpy' function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define to 1 if you have the `strptime' function. */
|
||||
#undef HAVE_STRPTIME
|
||||
|
||||
/* Define if you have Swig libraries and header files. */
|
||||
#undef HAVE_SWIG
|
||||
|
||||
@@ -340,6 +374,9 @@
|
||||
/* Define to the maximum message length to pass to syslog. */
|
||||
#undef MAXSYSLOGMSGLEN
|
||||
|
||||
/* Define if memcmp() does not compare unsigned bytes */
|
||||
#undef MEMCMP_IS_BROKEN
|
||||
|
||||
/* Define if mkdir has one argument. */
|
||||
#undef MKDIR_HAS_ONE_ARG
|
||||
|
||||
@@ -383,6 +420,9 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
@@ -396,6 +436,12 @@
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* default rootkey location */
|
||||
#undef ROOT_ANCHOR_FILE
|
||||
|
||||
/* default rootcert location */
|
||||
#undef ROOT_CERT_FILE
|
||||
|
||||
/* version number for resource files */
|
||||
#undef RSRC_PACKAGE_VERSION
|
||||
|
||||
@@ -408,12 +454,21 @@
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* use default strptime. */
|
||||
#undef STRPTIME_WORKS
|
||||
|
||||
/* Use win32 resources and API */
|
||||
#undef UB_ON_WINDOWS
|
||||
|
||||
/* default username */
|
||||
#undef UB_USERNAME
|
||||
|
||||
/* use to enable lightweight alloc assertions, for debug use */
|
||||
#undef UNBOUND_ALLOC_LITE
|
||||
|
||||
/* use malloc not regions, for debug use */
|
||||
#undef UNBOUND_ALLOC_NONREGIONAL
|
||||
|
||||
/* use statistics for allocs and frees, for debug use */
|
||||
#undef UNBOUND_ALLOC_STATS
|
||||
|
||||
@@ -641,26 +696,6 @@
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_RAND_H
|
||||
#include <openssl/rand.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_CONF_H
|
||||
#include <openssl/conf.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ENGINE_H
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_ATTR_FORMAT
|
||||
@@ -771,13 +806,28 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
|
||||
#endif /* IPV6_MIN_MTU */
|
||||
|
||||
|
||||
#ifdef MEMCMP_IS_BROKEN
|
||||
# ifdef memcmp
|
||||
# undef memcmp
|
||||
# endif
|
||||
#define memcmp memcmp_unbound
|
||||
int memcmp(const void *x, const void *y, size_t n);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef HAVE_CTIME_R
|
||||
#define ctime_r unbound_ctime_r
|
||||
char *ctime_r(const time_t *timep, char *buf);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
|
||||
#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
|
||||
#define strptime unbound_strptime
|
||||
struct tm;
|
||||
char *strptime(const char *s, const char *format, struct tm *tm);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
|
||||
/* using version of libevent that is not threadsafe. */
|
||||
# define LIBEVENT_SIGNAL_PROBLEM 1
|
||||
#endif
|
||||
@@ -798,8 +848,6 @@ struct sockaddr_storage;
|
||||
#include "compat/fake-rfc2553.h"
|
||||
#endif
|
||||
|
||||
#include "ldns/ldns.h"
|
||||
|
||||
#ifdef UNBOUND_ALLOC_STATS
|
||||
# define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__)
|
||||
# define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__)
|
||||
@@ -817,8 +865,16 @@ void unbound_stat_free_log(void *ptr, const char* file, int line,
|
||||
const char* func);
|
||||
void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
|
||||
int line, const char* func);
|
||||
#endif /* UNBOUND_ALLOC_STATS */
|
||||
#elif defined(UNBOUND_ALLOC_LITE)
|
||||
# include "util/alloc.h"
|
||||
#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
|
||||
|
||||
/** default port for DNS traffic. */
|
||||
#define UNBOUND_DNS_PORT 53
|
||||
/** default port for unbound control traffic, registered port with IANA,
|
||||
ub-dns-control 8953/tcp unbound dns nameserver control */
|
||||
#define UNBOUND_CONTROL_PORT 8953
|
||||
/** the version of unbound-control that this software implements */
|
||||
#define UNBOUND_CONTROL_VERSION 1
|
||||
|
||||
|
||||
|
||||
Vendored
+31
-12
@@ -1,10 +1,10 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2009-04-17'
|
||||
timestamp='2009-11-20'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@@ -32,13 +32,16 @@ timestamp='2009-04-17'
|
||||
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted ChangeLog entry.
|
||||
# diff and a properly formatted GNU ChangeLog entry.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
|
||||
|
||||
# This file is supposed to be the same for all GNU packages
|
||||
# and recognize all the CPU types, system types and aliases
|
||||
# that are meaningful with *any* GNU software.
|
||||
@@ -149,10 +152,13 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray)
|
||||
-apple | -axis | -knuth | -cray | -microblaze)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
@@ -281,6 +287,7 @@ case $basic_machine in
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
@@ -288,13 +295,14 @@ case $basic_machine in
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
@@ -337,7 +345,7 @@ case $basic_machine in
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
@@ -365,7 +373,7 @@ case $basic_machine in
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
@@ -374,6 +382,7 @@ case $basic_machine in
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
||||
| tron-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
@@ -467,6 +476,10 @@ case $basic_machine in
|
||||
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
os=-linux
|
||||
;;
|
||||
bluegene*)
|
||||
basic_machine=powerpc-ibm
|
||||
os=-cnk
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
@@ -719,6 +732,9 @@ case $basic_machine in
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
microblaze)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
@@ -1240,6 +1256,9 @@ case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
;;
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
;;
|
||||
@@ -1260,9 +1279,9 @@ case $os in
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -kopensolaris* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
@@ -1283,7 +1302,7 @@ case $os in
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@@ -1613,7 +1632,7 @@ case $basic_machine in
|
||||
-sunos*)
|
||||
vendor=sun
|
||||
;;
|
||||
-aix*)
|
||||
-cnk*|-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
|
||||
+266
-117
@@ -6,10 +6,10 @@ sinclude(acx_pthread.m4)
|
||||
sinclude(acx_python.m4)
|
||||
sinclude(ac_pkg_swig.m4)
|
||||
|
||||
AC_INIT(unbound, 1.4.1, unbound-bugs@nlnetlabs.nl, unbound)
|
||||
AC_INIT(unbound, 1.4.13, unbound-bugs@nlnetlabs.nl, unbound)
|
||||
|
||||
LIBUNBOUND_CURRENT=2
|
||||
LIBUNBOUND_REVISION=1
|
||||
LIBUNBOUND_REVISION=13
|
||||
LIBUNBOUND_AGE=0
|
||||
# 1.0.0 had 0:12:0
|
||||
# 1.0.1 had 0:13:0
|
||||
@@ -26,6 +26,18 @@ LIBUNBOUND_AGE=0
|
||||
# 1.4.0-snapshots had 1:5:0
|
||||
# 1.4.0 had 1:5:0 (not 2:0:0) # ub_result.why_bogus
|
||||
# 1.4.1 had 2:1:0
|
||||
# 1.4.2 had 2:2:0
|
||||
# 1.4.3 had 2:3:0
|
||||
# 1.4.4 had 2:4:0
|
||||
# 1.4.5 had 2:5:0
|
||||
# 1.4.6 had 2:6:0
|
||||
# 1.4.7 had 2:7:0
|
||||
# 1.4.8 had 2:8:0
|
||||
# 1.4.9 had 2:9:0
|
||||
# 1.4.10 had 2:10:0
|
||||
# 1.4.11 had 2:11:0
|
||||
# 1.4.12 had 2:12:0
|
||||
# 1.4.13 had 2:13:0
|
||||
|
||||
# Current -- the number of the binary API that we're implementing
|
||||
# Revision -- which iteration of the implementation of the binary
|
||||
@@ -49,6 +61,19 @@ AC_SUBST(LIBUNBOUND_CURRENT)
|
||||
AC_SUBST(LIBUNBOUND_REVISION)
|
||||
AC_SUBST(LIBUNBOUND_AGE)
|
||||
|
||||
pretty_cmdline() {
|
||||
cmdline=""
|
||||
while test -n "$1"; do
|
||||
cmdline="$cmdline '"`echo $1 | sed -e 's/\\\\/\\\\\\\\/g' | sed -e 's/"/\\\\"/g' `"'"
|
||||
shift
|
||||
done
|
||||
}
|
||||
pretty_cmdline $@
|
||||
AC_DEFINE_UNQUOTED(CONFIGURE_BUILD_WITH, ["$cmdline"], [configure flags])
|
||||
AC_CANONICAL_TARGET
|
||||
AC_DEFINE_UNQUOTED(CONFIGURE_TARGET, ["$target"], [configure target system])
|
||||
AC_DEFINE_UNQUOTED(CONFIGURE_DATE, ["`date`"], [configure date])
|
||||
|
||||
CFLAGS="$CFLAGS"
|
||||
AC_AIX
|
||||
|
||||
@@ -135,6 +160,34 @@ AC_SUBST(UNBOUND_PIDFILE)
|
||||
ACX_ESCAPE_BACKSLASH($UNBOUND_PIDFILE, hdr_pid)
|
||||
AC_DEFINE_UNQUOTED(PIDFILE, ["$hdr_pid"], [default pidfile location])
|
||||
|
||||
AC_ARG_WITH(rootkey-file,
|
||||
AC_HELP_STRING([--with-rootkey-file=filename],
|
||||
[set default pathname to root key file (default run-dir/root.key). This file is read and written.]),
|
||||
UNBOUND_ROOTKEY_FILE="$withval",
|
||||
if test $on_mingw = no; then
|
||||
UNBOUND_ROOTKEY_FILE="$UNBOUND_RUN_DIR/root.key"
|
||||
else
|
||||
UNBOUND_ROOTKEY_FILE="C:\\Program Files\\Unbound\\root.key"
|
||||
fi
|
||||
)
|
||||
AC_SUBST(UNBOUND_ROOTKEY_FILE)
|
||||
ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTKEY_FILE, hdr_rkey)
|
||||
AC_DEFINE_UNQUOTED(ROOT_ANCHOR_FILE, ["$hdr_rkey"], [default rootkey location])
|
||||
|
||||
AC_ARG_WITH(rootcert-file,
|
||||
AC_HELP_STRING([--with-rootcert-file=filename],
|
||||
[set default pathname to root update certificate file (default run-dir/icannbundle.pem). This file need not exist if you are content with the builtin.]),
|
||||
UNBOUND_ROOTCERT_FILE="$withval",
|
||||
if test $on_mingw = no; then
|
||||
UNBOUND_ROOTCERT_FILE="$UNBOUND_RUN_DIR/icannbundle.pem"
|
||||
else
|
||||
UNBOUND_ROOTCERT_FILE="C:\\Program Files\\Unbound\\icannbundle.pem"
|
||||
fi
|
||||
)
|
||||
AC_SUBST(UNBOUND_ROOTCERT_FILE)
|
||||
ACX_ESCAPE_BACKSLASH($UNBOUND_ROOTCERT_FILE, hdr_rpem)
|
||||
AC_DEFINE_UNQUOTED(ROOT_CERT_FILE, ["$hdr_rpem"], [default rootcert location])
|
||||
|
||||
AC_ARG_WITH(username,
|
||||
AC_HELP_STRING([--with-username=user],
|
||||
[set default user that unbound changes to (default user is unbound)]),
|
||||
@@ -156,15 +209,13 @@ AC_PROG_CC
|
||||
ACX_DEPFLAG
|
||||
ACX_DETERMINE_EXT_FLAGS_UNBOUND
|
||||
|
||||
# for Sun studio 11.
|
||||
ACX_CHECK_COMPILER_FLAG(xO4, [CFLAGS="$CFLAGS -xO4"])
|
||||
ACX_CHECK_COMPILER_FLAG(xtarget=generic, [CFLAGS="$CFLAGS -xtarget=generic"])
|
||||
|
||||
# debug mode flags warnings
|
||||
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debug warnings, asserts, makefile-dependencies]))
|
||||
debug_enabled="$enable_debug"
|
||||
AC_ARG_ENABLE(checking, AC_HELP_STRING([--enable-checking], [Enable warnings, asserts, makefile-dependencies]))
|
||||
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [same as enable-checking]))
|
||||
if test "$enable_debug" = "yes"; then debug_enabled="$enable_debug";
|
||||
else debug_enabled="$enable_checking"; fi
|
||||
AC_SUBST(debug_enabled)
|
||||
case "$enable_debug" in
|
||||
case "$debug_enabled" in
|
||||
yes)
|
||||
ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="$CFLAGS -W"])
|
||||
ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="$CFLAGS -Wall"])
|
||||
@@ -176,6 +227,7 @@ case "$enable_debug" in
|
||||
# nothing to do.
|
||||
;;
|
||||
esac
|
||||
ACX_CHECK_FLTO
|
||||
|
||||
AC_C_INLINE
|
||||
ACX_CHECK_FORMAT_ATTRIBUTE
|
||||
@@ -223,9 +275,45 @@ ACX_TYPE_RLIM_T
|
||||
ACX_TYPE_SOCKLEN_T
|
||||
ACX_TYPE_IN_ADDR_T
|
||||
ACX_TYPE_IN_PORT_T
|
||||
ACX_CHECK_MEMCMP_SIGNED
|
||||
|
||||
# add option to disable the evil rpath
|
||||
ACX_ARG_RPATH
|
||||
AC_SUBST(RUNTIME_PATH)
|
||||
|
||||
# check to see if libraries are needed for these functions.
|
||||
AC_SEARCH_LIBS([inet_pton], [nsl])
|
||||
AC_SEARCH_LIBS([socket], [socket])
|
||||
|
||||
# check some functions of the OS before linking libs (while still runnable).
|
||||
AC_FUNC_CHOWN
|
||||
AC_FUNC_FORK
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_FSEEKO
|
||||
ACX_SYS_LARGEFILE
|
||||
ACX_CHECK_NONBLOCKING_BROKEN
|
||||
ACX_MKDIR_ONE_ARG
|
||||
|
||||
# check windows threads (we use them, not pthreads, on windows).
|
||||
if test "$on_mingw" = "yes"; then
|
||||
# check windows threads
|
||||
AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_MSG_CHECKING([for CreateThread])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
], [
|
||||
HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
|
||||
])],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads])
|
||||
,
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
else
|
||||
# not on mingw, check thread libraries.
|
||||
|
||||
# check for thread library.
|
||||
# check this first, so that the pthread lib does not get linked in via
|
||||
@@ -267,23 +355,7 @@ if test x_$withval != x_no; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# check windows threads
|
||||
if test x_$ub_have_pthreads = x_no -a x_$ub_have_sol_threads = x_no; then
|
||||
AC_CHECK_HEADERS([windows.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_MSG_CHECKING([for CreateThread])
|
||||
AC_TRY_COMPILE([
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#endif
|
||||
], [
|
||||
HANDLE t = CreateThread(NULL, 0, NULL, NULL, 0, NULL);
|
||||
],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_WINDOWS_THREADS, 1, [Using Windows threads])
|
||||
,
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
fi
|
||||
fi # end of non-mingw check of thread libraries
|
||||
|
||||
# Check for PyUnbound
|
||||
AC_ARG_WITH(pyunbound,
|
||||
@@ -315,6 +387,7 @@ if test x_$ub_test_python != x_no; then
|
||||
|
||||
# Check for Python
|
||||
ub_have_python=no
|
||||
ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS
|
||||
AC_PYTHON_DEVEL
|
||||
if test ! -z "$PYTHON_VERSION"; then
|
||||
if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then
|
||||
@@ -366,7 +439,7 @@ ACX_LIB_SSL
|
||||
AC_CHECK_HEADERS([openssl/conf.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_HEADERS([openssl/engine.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_FUNCS([OPENSSL_config EVP_sha1 EVP_sha256 EVP_sha512])
|
||||
AC_CHECK_DECLS([SSL_COMP_get_compression_methods], [], [], [
|
||||
AC_CHECK_DECLS([SSL_COMP_get_compression_methods,sk_SSL_COMP_pop_free], [], [], [
|
||||
AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
@@ -396,22 +469,19 @@ case "$enable_sha2" in
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(gost, AC_HELP_STRING([--enable-gost], [Enable GOST support, experimental]))
|
||||
AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support]))
|
||||
use_gost="no"
|
||||
case "$enable_gost" in
|
||||
yes)
|
||||
AC_CHECK_LIB(crypto, EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL >= 1.0.0 is needed for GOST support])])
|
||||
no)
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_FUNC(EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL 1.0.0 is needed for GOST support])])
|
||||
AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([OpenSSL does not support ECC, needed for GOST support])])
|
||||
use_gost="yes"
|
||||
AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])
|
||||
;;
|
||||
no|*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# check to see if libraries are needed for these functions.
|
||||
AC_SEARCH_LIBS([inet_pton], [nsl])
|
||||
AC_SEARCH_LIBS([socket], [socket])
|
||||
|
||||
AC_SUBST(RUNTIME_PATH)
|
||||
|
||||
# check for libevent
|
||||
AC_ARG_WITH(libevent, AC_HELP_STRING([--with-libevent=pathname],
|
||||
[use libevent (will check /usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr or you can specify an explicit path). Slower, but allows use of large outgoing port ranges.]),
|
||||
@@ -468,13 +538,21 @@ large outgoing port ranges. ])
|
||||
# check for library used by libevent after 1.3c
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt])
|
||||
|
||||
AC_SEARCH_LIBS(event_set, [event])
|
||||
# is the event.h header libev or libevent?
|
||||
AC_CHECK_HEADERS([event.h],,, [AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_DECL(EV_VERSION_MAJOR, [
|
||||
AC_SEARCH_LIBS(event_set, [ev])
|
||||
],[
|
||||
AC_SEARCH_LIBS(event_set, [event])
|
||||
],[AC_INCLUDES_DEFAULT
|
||||
#include <event.h>
|
||||
])
|
||||
AC_CHECK_FUNCS([event_base_free]) # only in libevent 1.2 and later
|
||||
AC_CHECK_FUNCS([event_base_once]) # only in libevent 1.4.1 and later
|
||||
AC_CHECK_FUNCS([event_base_new]) # only in libevent 1.4.1 and later
|
||||
AC_CHECK_FUNCS([event_base_get_method]) # only in libevent 1.4.3 and later
|
||||
AC_CHECK_FUNCS([ev_loop]) # only in libev. (tested on 3.51)
|
||||
AC_CHECK_FUNCS([ev_default_loop]) # only in libev. (tested on 4.00)
|
||||
if test -n "$BAK_LDFLAGS_SET"; then
|
||||
LDFLAGS="$BAK_LDFLAGS"
|
||||
fi
|
||||
@@ -482,10 +560,33 @@ else
|
||||
AC_DEFINE(USE_MINI_EVENT, 1, [Define if you want to use internal select based events])
|
||||
fi
|
||||
|
||||
# check for libexpat
|
||||
AC_ARG_WITH(libexpat, AC_HELP_STRING([--with-libexpat=path],
|
||||
[specify explicit path for libexpat.]),
|
||||
[ ],[ withval="/usr/local /opt/local /usr/lib /usr/pkg /usr/sfw /usr" ])
|
||||
AC_MSG_CHECKING(for libexpat)
|
||||
found_libexpat="no"
|
||||
for dir in $withval ; do
|
||||
if test -f "$dir/include/expat.h"; then
|
||||
found_libexpat="yes"
|
||||
dnl assume /usr is in default path.
|
||||
if test "$dir" != "/usr"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$dir/include"
|
||||
LDFLAGS="$LDFLAGS -L$dir/lib"
|
||||
fi
|
||||
AC_MSG_RESULT(found in $dir)
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if test x_$found_libexpat != x_yes; then
|
||||
AC_ERROR([Could not find libexpat, expat.h])
|
||||
fi
|
||||
AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT])
|
||||
|
||||
# set static linking if requested
|
||||
AC_SUBST(staticexe)
|
||||
staticexe=""
|
||||
AC_ARG_ENABLE(staticexe, AC_HELP_STRING([--enable-static-exe],
|
||||
AC_ARG_ENABLE(static-exe, AC_HELP_STRING([--enable-static-exe],
|
||||
[ enable to compile executables statically against event, ldns libs, for debug purposes ]),
|
||||
, )
|
||||
if test x_$enable_static_exe = x_yes; then
|
||||
@@ -511,20 +612,27 @@ fi
|
||||
|
||||
# set memory allocation checking if requested
|
||||
AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
|
||||
[ enable to check memory allocation, for debug purposes ]),
|
||||
[ enable to memory allocation statistics, for debug purposes ]),
|
||||
, )
|
||||
AC_ARG_ENABLE(alloc-lite, AC_HELP_STRING([--enable-alloc-lite],
|
||||
[ enable for lightweight alloc assertions, for debug purposes ]),
|
||||
, )
|
||||
AC_ARG_ENABLE(alloc-nonregional, AC_HELP_STRING([--enable-alloc-nonregional],
|
||||
[ enable nonregional allocs, slow but exposes regional allocations to other memory purifiers, for debug purposes ]),
|
||||
, )
|
||||
if test x_$enable_alloc_nonregional = x_yes; then
|
||||
AC_DEFINE(UNBOUND_ALLOC_NONREGIONAL, 1, [use malloc not regions, for debug use])
|
||||
fi
|
||||
if test x_$enable_alloc_checks = x_yes; then
|
||||
AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use])
|
||||
else
|
||||
ACX_FUNC_MALLOC([unbound])
|
||||
if test x_$enable_alloc_lite = x_yes; then
|
||||
AC_DEFINE(UNBOUND_ALLOC_LITE, 1, [use to enable lightweight alloc assertions, for debug use])
|
||||
else
|
||||
ACX_FUNC_MALLOC([unbound])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_FUNC_CHOWN
|
||||
AC_FUNC_FORK
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_FSEEKO
|
||||
ACX_SYS_LARGEFILE
|
||||
|
||||
ACX_CHECK_GETADDRINFO_WITH_INCLUDES
|
||||
if test "$USE_WINSOCK" = 1; then
|
||||
AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
|
||||
@@ -539,6 +647,8 @@ fi
|
||||
if test $ac_cv_func_getaddrinfo = no; then
|
||||
AC_LIBOBJ([fake-rfc2553])
|
||||
fi
|
||||
# check after getaddrinfo for its libraries
|
||||
ACX_FUNC_IOCTLSOCKET
|
||||
|
||||
# see if daemon(3) exists, and if it is deprecated.
|
||||
AC_CHECK_FUNCS([daemon])
|
||||
@@ -548,16 +658,38 @@ if test $ac_cv_func_daemon = yes; then
|
||||
])
|
||||
fi
|
||||
|
||||
# check wether strptime also works
|
||||
AC_DEFUN([AC_CHECK_STRPTIME_WORKS],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING(whether strptime works)
|
||||
if test c${cross_compiling} = cno; then
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#define _XOPEN_SOURCE
|
||||
#include <time.h>
|
||||
int main(void) { struct tm tm; char *res;
|
||||
res = strptime("20070207111842", "%Y%m%d%H%M%S", &tm);
|
||||
if (!res) return 1; return 0; }
|
||||
]])] , [eval "ac_cv_c_strptime_works=yes"], [eval "ac_cv_c_strptime_works=no"])
|
||||
else
|
||||
eval "ac_cv_c_strptime_works=maybe"
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_c_strptime_works)
|
||||
if test $ac_cv_c_strptime_works = no; then
|
||||
AC_LIBOBJ(strptime)
|
||||
else
|
||||
AC_DEFINE_UNQUOTED([STRPTIME_WORKS], 1, [use default strptime.])
|
||||
fi
|
||||
])dnl
|
||||
AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])])
|
||||
AC_SEARCH_LIBS([setusercontext], [util])
|
||||
AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev setresuid setreuid setresgid setregid glob initgroups strftime localtime_r setusercontext _beginthreadex])
|
||||
AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex])
|
||||
AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
|
||||
AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
|
||||
|
||||
# check if setreuid en setregid fail, on MacOSX10.4(darwin8).
|
||||
if echo $build_os | grep darwin8 > /dev/null; then
|
||||
AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
|
||||
fi
|
||||
ACX_CHECK_NONBLOCKING_BROKEN
|
||||
ACX_MKDIR_ONE_ARG
|
||||
ACX_FUNC_IOCTLSOCKET
|
||||
AC_REPLACE_FUNCS(inet_aton)
|
||||
AC_REPLACE_FUNCS(inet_pton)
|
||||
AC_REPLACE_FUNCS(inet_ntop)
|
||||
@@ -567,57 +699,81 @@ AC_REPLACE_FUNCS(memmove)
|
||||
AC_REPLACE_FUNCS(gmtime_r)
|
||||
AC_REPLACE_FUNCS(ctime_r)
|
||||
|
||||
AC_ARG_ENABLE(allsymbols, AC_HELP_STRING([--enable-allsymbols], [export all symbols from libunbound and link binaries to it, smaller install size but libunbound export table is polluted by internal symbols]))
|
||||
case "$enable_allsymbols" in
|
||||
no)
|
||||
EXPORT_ALL_SYMBOLS=no
|
||||
;;
|
||||
yes)
|
||||
EXPORT_ALL_SYMBOLS=yes
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(EXPORT_ALL_SYMBOLS)
|
||||
|
||||
# check this after all other compilation checks, since the linking of the lib
|
||||
# may break checks after this.
|
||||
use_ldns_builtin="no"
|
||||
AC_ARG_WITH(ldns, AC_HELP_STRING([--with-ldns=PATH],
|
||||
[specify prefix of path of ldns library to use]),
|
||||
[ specialldnsdir="$withval"
|
||||
if test "$withval" != ""; then
|
||||
CPPFLAGS="-I$withval/include $CPPFLAGS"
|
||||
LDFLAGS="-L$withval -L$withval/lib $LDFLAGS"
|
||||
ACX_RUNTIME_PATH_ADD([$withval/lib])
|
||||
[
|
||||
if test "$withval" != "yes"; then
|
||||
if test "$withval" != "/usr" -a "$withval" != ""; then
|
||||
CPPFLAGS="-I$withval/include $CPPFLAGS"
|
||||
LDFLAGS="-L$withval/lib $LDFLAGS"
|
||||
ACX_RUNTIME_PATH_ADD([$withval/lib])
|
||||
fi
|
||||
ldnsdir="$withval"
|
||||
AC_SUBST(ldnsdir)
|
||||
fi
|
||||
ldnsdir="$withval"
|
||||
AC_SUBST(ldnsdir)
|
||||
])
|
||||
|
||||
AC_ARG_WITH(ldns-builtin, AC_HELP_STRING([--with-ldns-builtin],
|
||||
[forces use of package included with this one]), [
|
||||
use_ldns_builtin="yes"
|
||||
])
|
||||
|
||||
# check if ldns is good enough
|
||||
if test "$use_ldns_builtin" = "no"; then
|
||||
AC_CHECK_LIB(ldns, ldns_buffer_copy)
|
||||
if test $ac_cv_lib_ldns_ldns_buffer_copy = yes; then
|
||||
dnl ldns was found, check compat functions
|
||||
AC_CHECK_FUNC([ldns_b32_ntop_extended_hex],, [
|
||||
AC_MSG_ERROR([ldns version too old, need >=1.4.0])])
|
||||
else
|
||||
use_ldns_builtin="yes"
|
||||
fi
|
||||
AC_CHECK_LIB(ldns, ldns_rr_new,,[
|
||||
AC_MSG_ERROR([No ldns library found, install the ldns library into system lib dir or use --with-ldns=path to other location. The --with-ldns can point to the make-dir of ldns. Install the package ldns or download source http://www.nlnetlabs.nl/projects/ldns])
|
||||
])
|
||||
AC_CHECK_FUNC(ldns_buffer_copy)
|
||||
AC_CHECK_FUNC(ldns_key_buf2rsa_raw)
|
||||
AC_CHECK_FUNC(ldns_get_random)
|
||||
AC_CHECK_FUNC(ldns_b32_ntop_extended_hex)
|
||||
if test x$use_gost = xyes; then
|
||||
AC_CHECK_FUNC(ldns_key_EVP_load_gost_id)
|
||||
AC_CHECK_FUNCS([ldns_key_EVP_unload_gost])
|
||||
else
|
||||
ac_cv_func_ldns_key_EVP_load_gost_id="yes"
|
||||
fi
|
||||
AC_CHECK_HEADERS([ldns/ldns.h],,[
|
||||
AC_MSG_ERROR([No ldns include file found, install the ldns library development files. Install package ldns-dev or ldns-devel or download source http://www.nlnetlabs.nl/projects/ldns])
|
||||
], [AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
if test "$use_ldns_builtin" = "yes"; then
|
||||
dnl use the builtin ldns-src.tar.gz file to build ldns.
|
||||
if test ! -f $srcdir/ldns-src.tar.gz; then
|
||||
AC_MSG_ERROR([No ldns library found and no ldns-src.tar.gz, use --with-ldns=path.])
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
])
|
||||
if test $ac_cv_func_ldns_buffer_copy = yes \
|
||||
-a $ac_cv_func_ldns_key_buf2rsa_raw = yes \
|
||||
-a $ac_cv_func_ldns_get_random = yes \
|
||||
-a $ac_cv_header_ldns_ldns_h = yes \
|
||||
-a $ac_cv_func_ldns_b32_ntop_extended_hex = yes \
|
||||
-a $ac_cv_func_ldns_key_EVP_load_gost_id = yes; then
|
||||
dnl ldns was found
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([ldns library is not recent, update the ldns library, install it into system lib dir or use --with-ldns=path to other location. The --with-ldns can point to the make-dir of ldns. Package libldns or download source http://www.nlnetlabs.nl/projects/ldns])
|
||||
fi
|
||||
echo "****************************************************************"
|
||||
echo "*** ***"
|
||||
echo "*** Building ldns library from package included in this one. ***"
|
||||
echo "*** ***"
|
||||
echo "****************************************************************"
|
||||
if test -d $srcdir/ldns-src; then rm -rf $srcdir/ldns-src; fi
|
||||
mkdir $srcdir/ldns-src; cp $srcdir/ldns-src.tar.gz $srcdir/ldns-src/ldns-src.tar.gz; (cd $srcdir/ldns-src; gzip -cd ldns-src.tar.gz | tar xf -); rm -f $srcdir/ldns-src/ldns-src.tar.gz; mv $srcdir/ldns-src $srcdir/ldns-srcb; mv $srcdir/ldns-srcb/ldns* $srcdir/ldns-src; rmdir $srcdir/ldns-srcb
|
||||
ldnsdir="ldns-src"
|
||||
AC_MSG_NOTICE([Configure $ldnsdir scheduled after config.status])
|
||||
AC_CONFIG_SUBDIRS([ldns-src])
|
||||
CPPFLAGS="-I$ldnsdir/include $CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $ldnsdir/*.lo"
|
||||
AC_SUBST(ldnsdir)
|
||||
fi dnl end of use_ldns_builtin == yes
|
||||
|
||||
ACX_STRIP_EXT_FLAGS
|
||||
LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
|
||||
@@ -677,26 +833,6 @@ dnl includes
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_RAND_H
|
||||
#include <openssl/rand.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_CONF_H
|
||||
#include <openssl/conf.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ENGINE_H
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
]
|
||||
|
||||
AHX_CONFIG_FORMAT_ATTRIBUTE
|
||||
@@ -716,6 +852,7 @@ AHX_CONFIG_W32_RANDOM
|
||||
AHX_CONFIG_W32_SRANDOM
|
||||
AHX_CONFIG_W32_FD_SET_T
|
||||
AHX_CONFIG_IPV6_MIN_MTU
|
||||
AHX_MEMCMP_BROKEN(unbound)
|
||||
|
||||
[
|
||||
#ifndef HAVE_CTIME_R
|
||||
@@ -723,7 +860,13 @@ AHX_CONFIG_IPV6_MIN_MTU
|
||||
char *ctime_r(const time_t *timep, char *buf);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
|
||||
#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
|
||||
#define strptime unbound_strptime
|
||||
struct tm;
|
||||
char *strptime(const char *s, const char *format, struct tm *tm);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_EVENT_H) && !defined(HAVE_EVENT_BASE_ONCE) && !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)) && (defined(HAVE_PTHREAD) || defined(HAVE_SOLARIS_THREADS))
|
||||
/* using version of libevent that is not threadsafe. */
|
||||
# define LIBEVENT_SIGNAL_PROBLEM 1
|
||||
#endif
|
||||
@@ -744,8 +887,6 @@ struct sockaddr_storage;
|
||||
#include "compat/fake-rfc2553.h"
|
||||
#endif
|
||||
|
||||
#include "ldns/ldns.h"
|
||||
|
||||
#ifdef UNBOUND_ALLOC_STATS
|
||||
# define malloc(s) unbound_stat_malloc_log(s, __FILE__, __LINE__, __func__)
|
||||
# define calloc(n,s) unbound_stat_calloc_log(n, s, __FILE__, __LINE__, __func__)
|
||||
@@ -763,12 +904,20 @@ void unbound_stat_free_log(void *ptr, const char* file, int line,
|
||||
const char* func);
|
||||
void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
|
||||
int line, const char* func);
|
||||
#endif /* UNBOUND_ALLOC_STATS */
|
||||
#elif defined(UNBOUND_ALLOC_LITE)
|
||||
# include "util/alloc.h"
|
||||
#endif /* UNBOUND_ALLOC_LITE and UNBOUND_ALLOC_STATS */
|
||||
|
||||
/** default port for DNS traffic. */
|
||||
#define UNBOUND_DNS_PORT 53
|
||||
/** default port for unbound control traffic, registered port with IANA,
|
||||
ub-dns-control 8953/tcp unbound dns nameserver control */
|
||||
#define UNBOUND_CONTROL_PORT 8953
|
||||
/** the version of unbound-control that this software implements */
|
||||
#define UNBOUND_CONTROL_VERSION 1
|
||||
|
||||
])
|
||||
|
||||
AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8])
|
||||
AC_CONFIG_FILES([Makefile doc/example.conf doc/libunbound.3 doc/unbound.8 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound.conf.5 doc/unbound-control.8])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AC_OUTPUT
|
||||
|
||||
+2
-3
@@ -7,12 +7,11 @@ distribution but may be helpful.
|
||||
* unbound.spec and unbound.init: RPM specfile and Linux rc.d initfile.
|
||||
* update-anchor.sh: shell script that uses unbound-host to update a set
|
||||
of trust anchor files. Run from cron twice a month.
|
||||
* update-itar.sh: shell script that updates from itar.iana.org. Run from cron.
|
||||
* split-itar.sh: shell script to split anchors.mf from itar.iana.org into
|
||||
multiple key files so it can be used with auto-trust-anchor-file.
|
||||
* unbound_munin_ : plugin for munin statistics report
|
||||
* unbound_cacti.tar.gz : setup files for cacti statistics report
|
||||
* selinux: the .fc and .te files for SElinux protection of the unbound daemon
|
||||
* unbound.plist: launchd configuration file for MacOSX.
|
||||
* build-unbound-localzone-from-hosts.pl: perl script to turn /etc/hosts into
|
||||
a local-zone and local-data include file for unbound.conf.
|
||||
* unbound-host.nagios.patch: makes unbound-host return status that fits right
|
||||
in with the nagios monitoring framework. Contributed by Migiel de Vos.
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#/usr/bin/env bash
|
||||
# Contributed by Tom Hendrikx <tom@whyscream.net>
|
||||
|
||||
PROGNAME=$(basename $0)
|
||||
|
||||
usage() {
|
||||
echo "$PROGNAME: split the anchors.mf file from IANA into separate files." >&2
|
||||
echo "" >&2
|
||||
echo "$PROGNAME uses 2 arguments:" >&2
|
||||
echo " - the path to the anchors.mf, available at: https://itar.iana.org/" >&2
|
||||
echo " - the directory to leave the files, defaults to '.' (current working dir)" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -n "$1" ] && [ -r "$1" ]; then
|
||||
itar="$1"
|
||||
echo "Reading from: $itar"
|
||||
else
|
||||
echo "Error: no anchors file given" >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
dir="$2"
|
||||
else
|
||||
dir=$(pwd)
|
||||
fi
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "Error: $dir is not a directory" >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
while read cn line; do
|
||||
if [ $(expr match "$cn" '[a-zA-Z0-9-]*\.') -gt 0 ]; then
|
||||
# first line of key
|
||||
out="$dir/$cn"anchor
|
||||
echo "writing key for $cn to: $out"
|
||||
echo "$cn $line" > $out
|
||||
elif [ "$cn" == "DS" ]; then
|
||||
# second or later line of earlier defined key
|
||||
echo " $cn $line" >> $out
|
||||
fi
|
||||
done < "$itar"
|
||||
|
||||
echo "Done."
|
||||
@@ -0,0 +1,134 @@
|
||||
Index: smallapp/unbound-host.c
|
||||
===================================================================
|
||||
--- smallapp/unbound-host.c (revision 2115)
|
||||
+++ smallapp/unbound-host.c (working copy)
|
||||
@@ -62,9 +62,18 @@
|
||||
#include "libunbound/unbound.h"
|
||||
#include <ldns/ldns.h>
|
||||
|
||||
+/** status variable ala nagios */
|
||||
+#define FINAL_STATUS_OK 0
|
||||
+#define FINAL_STATUS_WARNING 1
|
||||
+#define FINAL_STATUS_CRITICAL 2
|
||||
+#define FINAL_STATUS_UNKNOWN 3
|
||||
+
|
||||
/** verbosity for unbound-host app */
|
||||
static int verb = 0;
|
||||
|
||||
+/** variable to determine final output */
|
||||
+static int final_status = FINAL_STATUS_UNKNOWN;
|
||||
+
|
||||
/** Give unbound-host usage, and exit (1). */
|
||||
static void
|
||||
usage()
|
||||
@@ -93,7 +102,7 @@
|
||||
printf("Version %s\n", PACKAGE_VERSION);
|
||||
printf("BSD licensed, see LICENSE in source package for details.\n");
|
||||
printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
|
||||
/** determine if str is ip4 and put into reverse lookup format */
|
||||
@@ -138,7 +147,7 @@
|
||||
*res = strdup(buf);
|
||||
if(!*res) {
|
||||
fprintf(stderr, "error: out of memory\n");
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -158,7 +167,7 @@
|
||||
}
|
||||
if(!res) {
|
||||
fprintf(stderr, "error: out of memory\n");
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -172,7 +181,7 @@
|
||||
if(r == 0 && strcasecmp(t, "TYPE0") != 0 &&
|
||||
strcmp(t, "") != 0) {
|
||||
fprintf(stderr, "error unknown type %s\n", t);
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -191,7 +200,7 @@
|
||||
if(r == 0 && strcasecmp(c, "CLASS0") != 0 &&
|
||||
strcmp(c, "") != 0) {
|
||||
fprintf(stderr, "error unknown class %s\n", c);
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -207,6 +216,19 @@
|
||||
return "(insecure)";
|
||||
}
|
||||
|
||||
+/** update the final status for the exit code */
|
||||
+void
|
||||
+update_final_status(struct ub_result* result)
|
||||
+{
|
||||
+ if (final_status == FINAL_STATUS_UNKNOWN || final_status == FINAL_STATUS_OK) {
|
||||
+ if (result->secure) final_status = FINAL_STATUS_OK;
|
||||
+ else if (result->bogus) final_status = FINAL_STATUS_CRITICAL;
|
||||
+ else final_status = FINAL_STATUS_WARNING;
|
||||
+ }
|
||||
+ else if (final_status == FINAL_STATUS_WARNING && result->bogus)
|
||||
+ final_status = FINAL_STATUS_CRITICAL;
|
||||
+}
|
||||
+
|
||||
/** nice string for type */
|
||||
static void
|
||||
pretty_type(char* s, size_t len, int t)
|
||||
@@ -353,7 +375,7 @@
|
||||
} else {
|
||||
fprintf(stderr, "could not parse "
|
||||
"reply packet to ANY query\n");
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
ldns_pkt_free(p);
|
||||
|
||||
@@ -388,9 +410,10 @@
|
||||
ret = ub_resolve(ctx, q, t, c, &result);
|
||||
if(ret != 0) {
|
||||
fprintf(stderr, "resolve error: %s\n", ub_strerror(ret));
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
pretty_output(q, t, c, result, docname);
|
||||
+ update_final_status(result);
|
||||
ret = result->nxdomain;
|
||||
ub_resolve_free(result);
|
||||
return ret;
|
||||
@@ -427,7 +450,7 @@
|
||||
{
|
||||
if(r != 0) {
|
||||
fprintf(stderr, "error: %s\n", ub_strerror(r));
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,7 +471,7 @@
|
||||
ctx = ub_ctx_create();
|
||||
if(!ctx) {
|
||||
fprintf(stderr, "error: out of memory\n");
|
||||
- exit(1);
|
||||
+ exit(FINAL_STATUS_UNKNOWN);
|
||||
}
|
||||
|
||||
/* parse the options */
|
||||
@@ -509,5 +532,5 @@
|
||||
usage();
|
||||
|
||||
lookup(ctx, argv[0], qtype, qclass);
|
||||
- return 0;
|
||||
+ return final_status;
|
||||
}
|
||||
+15
-6
@@ -1,14 +1,15 @@
|
||||
Summary: Validating, recursive, and caching DNS resolver
|
||||
Name: unbound
|
||||
Version: 1.0.1
|
||||
Version: 1.4.8
|
||||
Release: 1%{?dist}
|
||||
License: BSD
|
||||
Url: http://www.nlnetlabs.nl/unbound/
|
||||
Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
|
||||
#Source1: unbound.init
|
||||
Group: System Environment/Daemons
|
||||
Requires: ldns
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: flex, openssl-devel
|
||||
BuildRequires: flex, openssl-devel, expat-devel, ldns-devel
|
||||
|
||||
%description
|
||||
Unbound is a validating, recursive, and caching DNS resolver.
|
||||
@@ -28,10 +29,6 @@ The source code is under a BSD License.
|
||||
|
||||
# configure with /var/unbound/unbound.conf so that all default chroot,
|
||||
# pidfile and config file are in /var/unbound, ready for chroot jail set up.
|
||||
#
|
||||
# This is a build using libldns builtin version, the resulting binaries
|
||||
# do not require libldns and this package does not have version dependencies.
|
||||
# Could be smaller using a dependency on libldns (use --with-ldns=).
|
||||
%configure --with-conf-file=%{_localstatedir}/%{name}/unbound.conf --disable-rpath
|
||||
|
||||
%build
|
||||
@@ -92,6 +89,18 @@ if [ "$1" -ge "1" ]; then
|
||||
fi
|
||||
|
||||
%changelog
|
||||
* Thu Jul 13 2011 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.4.8
|
||||
- ldns required and ldns-devel required for build, no more ldns-builtin.
|
||||
|
||||
* Thu Mar 17 2011 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.4.8
|
||||
- removed --disable-gost, assume recent openssl on the destination platform.
|
||||
|
||||
* Wed Mar 16 2011 Harold Jones <hajones@verisign.com> - 1.4.8
|
||||
- Bump version number to latest
|
||||
- Add expat-devel to BuildRequires
|
||||
- Added --disable-gost for building on CentOS 5.x
|
||||
- Added --with-ldns-builtin for CentOS 5.x
|
||||
|
||||
* Thu May 22 2008 Wouter Wijngaards <wouter@nlnetlabs.nl> - 1.0.0
|
||||
- contrib changes from Patrick Vande Walle.
|
||||
|
||||
|
||||
+144
-26
@@ -1,5 +1,5 @@
|
||||
# initial python set up
|
||||
%{?!with_python: %define with_python 0}
|
||||
# not ready yet
|
||||
%{?!with_python: %global with_python 1}
|
||||
|
||||
%if %{with_python}
|
||||
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
Summary: Validating, recursive, and caching DNS(SEC) resolver
|
||||
Name: unbound
|
||||
Version: 1.3.1rc2
|
||||
Version: 1.4.13
|
||||
Release: 1%{?dist}
|
||||
License: BSD
|
||||
Url: http://www.nlnetlabs.nl/unbound/
|
||||
@@ -16,24 +16,31 @@ Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
|
||||
Source1: unbound.init
|
||||
Source2: unbound.conf
|
||||
Source3: unbound.munin
|
||||
# See the unbound svn repository for further documentation on these
|
||||
Patch0: unbound-1.2-glob.patch
|
||||
Source4: unbound_munin_
|
||||
Source5: root.key
|
||||
Source6: dlv.isc.org.key
|
||||
Patch1: unbound-1.2-glob.patch
|
||||
|
||||
Group: System Environment/Daemons
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: flex, openssl-devel , ldns-devel >= 1.5.0,
|
||||
BuildRequires: libevent-devel
|
||||
BuildRequires: libevent-devel expat-devel
|
||||
%if %{with_python}
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: python-devel swig
|
||||
%endif
|
||||
# Required for SVN versions
|
||||
# BuildRequires: bison
|
||||
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
Requires(preun): initscripts
|
||||
Requires(postun): initscripts
|
||||
Requires: ldns >= 1.5.0, dnssec-conf >= 1.19
|
||||
Requires: ldns >= 1.5.0
|
||||
Requires(pre): shadow-utils
|
||||
|
||||
Obsoletes: dnssec-conf < 1.27-2
|
||||
Provides: dnssec-conf = 1.27-1
|
||||
|
||||
%description
|
||||
Unbound is a validating, recursive, and caching DNS(SEC) resolver.
|
||||
|
||||
@@ -67,7 +74,7 @@ Summary: Libraries used by the unbound server and client applications
|
||||
Group: Applications/System
|
||||
Requires(post): /sbin/ldconfig
|
||||
Requires(postun): /sbin/ldconfig
|
||||
Requires: openssl >= 0.9.8g-12
|
||||
Requires: openssl
|
||||
|
||||
%description libs
|
||||
Contains libraries used by the unbound server and client applications
|
||||
@@ -84,18 +91,18 @@ Python modules and extensions for unbound
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
%configure --with-ldns= --with-libevent --with-pthreads --with-ssl \
|
||||
--disable-rpath --enable-debug --disable-static \
|
||||
--disable-rpath --disable-static \
|
||||
--with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \
|
||||
--with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid \
|
||||
%if %{with_python}
|
||||
--with-pythonmodule --with-pyunbound \
|
||||
%endif
|
||||
--enable-sha2
|
||||
%{__make} CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" QUIET=no %{?_smp_mflags}
|
||||
--enable-sha2 --disable-gost
|
||||
%{__make} %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
@@ -107,13 +114,19 @@ install -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/unbound
|
||||
install -d 0755 %{buildroot}%{_sysconfdir}/munin/plugin-conf.d
|
||||
install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/munin/plugin-conf.d/unbound
|
||||
install -d 0755 %{buildroot}%{_datadir}/munin/plugins/
|
||||
install -m 0755 contrib/unbound_munin_ %{buildroot}%{_datadir}/munin/plugins/unbound
|
||||
install -m 0755 %{SOURCE4} %{buildroot}%{_datadir}/munin/plugins/unbound
|
||||
for plugin in unbound_munin_hits unbound_munin_queue unbound_munin_memory unbound_munin_by_type unbound_munin_by_class unbound_munin_by_opcode unbound_munin_by_rcode unbound_munin_by_flags unbound_munin_histogram; do
|
||||
ln -s unbound %{buildroot}%{_datadir}/munin/plugins/$plugin
|
||||
done
|
||||
|
||||
# install root and DLV key
|
||||
install -m 0644 %{SOURCE5} %{SOURCE6} %{buildroot}%{_sysconfdir}/unbound/
|
||||
|
||||
# remove static library from install (fedora packaging guidelines)
|
||||
rm -rf %{buildroot}%{_libdir}/*.la
|
||||
rm %{buildroot}%{_libdir}/*.la
|
||||
%if %{with_python}
|
||||
rm %{buildroot}%{python_sitearch}/*.la
|
||||
%endif
|
||||
|
||||
mkdir -p %{buildroot}%{_localstatedir}/run/unbound
|
||||
|
||||
@@ -125,14 +138,19 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%doc doc/README doc/CREDITS doc/LICENSE doc/FEATURES
|
||||
%attr(0755,root,root) %{_initrddir}/%{name}
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}
|
||||
%attr(0755,unbound,unbound) %dir %{_localstatedir}/run/%{name}
|
||||
%ghost %attr(0755,unbound,unbound) %dir %{_localstatedir}/run/%{name}
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/unbound.conf
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/dlv.isc.org.key
|
||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/%{name}/root.key
|
||||
%{_sbindir}/*
|
||||
%{_mandir}/*/*
|
||||
|
||||
%if %{with_python}
|
||||
%files python
|
||||
%{python_sitelib}/*
|
||||
%defattr(-,root,root,-)
|
||||
%{python_sitearch}/*
|
||||
%doc libunbound/python/examples/*
|
||||
%doc pythonmod/examples/*
|
||||
%endif
|
||||
|
||||
%files munin
|
||||
@@ -160,15 +178,11 @@ exit 0
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add %{name}
|
||||
# Check DNSSEC settings if this is a fresh install
|
||||
if [ "$1" -eq 1 ]; then
|
||||
if [ -r /etc/sysconfig/dnssec ]; then
|
||||
. /etc/sysconfig/dnssec
|
||||
[ -x /usr/sbin/dnssec-configure ] && \
|
||||
dnssec-configure -u --norestart --nocheck --dnssec="$DNSSEC" --dlv="$DLV" > \
|
||||
/dev/null 2>&1
|
||||
fi;
|
||||
fi
|
||||
# dnssec-conf used to contain our DLV key, but now we include it via unbound
|
||||
# If unbound had previously been configured with dnssec-configure, we need
|
||||
# to migrate the location of the DLV key file (to keep DLV enabled, and because
|
||||
# unbound won't start with a bad location for a DLV key file.
|
||||
sed -i "s:/etc/pki/dnssec-keys[/]*dlv:/etc/unbound:" %{_sysconfdir}/unbound/unbound.conf
|
||||
|
||||
%post libs -p /sbin/ldconfig
|
||||
|
||||
@@ -186,6 +200,110 @@ fi
|
||||
%postun libs -p /sbin/ldconfig
|
||||
|
||||
%changelog
|
||||
* Tue Sep 06 2011 Paul Wouters <paul@xelerance.com> - 1.4.13-1
|
||||
- Updated to 1.4.13
|
||||
- Fix install location of pythonmod from sitelib to sitearch
|
||||
- Removed patches merged in by upstream
|
||||
- Removed versioned openssl dep, it differs per branch
|
||||
|
||||
* Mon Aug 08 2011 Paul Wouters <paul@xelerance.com> - 1.4.12-3
|
||||
- Added pythonmod docs and examples
|
||||
- Fix for python module load in the server (Tom Hendrikx)
|
||||
- No longer enable --enable-debug as it causes degraded performance
|
||||
under load.
|
||||
|
||||
* Mon Jul 18 2011 Paul Wouters <paul@xelerance.com> - 1.4.12-1
|
||||
- Updated to 1.4.12
|
||||
|
||||
* Sun Jul 03 2011 Paul Wouters <paul@xelerance.com> - 1.4.11-1
|
||||
- Updated to 1.4.11
|
||||
- removed integrated CVE patch
|
||||
- updated stock unbound.conf for new options introduced
|
||||
|
||||
* Mon Jun 06 2011 Paul Wouters <paul@xelerance.com> - 1.4.10-1
|
||||
- Added ghost for /var/run/unbound (bz#656710)
|
||||
|
||||
* Mon Jun 06 2011 Paul Wouters <paul@xelerance.com> - 1.4.9-3
|
||||
- rebuilt
|
||||
|
||||
* Wed May 25 2011 Paul Wouters <paul@xelerance.com> - 1.4.9-2
|
||||
- Applied patch for CVE-2011-1922 DoS vulnerability
|
||||
|
||||
* Sun Mar 27 2011 Paul Wouters <paul@xelerance.com> - 1.4.9-1
|
||||
- Updated to 1.4.9
|
||||
|
||||
* Sat Feb 12 2011 Paul Wouters <paul@xelerance.com> - 1.4.8-2
|
||||
- rebuilt
|
||||
|
||||
* Tue Jan 25 2011 Paul Wouters <paul@xelerance.com> - 1.4.8-1
|
||||
- Updated to 1.4.8
|
||||
- Enable root key for DNSSEC
|
||||
- Fix unbound-munin to use proper file (could cause excessive logging)
|
||||
- Build unbound-python per default
|
||||
- Disable gost as Fedora/EPEL does not allow ECC and has mangled openssl
|
||||
|
||||
* Tue Oct 26 2010 Paul Wouters <paul@xelerance.com> - 1.4.5-4
|
||||
- Revert last build - it was on the wrong branch
|
||||
|
||||
* Tue Oct 26 2010 Paul Wouters <paul@xelerance.com> - 1.4.5-3
|
||||
- Disable do-ipv6 per default - causes severe degradation on non-ipv6 machines
|
||||
(see comments in inbound.conf)
|
||||
|
||||
* Tue Jun 15 2010 Paul Wouters <paul@xelerance.com> - 1.4.5-2
|
||||
- Bump release - forgot to upload the new tar ball.
|
||||
|
||||
* Tue Jun 15 2010 Paul Wouters <paul@xelerance.com> - 1.4.5-1
|
||||
- Upgraded to 1.4.5
|
||||
|
||||
* Mon May 31 2010 Paul Wouters <paul@xelerance.com> - 1.4.4-2
|
||||
- Added accidentally omitted svn patches to cvs
|
||||
|
||||
* Mon May 31 2010 Paul Wouters <paul@xelerance.com> - 1.4.4-1
|
||||
- Upgraded to 1.4.4 with svn patches
|
||||
- Obsolete dnssec-conf to ensure it is de-installed
|
||||
|
||||
* Thu Mar 11 2010 Paul Wouters <paul@xelerance.com> - 1.4.3-1
|
||||
- Update to 1.4.3 that fixes 64bit crasher
|
||||
|
||||
* Tue Mar 09 2010 Paul Wouters <paul@xelerance.com> - 1.4.2-1
|
||||
- Updated to 1.4.2
|
||||
- Updated unbound.conf with new options
|
||||
- Enabled pre-fetching DNSKEY records (DNSSEC speedup)
|
||||
- Enabled re-fetching popular records before they expire
|
||||
- Enabled logging of DNSSEC validation errors
|
||||
|
||||
* Mon Mar 01 2010 Paul Wouters <paul@xelerance.com> - 1.4.1-5
|
||||
- Overriding -D_GNU_SOURCE is no longer needed. This fixes DSO issues
|
||||
with pthreads
|
||||
|
||||
* Wed Feb 24 2010 Paul Wouters <paul@xelerance.com> - 1.4.1-3
|
||||
- Change make/configure lines to attempt to fix -lphtread linking issue
|
||||
|
||||
* Thu Feb 18 2010 Paul Wouters <paul@xelerance.com> - 1.4.1-2
|
||||
- Removed dependancy for dnssec-conf
|
||||
- Added ISC DLV key (formerly in dnssec-conf)
|
||||
- Fixup old DLV locations in unbound.conf file via %%post
|
||||
- Fix parent child disagreement handling and no-ipv6 present [svn r1953]
|
||||
|
||||
* Tue Jan 05 2010 Paul Wouters <paul@xelerance.com> - 1.4.1-1
|
||||
- Updated to 1.4.1
|
||||
- Changed %%define to %%global
|
||||
|
||||
* Thu Oct 08 2009 Paul Wouters <paul@xelerance.com> - 1.3.4-2
|
||||
- Bump version
|
||||
|
||||
* Thu Oct 08 2009 Paul Wouters <paul@xelerance.com> - 1.3.4-1
|
||||
- Upgraded to 1.3.4. Security fix with validating NSEC3 records
|
||||
|
||||
* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 1.3.3-2
|
||||
- rebuilt with new openssl
|
||||
|
||||
* Mon Aug 17 2009 Paul Wouters <paul@xelerance.com> - 1.3.3-1
|
||||
- Updated to 1.3.3
|
||||
|
||||
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
|
||||
|
||||
* Sat Jun 20 2009 Paul Wouters <paul@xelerance.com> - 1.3.0-2
|
||||
- Added missing glob patch to cvs
|
||||
- Place python macros within the %%with_python check
|
||||
|
||||
@@ -235,6 +235,7 @@ if test "$1" = "config" ; then
|
||||
done
|
||||
p_config "total.num.queries" "total queries from clients"
|
||||
p_config "total.num.cachehits" "cache hits"
|
||||
p_config "total.num.prefetch" "cache prefetch"
|
||||
p_config "num.query.tcp" "TCP queries"
|
||||
p_config "num.query.ipv6" "IPv6 queries"
|
||||
p_config "unwanted.queries" "queries that failed acl"
|
||||
@@ -423,8 +424,8 @@ hits)
|
||||
for x in thread0.num.queries thread1.num.queries thread2.num.queries \
|
||||
thread3.num.queries thread4.num.queries thread5.num.queries \
|
||||
thread6.num.queries thread7.num.queries total.num.queries \
|
||||
total.num.cachehits num.query.tcp num.query.ipv6 \
|
||||
unwanted.queries unwanted.replies; do
|
||||
total.num.cachehits total.num.prefetch num.query.tcp \
|
||||
num.query.ipv6 unwanted.queries unwanted.replies; do
|
||||
if grep "^"$x"=" $state >/dev/null 2>&1; then
|
||||
print_qps $x
|
||||
fi
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
#!/bin/sh
|
||||
# update-itar.sh - update from the interim trust anchor repository
|
||||
# Copyright 2009, W.C.A. Wijngaards
|
||||
# This file is BSD licensed, see doc/LICENSE.
|
||||
|
||||
# --- Some settings
|
||||
|
||||
# directory where unbound works
|
||||
thedir="."
|
||||
# where is the file that unbound is going to read
|
||||
ub_ta_file="$thedir/anchors.mf"
|
||||
# where is the itar master file format
|
||||
itar_url="ftp://iana.org/itar/anchors.mf"
|
||||
# where is the itar PGP signature
|
||||
itar_sig="ftp://iana.org/itar/anchors.mf.sig"
|
||||
|
||||
# which command to fetch urls, cmd $dest $url. "wget -O" "curl -o"
|
||||
fetch_cmd="wget -O"
|
||||
# file with pgp public key
|
||||
pgp_pub_key_file="$thedir/update-itar.key"
|
||||
# our pgp keyring (goes into .gnupg directory)
|
||||
pgp_keyring_file="update-itar.ring"
|
||||
# pgp command to use
|
||||
pgp_cmd="gpg"
|
||||
|
||||
|
||||
# --- The script is below
|
||||
usage ( )
|
||||
{
|
||||
echo "usage: update-itar"
|
||||
echo " Updates the trust anchors from the interim trust"
|
||||
echo " anchor repository, https://itar.iana.org, and checks PGP sig."
|
||||
echo
|
||||
echo " Updates $ub_ta_file with the latest keys."
|
||||
echo " Read that file from the unbound config with"
|
||||
echo " trust-anchor-file: "'"'"$ub_ta_file"'"'
|
||||
echo
|
||||
echo " Exit code 0 means anchors updated, 1 no changes, "
|
||||
echo " others are errors. So, in a cronjob you can do:"
|
||||
echo " cd /usr/local/etc/unbound # your unbound work dir"
|
||||
echo " ./update-itar.sh && unbound-control reload"
|
||||
exit 2
|
||||
}
|
||||
|
||||
if test $# -ne 0; then
|
||||
usage
|
||||
fi
|
||||
tmpf="/tmp/update-itar.$$"
|
||||
|
||||
# one argument: explanation string
|
||||
error_exit ( )
|
||||
{
|
||||
if test -f $tmpf.log; then cat $tmpf.log; fi
|
||||
rm -f $tmpf $tmpf.sig $tmpf.log
|
||||
echo "Error updating trust anchors: $1"
|
||||
exit 2
|
||||
}
|
||||
|
||||
if test ! -f $pgp_pub_key_file || test ! -f $HOME/.gnupg/$pgp_keyring_file || \
|
||||
test "$pgp_pub_key_file" -nt $HOME/.gnupg/$pgp_keyring_file; then
|
||||
# default key contents right here
|
||||
if test ! -f $pgp_pub_key_file; then
|
||||
echo "creating default IANA ITAR pgp key file"
|
||||
cat >$pgp_pub_key_file <<EOF
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1.4.5
|
||||
|
||||
mQGiBElr2DcRBAC+6YK6eSP7rzstvnMPQXMrpvVfuIR5FeTpGuwae9JP78V/iOXr
|
||||
N0yW8Dn6kdAztCMuRizL1Ij9IgaD7pjn8h09VgR4cN4LDv75rcQeWLzNxKy4UNRF
|
||||
aStL77RcIoTblBeCgHAK9FLzd0XfTGZCNaLNy9BYVSLyADOVDIqgBcrvBwCglz03
|
||||
QhOMIgaSx/XuRh6kYtynZ6kD/2GXx6pFs57b7rww8yOpdurCSOMB1wuEXiIXznTI
|
||||
06ARiib0G5VDvOdpy0LDU2526Q9f/WAERlhcExTgnTFigG4mRksUiDrrai4GIr+6
|
||||
JaivcGFVYdZZ4mZ088jcwujS/UY3C0ryGR9ufYUDAnfx6frhSl6o6j5is+jeGndF
|
||||
JYRAA/9B/1OXNVwFSiIxnP2aPUwsT1li1vaW8dhA/5PcuPLOVvEjPc1Pc16HGLhE
|
||||
8CRmMn66LqB1ccInE5hLKGGvV3pctjan+IOhaq3OHt/a+buDtTPgykchMZ2k1AzT
|
||||
RYk+gksxpIl6yTZsBH4hoRt8auxEJW8AiYbNtXXkNuWcoQL40bQsSUFOQSBUcnVz
|
||||
dCBBbmNob3IgUmVwb3NpdG9yeSA8aXRhckBpYW5hLm9yZz6IYAQTEQIAIAUCSWvY
|
||||
NwIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEPR9+zCB1GT0GUAAn29/TacF
|
||||
Teh87dls8pmkjxS4pKf1AKCJS/MvzR54AblO4DNMyc9q0G4frrkCDQRJa9g3EAgA
|
||||
ywoLxF4HVb9o926UIXw8JxNIzDPkt8galAcKRUmHQMNa/QA80WMl9Ia6DIxavGlV
|
||||
I5O1fvms297RV2KSSBjKWn6G+0me80A7aw0eHNg7habM5VtzDz5DhJbQFdJV9aYV
|
||||
DoTSnY6uR6iSSRrdZNaYdlCwDS8lBCnOKoGMArHzVCa2EdCBeCUY/eObOXtu8Gm3
|
||||
nDkuWeLPv08/0lvtr6d6VoDUEVPEsJAPONEYtpz/D+EZddUraF+3JscWqfRApBOz
|
||||
/8WHaeTNdzIH+h1ntktiizA6eH40EM6coQQxtIRsxg1DPTxofdovreMkcMI0EUUP
|
||||
awDn8gDtgG3g6Ud5zCdknwAEDQf/W3rxrEN6OZxJvWti8Iu6KOgxtuINiAsimPPX
|
||||
qy9KHowyEE9EMPzgADjWC9Reyusr4CwcootjWw7ryUwU0fXvVULKhg32NzLsx/Ci
|
||||
WtgCPSR58WZ1KKhnoB05+PTrwzhU+u64Cd/vJtFqGxSrANl2FAkPswHJMr8dMwAz
|
||||
uni7zzLJ+homW1T5AaixwmN3jeDHWshJH9E9JIhr5Y/8AzMl1V10r2u1c2ej0lBJ
|
||||
Y4GegI5cYAEBerS9d+mrbPlvbJ8AfuAuEf0y/PWJh0z1+Kck5qIbXMn/rpMBYvLJ
|
||||
Uj5CfqWlh8+hxqSYJDXtLm8hBiQFiMEew0jOc2Tw4F91OZ+jyYhJBBgRAgAJBQJJ
|
||||
a9g3AhsMAAoJEPR9+zCB1GT0AUwAn2ZtBwAyVxppdeTqilXufUvAkvjbAJ9dUpR1
|
||||
9a17/5BvDDJcIxSEKTJmDw==
|
||||
=zCNZ
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
EOF
|
||||
fi
|
||||
# import the new key
|
||||
$pgp_cmd --no-default-keyring --keyring $pgp_keyring_file \
|
||||
--primary-keyring $pgp_keyring_file \
|
||||
--import $pgp_pub_key_file >$tmpf.log 2>&1 \
|
||||
|| error_exit "could not import pgp public key into keyring"
|
||||
fi
|
||||
|
||||
$fetch_cmd $tmpf $itar_url >$tmpf.log 2>&1 \
|
||||
|| error_exit "fetching $itar_url failed"
|
||||
tail -2 $tmpf | grep "; End of file" >/dev/null 2>&1 || \
|
||||
error_exit "The file fetched from $itar_url was partial"
|
||||
$fetch_cmd $tmpf.sig $itar_sig >$tmpf.log 2>&1 \
|
||||
|| error_exit "fetching $itar_sig failed"
|
||||
|
||||
# check the file with pgp
|
||||
$pgp_cmd --no-default-keyring --keyring $pgp_keyring_file \
|
||||
--verify $tmpf.sig $tmpf >$tmpf.log 2>&1 \
|
||||
|| error_exit "the PGP signature failed!"
|
||||
|
||||
# check for differences
|
||||
val=1
|
||||
if diff "$ub_ta_file" $tmpf 2>/dev/null ; then
|
||||
# echo "The interim trust anchor repository did not change."
|
||||
:
|
||||
else
|
||||
echo "Updating $ub_ta_file"
|
||||
cp $tmpf $ub_ta_file
|
||||
val=0
|
||||
fi
|
||||
|
||||
rm -f $tmpf $tmpf.sig $tmpf.log
|
||||
exit $val
|
||||
Executable
+117
@@ -0,0 +1,117 @@
|
||||
#!/bin/sh
|
||||
# validation reporter - reports validation failures to a collection server.
|
||||
# Copyright NLnet Labs, 2010
|
||||
# BSD license.
|
||||
|
||||
|
||||
###
|
||||
# Here is the configuration for the validation reporter
|
||||
# it greps the failure lines out of the log and sends them to a server.
|
||||
|
||||
# The pidfile for the reporter daemon.
|
||||
pidfile="/var/run/validation-reporter.pid"
|
||||
|
||||
# The logfile to watch for logged validation failures.
|
||||
logfile="/var/log/unbound.log"
|
||||
|
||||
# how to notify the upstream
|
||||
# nc is netcat, it sends tcp to given host port. It makes a tcp connection
|
||||
# and writes one log-line to it (grepped from the logfile).
|
||||
# the notify command can be: "nc the.server.name.org 1234"
|
||||
# the listening daemon could be: nc -lk 127.0.0.1 1234 >> outputfile &
|
||||
notify_cmd="nc localhost 1234"
|
||||
|
||||
|
||||
###
|
||||
# Below this line is the code for the validation reporter,
|
||||
# first the daemon itself, then the controller for the daemon.
|
||||
reporter_daemon() {
|
||||
trap "rm -f \"$pidfile\"" EXIT
|
||||
tail -f $logfile | grep "unbound.*info: validation failure" | \
|
||||
while read x; do
|
||||
echo "$x" | $notify_cmd
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
# controller for daemon.
|
||||
start_daemon() {
|
||||
echo "starting reporter"
|
||||
nohup $0 rundaemon </dev/null >/dev/null 2>&1 &
|
||||
echo $! > "$pidfile"
|
||||
}
|
||||
|
||||
kill_daemon() {
|
||||
echo "stopping reporter"
|
||||
if test -s "$pidfile"; then
|
||||
kill `cat "$pidfile"`
|
||||
# check it is really dead
|
||||
if kill -0 `cat "$pidfile"` >/dev/null 2>&1; then
|
||||
sleep 1
|
||||
while kill -0 `cat "$pidfile"` >/dev/null 2>&1; do
|
||||
kill `cat "$pidfile"` >/dev/null 2>&1
|
||||
echo "waiting for reporter to stop"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
get_status_daemon() {
|
||||
if test -s "$pidfile"; then
|
||||
if kill -0 `cat "$pidfile"`; then
|
||||
return 0;
|
||||
fi
|
||||
fi
|
||||
return 1;
|
||||
}
|
||||
|
||||
restart_daemon() {
|
||||
kill_daemon
|
||||
start_daemon
|
||||
}
|
||||
|
||||
condrestart_daemon() {
|
||||
if get_status_daemon; then
|
||||
echo "reporter ("`cat "$pidfile"`") is running"
|
||||
exit 0
|
||||
fi
|
||||
start_daemon
|
||||
exit 0
|
||||
}
|
||||
|
||||
status_daemon() {
|
||||
if get_status_daemon; then
|
||||
echo "reporter ("`cat "$pidfile"`") is running"
|
||||
exit 0
|
||||
fi
|
||||
echo "reporter is not running"
|
||||
exit 1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
rundaemon)
|
||||
reporter_daemon
|
||||
;;
|
||||
start)
|
||||
start_daemon
|
||||
;;
|
||||
stop)
|
||||
kill_daemon
|
||||
;;
|
||||
restart)
|
||||
restart_daemon
|
||||
;;
|
||||
condrestart)
|
||||
condrestart_daemon
|
||||
;;
|
||||
status)
|
||||
status_daemon
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
exit $?
|
||||
+1
-1
@@ -47,7 +47,7 @@
|
||||
#include "util/net_help.h"
|
||||
|
||||
struct acl_list*
|
||||
acl_list_create()
|
||||
acl_list_create(void)
|
||||
{
|
||||
struct acl_list* acl = (struct acl_list*)calloc(1,
|
||||
sizeof(struct acl_list));
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ struct acl_addr {
|
||||
* Create acl structure
|
||||
* @return new structure or NULL on error.
|
||||
*/
|
||||
struct acl_list* acl_list_create();
|
||||
struct acl_list* acl_list_create(void);
|
||||
|
||||
/**
|
||||
* Delete acl structure.
|
||||
|
||||
+39
-11
@@ -40,6 +40,7 @@
|
||||
* to text format.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/ldns.h"
|
||||
#include "daemon/cachedump.h"
|
||||
#include "daemon/remote.h"
|
||||
#include "daemon/worker.h"
|
||||
@@ -403,7 +404,7 @@ load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
|
||||
status = ldns_rr_new_frm_str(&rr, (char*)ldns_buffer_begin(buf),
|
||||
LDNS_DEFAULT_TTL, NULL, NULL);
|
||||
if(status != LDNS_STATUS_OK) {
|
||||
log_warn("error cannot parse rr :%s: %s",
|
||||
log_warn("error cannot parse rr: %s: %s",
|
||||
ldns_get_errorstr_by_id(status),
|
||||
(char*)ldns_buffer_begin(buf));
|
||||
return 0;
|
||||
@@ -420,7 +421,7 @@ load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
|
||||
ldns_buffer_skip(buf, 2);
|
||||
status = ldns_rr_rdata2buffer_wire(buf, rr);
|
||||
if(status != LDNS_STATUS_OK) {
|
||||
log_warn("error cannot rr2wire :%s",
|
||||
log_warn("error cannot rr2wire: %s",
|
||||
ldns_get_errorstr_by_id(status));
|
||||
ldns_rr_free(rr);
|
||||
return 0;
|
||||
@@ -443,6 +444,12 @@ load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
|
||||
rk->rk.rrset_class = htons(ldns_rr_get_class(rr));
|
||||
ldns_buffer_clear(buf);
|
||||
status = ldns_dname2buffer_wire(buf, ldns_rr_owner(rr));
|
||||
if(status != LDNS_STATUS_OK) {
|
||||
log_warn("error cannot dname2buffer: %s",
|
||||
ldns_get_errorstr_by_id(status));
|
||||
ldns_rr_free(rr);
|
||||
return 0;
|
||||
}
|
||||
ldns_buffer_flip(buf);
|
||||
rk->rk.dname_len = ldns_buffer_limit(buf);
|
||||
rk->rk.dname = regional_alloc_init(region,
|
||||
@@ -738,6 +745,7 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker)
|
||||
rep.flags = (uint16_t)flags;
|
||||
rep.qdcount = (uint16_t)qdcount;
|
||||
rep.ttl = (uint32_t)ttl;
|
||||
rep.prefetch_ttl = PREFETCH_TTL_CALC(rep.ttl);
|
||||
rep.security = (enum sec_status)security;
|
||||
rep.an_numrrsets = (size_t)an;
|
||||
rep.ns_numrrsets = (size_t)ns;
|
||||
@@ -757,7 +765,7 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker)
|
||||
if(!go_on)
|
||||
return 1; /* skip this one, not all references satisfied */
|
||||
|
||||
if(!dns_cache_store(&worker->env, &qinf, &rep, 0)) {
|
||||
if(!dns_cache_store(&worker->env, &qinf, &rep, 0, 0)) {
|
||||
log_warn("error out of memory");
|
||||
return 0;
|
||||
}
|
||||
@@ -794,7 +802,8 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp)
|
||||
{
|
||||
char buf[257];
|
||||
struct delegpt_addr* a;
|
||||
int lame, dlame, rlame, rtt, edns_vs, to, lost;
|
||||
int lame, dlame, rlame, rto, edns_vs, to, delay, entry_ttl;
|
||||
struct rtt_info ri;
|
||||
uint8_t edns_lame_known;
|
||||
for(a = dp->target_list; a; a = a->next_target) {
|
||||
addr_to_str(&a->addr, a->addrlen, buf, sizeof(buf));
|
||||
@@ -805,29 +814,48 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp)
|
||||
return;
|
||||
}
|
||||
/* lookup in infra cache */
|
||||
entry_ttl = infra_get_host_rto(worker->env.infra_cache,
|
||||
&a->addr, a->addrlen, &ri, &delay, *worker->env.now);
|
||||
if(entry_ttl == -2 && ri.rto >= USEFUL_SERVER_TOP_TIMEOUT) {
|
||||
if(!ssl_printf(ssl, "expired, rto %d msec.\n", ri.rto))
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
if(entry_ttl == -1 || entry_ttl == -2) {
|
||||
if(!ssl_printf(ssl, "not in infra cache.\n"))
|
||||
return;
|
||||
continue; /* skip stuff not in infra cache */
|
||||
}
|
||||
|
||||
/* uses type_A because most often looked up, but other
|
||||
* lameness won't be reported then */
|
||||
if(!infra_get_lame_rtt(worker->env.infra_cache,
|
||||
&a->addr, a->addrlen, dp->name, dp->namelen,
|
||||
LDNS_RR_TYPE_A, &lame, &dlame, &rlame, &rtt, &lost,
|
||||
LDNS_RR_TYPE_A, &lame, &dlame, &rlame, &rto,
|
||||
*worker->env.now)) {
|
||||
if(!ssl_printf(ssl, "not in infra cache.\n"))
|
||||
return;
|
||||
continue; /* skip stuff not in infra cache */
|
||||
}
|
||||
if(!ssl_printf(ssl, "%s%s%srtt %d msec, %d lost. ",
|
||||
if(!ssl_printf(ssl, "%s%s%s%srto %d msec, ttl %d, ping %d "
|
||||
"var %d rtt %d",
|
||||
lame?"LAME ":"", dlame?"NoDNSSEC ":"",
|
||||
rlame?"NoAuthButRecursive ":"", rtt, lost))
|
||||
a->lame?"AddrWasParentSide ":"",
|
||||
rlame?"NoAuthButRecursive ":"", rto, entry_ttl,
|
||||
ri.srtt, ri.rttvar, rtt_notimeout(&ri)))
|
||||
return;
|
||||
if(delay)
|
||||
if(!ssl_printf(ssl, ", probedelay %d", delay))
|
||||
return;
|
||||
if(infra_host(worker->env.infra_cache, &a->addr, a->addrlen,
|
||||
*worker->env.now, &edns_vs, &edns_lame_known, &to)) {
|
||||
if(edns_vs == -1) {
|
||||
if(!ssl_printf(ssl, "noEDNS%s.",
|
||||
edns_lame_known?" probed":""))
|
||||
if(!ssl_printf(ssl, ", noEDNS%s.",
|
||||
edns_lame_known?" probed":" assumed"))
|
||||
return;
|
||||
} else {
|
||||
if(!ssl_printf(ssl, "EDNS %d%s.",
|
||||
edns_vs, edns_lame_known?" probed":""))
|
||||
if(!ssl_printf(ssl, ", EDNS %d%s.", edns_vs,
|
||||
edns_lame_known?" probed":" assumed"))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
+34
-11
@@ -40,6 +40,22 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_RAND_H
|
||||
#include <openssl/rand.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_CONF_H
|
||||
#include <openssl/conf.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENSSL_ENGINE_H
|
||||
#include <openssl/engine.h>
|
||||
#endif
|
||||
#include "ldns/ldns.h"
|
||||
#include "daemon/daemon.h"
|
||||
#include "daemon/worker.h"
|
||||
#include "daemon/remote.h"
|
||||
@@ -69,7 +85,7 @@ static void* comp_meth = NULL;
|
||||
#endif
|
||||
#ifdef LEX_HAS_YYLEX_DESTROY
|
||||
/** remove buffers for parsing and init */
|
||||
void ub_c_lex_destroy(void);
|
||||
int ub_c_lex_destroy(void);
|
||||
#endif
|
||||
|
||||
/** used when no other sighandling happens, so we don't die
|
||||
@@ -115,7 +131,7 @@ static RETSIGTYPE record_sigh(int sig)
|
||||
* Stores signals to replay later.
|
||||
*/
|
||||
static void
|
||||
signal_handling_record()
|
||||
signal_handling_record(void)
|
||||
{
|
||||
if( signal(SIGTERM, record_sigh) == SIG_ERR ||
|
||||
#ifdef SIGQUIT
|
||||
@@ -153,7 +169,7 @@ signal_handling_playback(struct worker* wrk)
|
||||
}
|
||||
|
||||
struct daemon*
|
||||
daemon_init()
|
||||
daemon_init(void)
|
||||
{
|
||||
struct daemon* daemon = (struct daemon*)calloc(1,
|
||||
sizeof(struct daemon));
|
||||
@@ -260,7 +276,7 @@ static void daemon_setup_modules(struct daemon* daemon)
|
||||
* @param shufport: the portlist output.
|
||||
* @return number of ports available.
|
||||
*/
|
||||
int daemon_get_shufport(struct daemon* daemon, int* shufport)
|
||||
static int daemon_get_shufport(struct daemon* daemon, int* shufport)
|
||||
{
|
||||
int i, n, k, temp;
|
||||
int avail = 0;
|
||||
@@ -276,7 +292,7 @@ int daemon_get_shufport(struct daemon* daemon, int* shufport)
|
||||
/* Knuth shuffle */
|
||||
n = avail;
|
||||
while(--n > 0) {
|
||||
k = ub_random(daemon->rand) % (n+1); /* 0<= k<= n */
|
||||
k = ub_random_max(daemon->rand, n+1); /* 0<= k<= n */
|
||||
temp = shufport[k];
|
||||
shufport[k] = shufport[n];
|
||||
shufport[n] = temp;
|
||||
@@ -310,7 +326,7 @@ daemon_create_workers(struct daemon* daemon)
|
||||
numport = daemon_get_shufport(daemon, shufport);
|
||||
verbose(VERB_ALGO, "total of %d outgoing ports available", numport);
|
||||
|
||||
daemon->num = daemon->cfg->num_threads;
|
||||
daemon->num = (daemon->cfg->num_threads?daemon->cfg->num_threads:1);
|
||||
daemon->workers = (struct worker**)calloc((size_t)daemon->num,
|
||||
sizeof(struct worker*));
|
||||
for(i=0; i<daemon->num; i++) {
|
||||
@@ -323,12 +339,13 @@ daemon_create_workers(struct daemon* daemon)
|
||||
free(shufport);
|
||||
}
|
||||
|
||||
#ifdef THREADS_DISABLED
|
||||
/**
|
||||
* Close all pipes except for the numbered thread.
|
||||
* @param daemon: daemon to close pipes in.
|
||||
* @param thr: thread number 0..num-1 of thread to skip.
|
||||
*/
|
||||
void close_other_pipes(struct daemon* daemon, int thr)
|
||||
static void close_other_pipes(struct daemon* daemon, int thr)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<daemon->num; i++)
|
||||
@@ -343,6 +360,7 @@ void close_other_pipes(struct daemon* daemon, int thr)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* THREADS_DISABLED */
|
||||
|
||||
/**
|
||||
* Function to start one thread.
|
||||
@@ -431,7 +449,7 @@ daemon_fork(struct daemon* daemon)
|
||||
*/
|
||||
daemon_create_workers(daemon);
|
||||
|
||||
#ifdef HAVE_EV_LOOP
|
||||
#if defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
|
||||
/* in libev the first inited base gets signals */
|
||||
if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1))
|
||||
fatal_exit("Could not initialize main thread");
|
||||
@@ -445,7 +463,7 @@ daemon_fork(struct daemon* daemon)
|
||||
/* Special handling for the main thread. This is the thread
|
||||
* that handles signals and remote control.
|
||||
*/
|
||||
#ifndef HAVE_EV_LOOP
|
||||
#if !(defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP))
|
||||
/* libevent has the last inited base get signals (or any base) */
|
||||
if(!worker_init(daemon->workers[0], daemon->cfg, daemon->ports, 1))
|
||||
fatal_exit("Could not initialize main thread");
|
||||
@@ -516,8 +534,13 @@ daemon_delete(struct daemon* daemon)
|
||||
ub_c_lex_destroy();
|
||||
#endif
|
||||
/* libcrypto cleanup */
|
||||
#if HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS
|
||||
sk_SSL_COMP_free(comp_meth);
|
||||
#if defined(USE_GOST) && defined(HAVE_LDNS_KEY_EVP_UNLOAD_GOST)
|
||||
ldns_key_EVP_unload_gost();
|
||||
#endif
|
||||
#if HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS && HAVE_DECL_SK_SSL_COMP_POP_FREE
|
||||
#ifndef S_SPLINT_S
|
||||
sk_SSL_COMP_pop_free(comp_meth, (void(*)())CRYPTO_free);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_OPENSSL_CONFIG
|
||||
EVP_cleanup();
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ struct daemon {
|
||||
* Initialize daemon structure.
|
||||
* @return: The daemon structure, or NULL on error.
|
||||
*/
|
||||
struct daemon* daemon_init();
|
||||
struct daemon* daemon_init(void);
|
||||
|
||||
/**
|
||||
* Open shared listening ports (if needed).
|
||||
|
||||
+361
-51
@@ -43,6 +43,11 @@
|
||||
* Both the server and the client(control tool) have their own keys.
|
||||
*/
|
||||
#include "config.h"
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include "ldns/ldns.h"
|
||||
#include "daemon/remote.h"
|
||||
#include "daemon/worker.h"
|
||||
#include "daemon/daemon.h"
|
||||
@@ -54,6 +59,7 @@
|
||||
#include "util/module.h"
|
||||
#include "services/listen_dnsport.h"
|
||||
#include "services/cache/rrset.h"
|
||||
#include "services/cache/infra.h"
|
||||
#include "services/mesh.h"
|
||||
#include "services/localzone.h"
|
||||
#include "util/storage/slabhash.h"
|
||||
@@ -64,6 +70,7 @@
|
||||
#include "validator/val_kentry.h"
|
||||
#include "iterator/iterator.h"
|
||||
#include "iterator/iter_fwd.h"
|
||||
#include "iterator/iter_hints.h"
|
||||
#include "iterator/iter_delegpt.h"
|
||||
#include "services/outbound_list.h"
|
||||
#include "services/outside_network.h"
|
||||
@@ -311,7 +318,7 @@ struct listen_port* daemon_remote_open_ports(struct config_file* cfg)
|
||||
struct listen_port* l = NULL;
|
||||
log_assert(cfg->remote_control_enable && cfg->control_port);
|
||||
if(cfg->control_ifs) {
|
||||
struct config_strlist* p = cfg->control_ifs;
|
||||
struct config_strlist* p;
|
||||
for(p = cfg->control_ifs; p; p = p->next) {
|
||||
if(!add_open(p->str, cfg->control_port, &l, 1)) {
|
||||
listening_ports_free(l);
|
||||
@@ -388,7 +395,6 @@ int remote_accept_callback(struct comm_point* c, void* arg, int err,
|
||||
/* create new commpoint unless we are servicing already */
|
||||
if(rc->active >= rc->max_active) {
|
||||
log_warn("drop incoming remote control: too many connections");
|
||||
comm_point_stop_listening(c);
|
||||
close_exit:
|
||||
#ifndef USE_WINSOCK
|
||||
close(newfd);
|
||||
@@ -422,6 +428,7 @@ int remote_accept_callback(struct comm_point* c, void* arg, int err,
|
||||
n->ssl = SSL_new(rc->ctx);
|
||||
if(!n->ssl) {
|
||||
log_crypto_err("could not SSL_new");
|
||||
comm_point_delete(n->c);
|
||||
free(n);
|
||||
goto close_exit;
|
||||
}
|
||||
@@ -430,6 +437,7 @@ int remote_accept_callback(struct comm_point* c, void* arg, int err,
|
||||
if(!SSL_set_fd(n->ssl, newfd)) {
|
||||
log_crypto_err("could not SSL_set_fd");
|
||||
SSL_free(n->ssl);
|
||||
comm_point_delete(n->c);
|
||||
free(n);
|
||||
goto close_exit;
|
||||
}
|
||||
@@ -599,12 +607,15 @@ print_stats(SSL* ssl, const char* nm, struct stats_info* s)
|
||||
- s->svr.num_queries_missed_cache))) return 0;
|
||||
if(!ssl_printf(ssl, "%s.num.cachemiss"SQ"%u\n", nm,
|
||||
(unsigned)s->svr.num_queries_missed_cache)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.num.prefetch"SQ"%u\n", nm,
|
||||
(unsigned)s->svr.num_queries_prefetch)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.num.recursivereplies"SQ"%u\n", nm,
|
||||
(unsigned)s->mesh_replies_sent)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.requestlist.avg"SQ"%g\n", nm,
|
||||
s->svr.num_queries_missed_cache?
|
||||
(s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
|
||||
(double)s->svr.sum_query_list_size/
|
||||
s->svr.num_queries_missed_cache : 0.0)) return 0;
|
||||
(s->svr.num_queries_missed_cache+
|
||||
s->svr.num_queries_prefetch) : 0.0)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.requestlist.max"SQ"%u\n", nm,
|
||||
(unsigned)s->svr.max_query_list_size)) return 0;
|
||||
if(!ssl_printf(ssl, "%s.requestlist.overwritten"SQ"%u\n", nm,
|
||||
@@ -692,13 +703,14 @@ print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon)
|
||||
|
||||
/** print uptime stats */
|
||||
static int
|
||||
print_uptime(SSL* ssl, struct worker* worker)
|
||||
print_uptime(SSL* ssl, struct worker* worker, int reset)
|
||||
{
|
||||
struct timeval now = *worker->env.now_tv;
|
||||
struct timeval up, dt;
|
||||
timeval_subtract(&up, &now, &worker->daemon->time_boot);
|
||||
timeval_subtract(&dt, &now, &worker->daemon->time_last_stat);
|
||||
worker->daemon->time_last_stat = now;
|
||||
if(reset)
|
||||
worker->daemon->time_last_stat = now;
|
||||
if(!ssl_printf(ssl, "time.now"SQ"%d.%6.6d\n",
|
||||
(unsigned)now.tv_sec, (unsigned)now.tv_usec)) return 0;
|
||||
if(!ssl_printf(ssl, "time.up"SQ"%d.%6.6d\n",
|
||||
@@ -868,6 +880,7 @@ do_stats(SSL* ssl, struct daemon_remote* rc, int reset)
|
||||
struct stats_info total;
|
||||
struct stats_info s;
|
||||
int i;
|
||||
log_assert(daemon->num > 0);
|
||||
/* gather all thread statistics in one place */
|
||||
for(i=0; i<daemon->num; i++) {
|
||||
server_stats_obtain(rc->worker, daemon->workers[i], &s, reset);
|
||||
@@ -881,7 +894,7 @@ do_stats(SSL* ssl, struct daemon_remote* rc, int reset)
|
||||
total.mesh_time_median /= (double)daemon->num;
|
||||
if(!print_stats(ssl, "total", &total))
|
||||
return;
|
||||
if(!print_uptime(ssl, rc->worker))
|
||||
if(!print_uptime(ssl, rc->worker, reset))
|
||||
return;
|
||||
if(daemon->cfg->stat_extended) {
|
||||
if(!print_mem(ssl, rc->worker, daemon))
|
||||
@@ -1051,6 +1064,9 @@ do_cache_remove(struct worker* worker, uint8_t* nm, size_t nmlen,
|
||||
hashvalue_t h;
|
||||
struct query_info k;
|
||||
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen, t, c, 0);
|
||||
if(t == LDNS_RR_TYPE_SOA)
|
||||
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen, t, c,
|
||||
PACKED_RRSET_SOA_NEG);
|
||||
k.qname = nm;
|
||||
k.qname_len = nmlen;
|
||||
k.qtype = t;
|
||||
@@ -1087,6 +1103,25 @@ do_flush_stats(SSL* ssl, struct worker* worker)
|
||||
send_ok(ssl);
|
||||
}
|
||||
|
||||
/** flush infra cache */
|
||||
static void
|
||||
do_flush_infra(SSL* ssl, struct worker* worker, char* arg)
|
||||
{
|
||||
struct sockaddr_storage addr;
|
||||
socklen_t len;
|
||||
if(strcmp(arg, "all") == 0) {
|
||||
slabhash_clear(worker->env.infra_cache->hosts);
|
||||
send_ok(ssl);
|
||||
return;
|
||||
}
|
||||
if(!ipstrtoaddr(arg, UNBOUND_DNS_PORT, &addr, &len)) {
|
||||
(void)ssl_printf(ssl, "error parsing ip addr: '%s'\n", arg);
|
||||
return;
|
||||
}
|
||||
infra_remove_host(worker->env.infra_cache, &addr, len);
|
||||
send_ok(ssl);
|
||||
}
|
||||
|
||||
/** flush requestlist */
|
||||
static void
|
||||
do_flush_requestlist(SSL* ssl, struct worker* worker)
|
||||
@@ -1107,6 +1142,8 @@ struct del_info {
|
||||
size_t len;
|
||||
/** labels */
|
||||
int labs;
|
||||
/** now */
|
||||
uint32_t now;
|
||||
/** time to invalidate to */
|
||||
uint32_t expired;
|
||||
/** number of rrsets removed */
|
||||
@@ -1127,8 +1164,10 @@ zone_del_rrset(struct lruhash_entry* e, void* arg)
|
||||
if(dname_subdomain_c(k->rk.dname, inf->name)) {
|
||||
struct packed_rrset_data* d =
|
||||
(struct packed_rrset_data*)e->data;
|
||||
d->ttl = inf->expired;
|
||||
inf->num_rrsets++;
|
||||
if(d->ttl >= inf->now) {
|
||||
d->ttl = inf->expired;
|
||||
inf->num_rrsets++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1141,8 +1180,10 @@ zone_del_msg(struct lruhash_entry* e, void* arg)
|
||||
struct msgreply_entry* k = (struct msgreply_entry*)e->key;
|
||||
if(dname_subdomain_c(k->key.qname, inf->name)) {
|
||||
struct reply_info* d = (struct reply_info*)e->data;
|
||||
d->ttl = inf->expired;
|
||||
inf->num_msgs++;
|
||||
if(d->ttl >= inf->now) {
|
||||
d->ttl = inf->expired;
|
||||
inf->num_msgs++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1155,8 +1196,10 @@ zone_del_kcache(struct lruhash_entry* e, void* arg)
|
||||
struct key_entry_key* k = (struct key_entry_key*)e->key;
|
||||
if(dname_subdomain_c(k->name, inf->name)) {
|
||||
struct key_entry_data* d = (struct key_entry_data*)e->data;
|
||||
d->ttl = inf->expired;
|
||||
inf->num_keys++;
|
||||
if(d->ttl >= inf->now) {
|
||||
d->ttl = inf->expired;
|
||||
inf->num_keys++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1176,6 +1219,7 @@ do_flush_zone(SSL* ssl, struct worker* worker, char* arg)
|
||||
inf.name = nm;
|
||||
inf.len = nmlen;
|
||||
inf.labs = nmlabs;
|
||||
inf.now = *worker->env.now;
|
||||
inf.expired = *worker->env.now;
|
||||
inf.expired -= 3; /* handle 3 seconds skew between threads */
|
||||
inf.num_rrsets = 0;
|
||||
@@ -1223,20 +1267,24 @@ do_flush_name(SSL* ssl, struct worker* w, char* arg)
|
||||
send_ok(ssl);
|
||||
}
|
||||
|
||||
/** print root forwards */
|
||||
/** printout a delegation point info */
|
||||
static int
|
||||
print_root_fwds(SSL* ssl, struct iter_forwards* fwds, uint8_t* root)
|
||||
ssl_print_name_dp(SSL* ssl, char* str, uint8_t* nm, uint16_t dclass,
|
||||
struct delegpt* dp)
|
||||
{
|
||||
char buf[257];
|
||||
struct delegpt* dp;
|
||||
struct delegpt_ns* ns;
|
||||
struct delegpt_addr* a;
|
||||
int f = 0;
|
||||
dp = forwards_lookup(fwds, root, LDNS_RR_CLASS_IN);
|
||||
if(!dp)
|
||||
return ssl_printf(ssl, "off (using root hints)\n");
|
||||
/* if dp is returned it must be the root */
|
||||
log_assert(query_dname_compare(dp->name, root)==0);
|
||||
if(str) { /* print header for forward, stub */
|
||||
char* c = ldns_rr_class2str(dclass);
|
||||
dname_str(nm, buf);
|
||||
if(!ssl_printf(ssl, "%s %s %s: ", buf, c, str)) {
|
||||
free(c);
|
||||
return 0;
|
||||
}
|
||||
free(c);
|
||||
}
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
dname_str(ns->name, buf);
|
||||
if(!ssl_printf(ssl, "%s%s", (f?" ":""), buf))
|
||||
@@ -1252,6 +1300,20 @@ print_root_fwds(SSL* ssl, struct iter_forwards* fwds, uint8_t* root)
|
||||
return ssl_printf(ssl, "\n");
|
||||
}
|
||||
|
||||
|
||||
/** print root forwards */
|
||||
static int
|
||||
print_root_fwds(SSL* ssl, struct iter_forwards* fwds, uint8_t* root)
|
||||
{
|
||||
struct delegpt* dp;
|
||||
dp = forwards_lookup(fwds, root, LDNS_RR_CLASS_IN);
|
||||
if(!dp)
|
||||
return ssl_printf(ssl, "off (using root hints)\n");
|
||||
/* if dp is returned it must be the root */
|
||||
log_assert(query_dname_compare(dp->name, root)==0);
|
||||
return ssl_print_name_dp(ssl, NULL, root, LDNS_RR_CLASS_IN, dp);
|
||||
}
|
||||
|
||||
/** parse args into delegpt */
|
||||
static struct delegpt*
|
||||
parse_delegpt(SSL* ssl, struct regional* region, char* args, uint8_t* root)
|
||||
@@ -1280,7 +1342,7 @@ parse_delegpt(SSL* ssl, struct regional* region, char* args, uint8_t* root)
|
||||
return NULL;
|
||||
}
|
||||
/* add address */
|
||||
if(!delegpt_add_addr(dp, region, &addr, addrlen, 0, 0, 1)) {
|
||||
if(!delegpt_add_addr(dp, region, &addr, addrlen, 0, 0)) {
|
||||
(void)ssl_printf(ssl, "error out of memory\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -1457,8 +1519,214 @@ do_dump_requestlist(SSL* ssl, struct worker* worker)
|
||||
}
|
||||
}
|
||||
|
||||
/** structure for argument data for dump infra host */
|
||||
struct infra_arg {
|
||||
/** the infra cache */
|
||||
struct infra_cache* infra;
|
||||
/** the SSL connection */
|
||||
SSL* ssl;
|
||||
/** the time now */
|
||||
uint32_t now;
|
||||
/** ipstr */
|
||||
char* ipstr;
|
||||
};
|
||||
|
||||
/** callback for every lame element in the infra cache */
|
||||
static void
|
||||
dump_infra_lame(struct lruhash_entry* e, void* arg)
|
||||
{
|
||||
struct infra_arg* a = (struct infra_arg*)arg;
|
||||
struct infra_lame_key* k = (struct infra_lame_key*)e->key;
|
||||
struct infra_lame_data* d = (struct infra_lame_data*)e->data;
|
||||
ldns_rdf* rdf;
|
||||
size_t pos = 0;
|
||||
char* nm;
|
||||
/* skip expired */
|
||||
if(d->ttl < a->now) {
|
||||
return;
|
||||
}
|
||||
/* use ldns print for domain name */
|
||||
if(ldns_wire2dname(&rdf, k->zonename, k->namelen, &pos)
|
||||
!= LDNS_STATUS_OK)
|
||||
return;
|
||||
nm = ldns_rdf2str(rdf);
|
||||
ldns_rdf_deep_free(rdf);
|
||||
if(!ssl_printf(a->ssl, "%s lame %s ttl %d dnssec %d rec %d "
|
||||
"A %d other %d\n", a->ipstr, nm, (int)(d->ttl - a->now),
|
||||
d->isdnsseclame, d->rec_lame, d->lame_type_A, d->lame_other)) {
|
||||
free(nm);
|
||||
return;
|
||||
}
|
||||
free(nm);
|
||||
}
|
||||
|
||||
/** callback for every host element in the infra cache */
|
||||
static void
|
||||
dump_infra_host(struct lruhash_entry* e, void* arg)
|
||||
{
|
||||
struct infra_arg* a = (struct infra_arg*)arg;
|
||||
struct infra_host_key* k = (struct infra_host_key*)e->key;
|
||||
struct infra_host_data* d = (struct infra_host_data*)e->data;
|
||||
char ip_str[1024];
|
||||
addr_to_str(&k->addr, k->addrlen, ip_str, sizeof(ip_str));
|
||||
a->ipstr = ip_str;
|
||||
/* skip expired stuff (only backed off) */
|
||||
if(d->ttl < a->now) {
|
||||
if(d->rtt.rto >= USEFUL_SERVER_TOP_TIMEOUT) {
|
||||
if(!ssl_printf(a->ssl, "%s expired rto %d\n", ip_str,
|
||||
d->rtt.rto)) return;
|
||||
}
|
||||
if(d->lameness)
|
||||
lruhash_traverse(d->lameness, 0, &dump_infra_lame, arg);
|
||||
return;
|
||||
}
|
||||
if(!ssl_printf(a->ssl, "%s ttl %d ping %d var %d rtt %d rto %d "
|
||||
"ednsknown %d edns %d delay %d\n",
|
||||
ip_str, (int)(d->ttl - a->now),
|
||||
d->rtt.srtt, d->rtt.rttvar, rtt_notimeout(&d->rtt), d->rtt.rto,
|
||||
(int)d->edns_lame_known, (int)d->edns_version,
|
||||
(int)(a->now<d->probedelay?d->probedelay-a->now:0)))
|
||||
return;
|
||||
if(d->lameness)
|
||||
lruhash_traverse(d->lameness, 0, &dump_infra_lame, arg);
|
||||
}
|
||||
|
||||
/** do the dump_infra command */
|
||||
static void
|
||||
do_dump_infra(SSL* ssl, struct worker* worker)
|
||||
{
|
||||
struct infra_arg arg;
|
||||
arg.infra = worker->env.infra_cache;
|
||||
arg.ssl = ssl;
|
||||
arg.now = *worker->env.now;
|
||||
slabhash_traverse(arg.infra->hosts, 0, &dump_infra_host, (void*)&arg);
|
||||
}
|
||||
|
||||
/** do the log_reopen command */
|
||||
static void
|
||||
do_log_reopen(SSL* ssl, struct worker* worker)
|
||||
{
|
||||
struct config_file* cfg = worker->env.cfg;
|
||||
send_ok(ssl);
|
||||
log_init(cfg->logfile, cfg->use_syslog, cfg->chrootdir);
|
||||
}
|
||||
|
||||
/** do the set_option command */
|
||||
static void
|
||||
do_set_option(SSL* ssl, struct worker* worker, char* arg)
|
||||
{
|
||||
char* arg2;
|
||||
if(!find_arg2(ssl, arg, &arg2))
|
||||
return;
|
||||
if(!config_set_option(worker->env.cfg, arg, arg2)) {
|
||||
(void)ssl_printf(ssl, "error setting option\n");
|
||||
return;
|
||||
}
|
||||
send_ok(ssl);
|
||||
}
|
||||
|
||||
/* routine to printout option values over SSL */
|
||||
void remote_get_opt_ssl(char* line, void* arg)
|
||||
{
|
||||
SSL* ssl = (SSL*)arg;
|
||||
(void)ssl_printf(ssl, "%s\n", line);
|
||||
}
|
||||
|
||||
/** do the get_option command */
|
||||
static void
|
||||
do_get_option(SSL* ssl, struct worker* worker, char* arg)
|
||||
{
|
||||
int r;
|
||||
r = config_get_option(worker->env.cfg, arg, remote_get_opt_ssl, ssl);
|
||||
if(!r) {
|
||||
(void)ssl_printf(ssl, "error unknown option\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/** do the list_forwards command */
|
||||
static void
|
||||
do_list_forwards(SSL* ssl, struct worker* worker)
|
||||
{
|
||||
/* since its a per-worker structure no locks needed */
|
||||
struct iter_forwards* fwds = worker->env.fwds;
|
||||
struct iter_forward_zone* z;
|
||||
RBTREE_FOR(z, struct iter_forward_zone*, fwds->tree) {
|
||||
if(!z->dp) continue; /* skip empty marker for stub */
|
||||
if(!ssl_print_name_dp(ssl, "forward", z->name, z->dclass,
|
||||
z->dp))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/** do the list_stubs command */
|
||||
static void
|
||||
do_list_stubs(SSL* ssl, struct worker* worker)
|
||||
{
|
||||
/* readonly structure */
|
||||
int m;
|
||||
struct iter_hints_stub* z;
|
||||
struct iter_env* ie;
|
||||
m = modstack_find(&worker->env.mesh->mods, "iterator");
|
||||
if(m == -1) {
|
||||
(void)ssl_printf(ssl, "error no iterator module\n");
|
||||
return;
|
||||
}
|
||||
ie = (struct iter_env*)worker->env.modinfo[m];
|
||||
RBTREE_FOR(z, struct iter_hints_stub*, &ie->hints->tree) {
|
||||
if(!ssl_print_name_dp(ssl,
|
||||
z->noprime?"stub noprime":"stub prime", z->node.name,
|
||||
z->node.dclass, z->dp))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/** do the list_local_zones command */
|
||||
static void
|
||||
do_list_local_zones(SSL* ssl, struct worker* worker)
|
||||
{
|
||||
struct local_zones* zones = worker->daemon->local_zones;
|
||||
struct local_zone* z;
|
||||
char buf[257];
|
||||
lock_quick_lock(&zones->lock);
|
||||
RBTREE_FOR(z, struct local_zone*, &zones->ztree) {
|
||||
lock_rw_rdlock(&z->lock);
|
||||
dname_str(z->name, buf);
|
||||
(void)ssl_printf(ssl, "%s %s\n", buf,
|
||||
local_zone_type2str(z->type));
|
||||
lock_rw_unlock(&z->lock);
|
||||
}
|
||||
lock_quick_unlock(&zones->lock);
|
||||
}
|
||||
|
||||
/** do the list_local_data command */
|
||||
static void
|
||||
do_list_local_data(SSL* ssl, struct worker* worker)
|
||||
{
|
||||
struct local_zones* zones = worker->daemon->local_zones;
|
||||
struct local_zone* z;
|
||||
struct local_data* d;
|
||||
struct local_rrset* p;
|
||||
lock_quick_lock(&zones->lock);
|
||||
RBTREE_FOR(z, struct local_zone*, &zones->ztree) {
|
||||
lock_rw_rdlock(&z->lock);
|
||||
RBTREE_FOR(d, struct local_data*, &z->data) {
|
||||
for(p = d->rrsets; p; p = p->next) {
|
||||
ldns_rr_list* rr = packed_rrset_to_rr_list(
|
||||
p->rrset, worker->env.scratch_buffer);
|
||||
char* str = ldns_rr_list2str(rr);
|
||||
(void)ssl_printf(ssl, "%s", str);
|
||||
free(str);
|
||||
ldns_rr_list_free(rr);
|
||||
}
|
||||
}
|
||||
lock_rw_unlock(&z->lock);
|
||||
}
|
||||
lock_quick_unlock(&zones->lock);
|
||||
}
|
||||
|
||||
/** tell other processes to execute the command */
|
||||
void
|
||||
static void
|
||||
distribute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd)
|
||||
{
|
||||
int i;
|
||||
@@ -1476,50 +1744,69 @@ distribute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd)
|
||||
}
|
||||
}
|
||||
|
||||
/** check for name with end-of-string, space or tab after it */
|
||||
static int
|
||||
cmdcmp(char* p, const char* cmd, size_t len)
|
||||
{
|
||||
return strncmp(p,cmd,len)==0 && (p[len]==0||p[len]==' '||p[len]=='\t');
|
||||
}
|
||||
|
||||
/** execute a remote control command */
|
||||
static void
|
||||
execute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd,
|
||||
struct worker* worker)
|
||||
{
|
||||
char* p = skipwhite(cmd);
|
||||
/* compare command - check longer strings first in case of substrings*/
|
||||
if(strncmp(p, "stop", 4) == 0) {
|
||||
/* compare command */
|
||||
if(cmdcmp(p, "stop", 4)) {
|
||||
do_stop(ssl, rc);
|
||||
return;
|
||||
} else if(strncmp(p, "reload", 6) == 0) {
|
||||
} else if(cmdcmp(p, "reload", 6)) {
|
||||
do_reload(ssl, rc);
|
||||
return;
|
||||
} else if(strncmp(p, "stats_noreset", 13) == 0) {
|
||||
} else if(cmdcmp(p, "stats_noreset", 13)) {
|
||||
do_stats(ssl, rc, 0);
|
||||
return;
|
||||
} else if(strncmp(p, "stats", 5) == 0) {
|
||||
} else if(cmdcmp(p, "stats", 5)) {
|
||||
do_stats(ssl, rc, 1);
|
||||
return;
|
||||
} else if(strncmp(p, "status", 6) == 0) {
|
||||
} else if(cmdcmp(p, "status", 6)) {
|
||||
do_status(ssl, worker);
|
||||
return;
|
||||
} else if(strncmp(p, "dump_cache", 10) == 0) {
|
||||
} else if(cmdcmp(p, "dump_cache", 10)) {
|
||||
(void)dump_cache(ssl, worker);
|
||||
return;
|
||||
} else if(strncmp(p, "load_cache", 10) == 0) {
|
||||
} else if(cmdcmp(p, "load_cache", 10)) {
|
||||
if(load_cache(ssl, worker)) send_ok(ssl);
|
||||
return;
|
||||
} else if(strncmp(p, "forward", 7) == 0) {
|
||||
} else if(cmdcmp(p, "list_forwards", 13)) {
|
||||
do_list_forwards(ssl, worker);
|
||||
return;
|
||||
} else if(cmdcmp(p, "list_stubs", 10)) {
|
||||
do_list_stubs(ssl, worker);
|
||||
return;
|
||||
} else if(cmdcmp(p, "list_local_zones", 16)) {
|
||||
do_list_local_zones(ssl, worker);
|
||||
return;
|
||||
} else if(cmdcmp(p, "list_local_data", 15)) {
|
||||
do_list_local_data(ssl, worker);
|
||||
return;
|
||||
} else if(cmdcmp(p, "forward", 7)) {
|
||||
/* must always distribute this cmd */
|
||||
if(rc) distribute_cmd(rc, ssl, cmd);
|
||||
do_forward(ssl, worker, skipwhite(p+7));
|
||||
return;
|
||||
} else if(strncmp(p, "flush_stats", 11) == 0) {
|
||||
} else if(cmdcmp(p, "flush_stats", 11)) {
|
||||
/* must always distribute this cmd */
|
||||
if(rc) distribute_cmd(rc, ssl, cmd);
|
||||
do_flush_stats(ssl, worker);
|
||||
return;
|
||||
} else if(strncmp(p, "flush_requestlist", 17) == 0) {
|
||||
} else if(cmdcmp(p, "flush_requestlist", 17)) {
|
||||
/* must always distribute this cmd */
|
||||
if(rc) distribute_cmd(rc, ssl, cmd);
|
||||
do_flush_requestlist(ssl, worker);
|
||||
return;
|
||||
} else if(strncmp(p, "lookup", 6) == 0) {
|
||||
} else if(cmdcmp(p, "lookup", 6)) {
|
||||
do_lookup(ssl, worker, skipwhite(p+6));
|
||||
return;
|
||||
}
|
||||
@@ -1532,24 +1819,34 @@ execute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd,
|
||||
distribute_cmd(rc, ssl, cmd);
|
||||
}
|
||||
#endif
|
||||
if(strncmp(p, "verbosity", 9) == 0) {
|
||||
if(cmdcmp(p, "verbosity", 9)) {
|
||||
do_verbosity(ssl, skipwhite(p+9));
|
||||
} else if(strncmp(p, "local_zone_remove", 17) == 0) {
|
||||
} else if(cmdcmp(p, "local_zone_remove", 17)) {
|
||||
do_zone_remove(ssl, worker, skipwhite(p+17));
|
||||
} else if(strncmp(p, "local_zone", 10) == 0) {
|
||||
} else if(cmdcmp(p, "local_zone", 10)) {
|
||||
do_zone_add(ssl, worker, skipwhite(p+10));
|
||||
} else if(strncmp(p, "local_data_remove", 17) == 0) {
|
||||
} else if(cmdcmp(p, "local_data_remove", 17)) {
|
||||
do_data_remove(ssl, worker, skipwhite(p+17));
|
||||
} else if(strncmp(p, "local_data", 10) == 0) {
|
||||
} else if(cmdcmp(p, "local_data", 10)) {
|
||||
do_data_add(ssl, worker, skipwhite(p+10));
|
||||
} else if(strncmp(p, "flush_zone", 10) == 0) {
|
||||
} else if(cmdcmp(p, "flush_zone", 10)) {
|
||||
do_flush_zone(ssl, worker, skipwhite(p+10));
|
||||
} else if(strncmp(p, "flush_type", 10) == 0) {
|
||||
} else if(cmdcmp(p, "flush_type", 10)) {
|
||||
do_flush_type(ssl, worker, skipwhite(p+10));
|
||||
} else if(strncmp(p, "flush", 5) == 0) {
|
||||
} else if(cmdcmp(p, "flush_infra", 11)) {
|
||||
do_flush_infra(ssl, worker, skipwhite(p+11));
|
||||
} else if(cmdcmp(p, "flush", 5)) {
|
||||
do_flush_name(ssl, worker, skipwhite(p+5));
|
||||
} else if(strncmp(p, "dump_requestlist", 16) == 0) {
|
||||
} else if(cmdcmp(p, "dump_requestlist", 16)) {
|
||||
do_dump_requestlist(ssl, worker);
|
||||
} else if(cmdcmp(p, "dump_infra", 10)) {
|
||||
do_dump_infra(ssl, worker);
|
||||
} else if(cmdcmp(p, "log_reopen", 10)) {
|
||||
do_log_reopen(ssl, worker);
|
||||
} else if(cmdcmp(p, "set_option", 10)) {
|
||||
do_set_option(ssl, worker, skipwhite(p+10));
|
||||
} else if(cmdcmp(p, "get_option", 10)) {
|
||||
do_get_option(ssl, worker, skipwhite(p+10));
|
||||
} else {
|
||||
(void)ssl_printf(ssl, "error unknown command '%s'\n", p);
|
||||
}
|
||||
@@ -1575,7 +1872,8 @@ static void
|
||||
handle_req(struct daemon_remote* rc, struct rc_state* s, SSL* ssl)
|
||||
{
|
||||
int r;
|
||||
char magic[5];
|
||||
char pre[10];
|
||||
char magic[7];
|
||||
char buf[1024];
|
||||
#ifdef USE_WINSOCK
|
||||
/* makes it possible to set the socket blocking again. */
|
||||
@@ -1584,7 +1882,7 @@ handle_req(struct daemon_remote* rc, struct rc_state* s, SSL* ssl)
|
||||
#endif
|
||||
fd_set_block(s->c->fd);
|
||||
|
||||
/* try to read magic UBCT string */
|
||||
/* try to read magic UBCT[version]_space_ string */
|
||||
ERR_clear_error();
|
||||
if((r=SSL_read(ssl, magic, (int)sizeof(magic)-1)) <= 0) {
|
||||
if(SSL_get_error(ssl, r) == SSL_ERROR_ZERO_RETURN)
|
||||
@@ -1592,9 +1890,10 @@ handle_req(struct daemon_remote* rc, struct rc_state* s, SSL* ssl)
|
||||
log_crypto_err("could not SSL_read");
|
||||
return;
|
||||
}
|
||||
magic[4] = 0;
|
||||
if( r != 4 || strcmp(magic, "UBCT") != 0) {
|
||||
magic[6] = 0;
|
||||
if( r != 6 || strncmp(magic, "UBCT", 4) != 0) {
|
||||
verbose(VERB_QUERY, "control connection has bad magic string");
|
||||
/* probably wrong tool connected, ignore it completely */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1602,6 +1901,13 @@ handle_req(struct daemon_remote* rc, struct rc_state* s, SSL* ssl)
|
||||
if(!ssl_read_line(ssl, buf, sizeof(buf))) {
|
||||
return;
|
||||
}
|
||||
snprintf(pre, sizeof(pre), "UBCT%d ", UNBOUND_CONTROL_VERSION);
|
||||
if(strcmp(magic, pre) != 0) {
|
||||
verbose(VERB_QUERY, "control connection had bad "
|
||||
"version %s, cmd: %s", magic, buf);
|
||||
ssl_printf(ssl, "error version mismatch\n");
|
||||
return;
|
||||
}
|
||||
verbose(VERB_DETAIL, "control cmd: %s", buf);
|
||||
|
||||
/* figure out what to do */
|
||||
@@ -1624,8 +1930,8 @@ int remote_control_callback(struct comm_point* c, void* arg, int err,
|
||||
ERR_clear_error();
|
||||
r = SSL_do_handshake(s->ssl);
|
||||
if(r != 1) {
|
||||
r = SSL_get_error(s->ssl, r);
|
||||
if(r == SSL_ERROR_WANT_READ) {
|
||||
int r2 = SSL_get_error(s->ssl, r);
|
||||
if(r2 == SSL_ERROR_WANT_READ) {
|
||||
if(s->shake_state == rc_hs_read) {
|
||||
/* try again later */
|
||||
return 0;
|
||||
@@ -1633,7 +1939,7 @@ int remote_control_callback(struct comm_point* c, void* arg, int err,
|
||||
s->shake_state = rc_hs_read;
|
||||
comm_point_listen_for_rw(c, 1, 0);
|
||||
return 0;
|
||||
} else if(r == SSL_ERROR_WANT_WRITE) {
|
||||
} else if(r2 == SSL_ERROR_WANT_WRITE) {
|
||||
if(s->shake_state == rc_hs_write) {
|
||||
/* try again later */
|
||||
return 0;
|
||||
@@ -1642,6 +1948,10 @@ int remote_control_callback(struct comm_point* c, void* arg, int err,
|
||||
comm_point_listen_for_rw(c, 0, 1);
|
||||
return 0;
|
||||
} else {
|
||||
if(r == 0)
|
||||
log_err("remote control connection closed prematurely");
|
||||
log_addr(1, "failed connection from",
|
||||
&s->c->repinfo.addr, s->c->repinfo.addrlen);
|
||||
log_crypto_err("remote control failed ssl");
|
||||
clean_point(rc, s);
|
||||
return 0;
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
|
||||
#ifndef DAEMON_REMOTE_H
|
||||
#define DAEMON_REMOTE_H
|
||||
#ifdef HAVE_OPENSSL_SSL_H
|
||||
#include "openssl/ssl.h"
|
||||
#endif
|
||||
struct config_file;
|
||||
struct listen_list;
|
||||
struct listen_port;
|
||||
@@ -171,4 +174,7 @@ int ssl_printf(SSL* ssl, const char* format, ...)
|
||||
*/
|
||||
int ssl_read_line(SSL* ssl, char* buf, size_t max);
|
||||
|
||||
/** routine to printout option values over SSL */
|
||||
void remote_get_opt_ssl(char* line, void* arg);
|
||||
|
||||
#endif /* DAEMON_REMOTE_H */
|
||||
|
||||
+21
-6
@@ -40,6 +40,7 @@
|
||||
* numbers. These 'statistics' may be of interest to the operator.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/wire2host.h"
|
||||
#include "daemon/stats.h"
|
||||
#include "daemon/worker.h"
|
||||
#include "daemon/daemon.h"
|
||||
@@ -79,21 +80,34 @@ void server_stats_querymiss(struct server_stats* stats, struct worker* worker)
|
||||
stats->max_query_list_size = worker->env.mesh->all.count;
|
||||
}
|
||||
|
||||
void server_stats_prefetch(struct server_stats* stats, struct worker* worker)
|
||||
{
|
||||
stats->num_queries_prefetch++;
|
||||
/* changes the query list size so account that, like a querymiss */
|
||||
stats->sum_query_list_size += worker->env.mesh->all.count;
|
||||
if(worker->env.mesh->all.count > stats->max_query_list_size)
|
||||
stats->max_query_list_size = worker->env.mesh->all.count;
|
||||
}
|
||||
|
||||
void server_stats_log(struct server_stats* stats, struct worker* worker,
|
||||
int threadnum)
|
||||
{
|
||||
log_info("server stats for thread %d: %u queries, "
|
||||
"%u answers from cache, %u recursions",
|
||||
"%u answers from cache, %u recursions, %u prefetch",
|
||||
threadnum, (unsigned)stats->num_queries,
|
||||
(unsigned)(stats->num_queries -
|
||||
stats->num_queries_missed_cache),
|
||||
(unsigned)stats->num_queries_missed_cache);
|
||||
(unsigned)stats->num_queries_missed_cache,
|
||||
(unsigned)stats->num_queries_prefetch);
|
||||
log_info("server stats for thread %d: requestlist max %u avg %g "
|
||||
"exceeded %u", threadnum, (unsigned)stats->max_query_list_size,
|
||||
stats->num_queries_missed_cache?
|
||||
"exceeded %u jostled %u", threadnum,
|
||||
(unsigned)stats->max_query_list_size,
|
||||
(stats->num_queries_missed_cache+stats->num_queries_prefetch)?
|
||||
(double)stats->sum_query_list_size/
|
||||
stats->num_queries_missed_cache : 0.0,
|
||||
(unsigned)worker->env.mesh->stats_dropped);
|
||||
(stats->num_queries_missed_cache+
|
||||
stats->num_queries_prefetch) : 0.0,
|
||||
(unsigned)worker->env.mesh->stats_dropped,
|
||||
(unsigned)worker->env.mesh->stats_jostled);
|
||||
}
|
||||
|
||||
/** get rrsets bogus number from validator */
|
||||
@@ -187,6 +201,7 @@ void server_stats_add(struct stats_info* total, struct stats_info* a)
|
||||
{
|
||||
total->svr.num_queries += a->svr.num_queries;
|
||||
total->svr.num_queries_missed_cache += a->svr.num_queries_missed_cache;
|
||||
total->svr.num_queries_prefetch += a->svr.num_queries_prefetch;
|
||||
total->svr.sum_query_list_size += a->svr.sum_query_list_size;
|
||||
/* the max size reached is upped to higher of both */
|
||||
if(a->svr.max_query_list_size > total->svr.max_query_list_size)
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#ifndef DAEMON_STATS_H
|
||||
#define DAEMON_STATS_H
|
||||
#include "util/timehist.h"
|
||||
#include "ldns/buffer.h"
|
||||
struct worker;
|
||||
struct config_file;
|
||||
struct comm_point;
|
||||
@@ -64,6 +65,8 @@ struct server_stats {
|
||||
size_t num_queries;
|
||||
/** number of queries that had a cache-miss. */
|
||||
size_t num_queries_missed_cache;
|
||||
/** number of prefetch queries - cachehits with prefetch */
|
||||
size_t num_queries_prefetch;
|
||||
|
||||
/**
|
||||
* Sum of the querylistsize of the worker for
|
||||
@@ -166,6 +169,9 @@ void server_stats_init(struct server_stats* stats, struct config_file* cfg);
|
||||
/** add query if it missed the cache */
|
||||
void server_stats_querymiss(struct server_stats* stats, struct worker* worker);
|
||||
|
||||
/** add query if was cached and also resulted in a prefetch */
|
||||
void server_stats_prefetch(struct server_stats* stats, struct worker* worker);
|
||||
|
||||
/** display the stats to the log */
|
||||
void server_stats_log(struct server_stats* stats, struct worker* worker,
|
||||
int threadnum);
|
||||
|
||||
+101
-29
@@ -41,6 +41,10 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include "util/log.h"
|
||||
#include "daemon/daemon.h"
|
||||
#include "daemon/remote.h"
|
||||
@@ -85,10 +89,59 @@
|
||||
/** global debug value to keep track of heap memory allocation */
|
||||
void* unbound_start_brk = 0;
|
||||
|
||||
#if !defined(HAVE_EVENT_BASE_GET_METHOD) && (defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP))
|
||||
static const char* ev_backend2str(int b)
|
||||
{
|
||||
switch(b) {
|
||||
case EVBACKEND_SELECT: return "select";
|
||||
case EVBACKEND_POLL: return "poll";
|
||||
case EVBACKEND_EPOLL: return "epoll";
|
||||
case EVBACKEND_KQUEUE: return "kqueue";
|
||||
case EVBACKEND_DEVPOLL: return "devpoll";
|
||||
case EVBACKEND_PORT: return "evport";
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
#endif
|
||||
|
||||
/** get the event system in use */
|
||||
static void get_event_sys(const char** n, const char** s, const char** m)
|
||||
{
|
||||
#ifdef USE_WINSOCK
|
||||
*n = "event";
|
||||
*s = "winsock";
|
||||
*m = "WSAWaitForMultipleEvents";
|
||||
#elif defined(USE_MINI_EVENT)
|
||||
*n = "mini-event";
|
||||
*s = "internal";
|
||||
*m = "select";
|
||||
#else
|
||||
struct event_base* b;
|
||||
*s = event_get_version();
|
||||
# ifdef HAVE_EVENT_BASE_GET_METHOD
|
||||
*n = "libevent";
|
||||
b = event_base_new();
|
||||
*m = event_base_get_method(b);
|
||||
# elif defined(HAVE_EV_LOOP) || defined(HAVE_EV_DEFAULT_LOOP)
|
||||
*n = "libev";
|
||||
b = (struct event_base*)ev_default_loop(EVFLAG_AUTO);
|
||||
*m = ev_backend2str(ev_backend((struct ev_loop*)b));
|
||||
# else
|
||||
*n = "unknown";
|
||||
*m = "not obtainable";
|
||||
b = NULL;
|
||||
# endif
|
||||
# ifdef HAVE_EVENT_BASE_FREE
|
||||
event_base_free(b);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/** print usage. */
|
||||
static void usage()
|
||||
{
|
||||
const char** m;
|
||||
const char *evnm="event", *evsys="", *evmethod="";
|
||||
printf("usage: unbound [options]\n");
|
||||
printf(" start unbound daemon DNS resolver.\n");
|
||||
printf("-h this help\n");
|
||||
@@ -102,20 +155,16 @@ static void usage()
|
||||
printf(" service - used to start from services control panel\n");
|
||||
#endif
|
||||
printf("Version %s\n", PACKAGE_VERSION);
|
||||
printf("linked libs: event %s, ldns %s, %s\n",
|
||||
#ifdef USE_WINSOCK
|
||||
"winsock",
|
||||
#elif defined(USE_MINI_EVENT)
|
||||
"internal",
|
||||
#else
|
||||
event_get_version(),
|
||||
#endif
|
||||
ldns_version(),
|
||||
get_event_sys(&evnm, &evsys, &evmethod);
|
||||
printf("linked libs: %s %s (it uses %s), ldns %s, %s\n",
|
||||
evnm, evsys, evmethod, ldns_version(),
|
||||
SSLeay_version(SSLEAY_VERSION));
|
||||
printf("linked modules:");
|
||||
for(m = module_list_avail(); *m; m++)
|
||||
printf(" %s", *m);
|
||||
printf("\n");
|
||||
printf("configured for %s on %s with options:%s\n",
|
||||
CONFIGURE_TARGET, CONFIGURE_DATE, CONFIGURE_BUILD_WITH);
|
||||
printf("BSD licensed, see LICENSE in source package for details.\n");
|
||||
printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
|
||||
}
|
||||
@@ -150,12 +199,41 @@ checkrlimits(struct config_file* cfg)
|
||||
#if !defined(HAVE_PTHREAD) && !defined(HAVE_SOLARIS_THREADS)
|
||||
int numthread = 1; /* it forks */
|
||||
#else
|
||||
int numthread = cfg->num_threads;
|
||||
int numthread = (cfg->num_threads?cfg->num_threads:1);
|
||||
#endif
|
||||
size_t total = numthread * perthread + misc;
|
||||
size_t avail;
|
||||
struct rlimit rlim;
|
||||
|
||||
if(total > 1024 &&
|
||||
strncmp(event_get_version(), "mini-event", 10) == 0) {
|
||||
log_warn("too many file descriptors requested. The builtin"
|
||||
"mini-event cannot handle more than 1024. Config "
|
||||
"for less fds or compile with libevent");
|
||||
if(numthread*perthread_noudp+15 > 1024)
|
||||
fatal_exit("too much tcp. not enough fds.");
|
||||
cfg->outgoing_num_ports = (int)((1024
|
||||
- numthread*perthread_noudp
|
||||
- 10 /* safety margin */) /numthread);
|
||||
log_warn("continuing with less udp ports: %u",
|
||||
cfg->outgoing_num_ports);
|
||||
total = 1024;
|
||||
}
|
||||
if(perthread > 64 &&
|
||||
strncmp(event_get_version(), "winsock-event", 13) == 0) {
|
||||
log_err("too many file descriptors requested. The winsock"
|
||||
" event handler cannot handle more than 64 per "
|
||||
" thread. Config for less fds");
|
||||
if(perthread_noudp+2 > 64)
|
||||
fatal_exit("too much tcp. not enough fds.");
|
||||
cfg->outgoing_num_ports = (int)((64
|
||||
- perthread_noudp
|
||||
- 2/* safety margin */));
|
||||
log_warn("continuing with less udp ports: %u",
|
||||
cfg->outgoing_num_ports);
|
||||
total = numthread*(perthread_noudp+
|
||||
(size_t)cfg->outgoing_num_ports)+misc;
|
||||
}
|
||||
if(getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
|
||||
log_warn("getrlimit: %s", strerror(errno));
|
||||
return;
|
||||
@@ -166,8 +244,12 @@ checkrlimits(struct config_file* cfg)
|
||||
avail = (size_t)rlim.rlim_cur;
|
||||
rlim.rlim_cur = (rlim_t)(total + 10);
|
||||
rlim.rlim_max = (rlim_t)(total + 10);
|
||||
#ifdef HAVE_SETRLIMIT
|
||||
if(setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
|
||||
log_warn("setrlimit: %s", strerror(errno));
|
||||
#else
|
||||
if(1) {
|
||||
#endif
|
||||
log_warn("cannot increase max open fds from %u to %u",
|
||||
(unsigned)avail, (unsigned)total+10);
|
||||
/* check that calculation below does not underflow,
|
||||
@@ -179,27 +261,13 @@ checkrlimits(struct config_file* cfg)
|
||||
- 10 /* safety margin */) /numthread);
|
||||
log_warn("continuing with less udp ports: %u",
|
||||
cfg->outgoing_num_ports);
|
||||
log_warn("increase ulimit or decrease threads, ports in config to remove this warning");
|
||||
log_warn("increase ulimit or decrease threads, "
|
||||
"ports in config to remove this warning");
|
||||
return;
|
||||
}
|
||||
log_warn("increased limit(open files) from %u to %u",
|
||||
(unsigned)avail, (unsigned)total+10);
|
||||
}
|
||||
if(total > 1024 &&
|
||||
strncmp(event_get_version(), "mini-event", 10) == 0) {
|
||||
log_err("too many file descriptors requested. The builtin"
|
||||
"mini-event cannot handle more than 1024. Config "
|
||||
"for less fds or compile with libevent");
|
||||
fatal_exit("configuration needs too many file descriptors");
|
||||
}
|
||||
if(perthread > 64 &&
|
||||
strncmp(event_get_version(), "winsock-event", 13) == 0) {
|
||||
log_err("too many file descriptors requested. The winsock"
|
||||
" event handler cannot handle more than 64 per "
|
||||
" thread. Config for less fds or compile with "
|
||||
" libevent");
|
||||
fatal_exit("configuration needs too many file descriptors");
|
||||
}
|
||||
#else
|
||||
(void)cfg;
|
||||
#endif /* HAVE_GETRLIMIT */
|
||||
@@ -313,7 +381,7 @@ detach(void)
|
||||
if(daemon(1, 0) != 0)
|
||||
fatal_exit("daemon failed: %s", strerror(errno));
|
||||
#else /* no HAVE_DAEMON */
|
||||
#ifdef HAVE_WORKING_FORK
|
||||
#ifdef HAVE_FORK
|
||||
int fd;
|
||||
/* Take off... */
|
||||
switch (fork()) {
|
||||
@@ -337,7 +405,7 @@ detach(void)
|
||||
if (fd > 2)
|
||||
(void)close(fd);
|
||||
}
|
||||
#endif /* HAVE_WORKING_FORK */
|
||||
#endif /* HAVE_FORK */
|
||||
#endif /* HAVE_DAEMON */
|
||||
}
|
||||
|
||||
@@ -415,7 +483,7 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
|
||||
* chown to get permissions */
|
||||
if(cfg->username && cfg->username[0]) {
|
||||
if(chown(daemon->pidfile, uid, gid) == -1) {
|
||||
fatal_exit("cannot chown %u.%u %s: %s",
|
||||
log_err("cannot chown %u.%u %s: %s",
|
||||
(unsigned)uid, (unsigned)gid,
|
||||
daemon->pidfile, strerror(errno));
|
||||
}
|
||||
@@ -607,7 +675,9 @@ main(int argc, char* argv[])
|
||||
const char* winopt = NULL;
|
||||
int cmdline_verbose = 0;
|
||||
int debug_mode = 0;
|
||||
#ifdef UB_ON_WINDOWS
|
||||
int cmdline_cfg = 0;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SBRK
|
||||
/* take debug snapshot of heap */
|
||||
@@ -620,7 +690,9 @@ main(int argc, char* argv[])
|
||||
switch(c) {
|
||||
case 'c':
|
||||
cfgfile = optarg;
|
||||
#ifdef UB_ON_WINDOWS
|
||||
cmdline_cfg = 1;
|
||||
#endif
|
||||
break;
|
||||
case 'v':
|
||||
cmdline_verbose ++;
|
||||
|
||||
+85
-55
@@ -40,6 +40,7 @@
|
||||
* pending requests.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/wire2host.h"
|
||||
#include "util/log.h"
|
||||
#include "util/net_help.h"
|
||||
#include "util/random.h"
|
||||
@@ -82,6 +83,18 @@
|
||||
/** Size of an UDP datagram */
|
||||
#define NORMAL_UDP_SIZE 512 /* bytes */
|
||||
|
||||
/**
|
||||
* seconds to add to prefetch leeway. This is a TTL that expires old rrsets
|
||||
* earlier than they should in order to put the new update into the cache.
|
||||
* This additional value is to make sure that if not all TTLs are equal in
|
||||
* the message to be updated(and replaced), that rrsets with up to this much
|
||||
* extra TTL are also replaced. This means that the resulting new message
|
||||
* will have (most likely) this TTL at least, avoiding very small 'split
|
||||
* second' TTLs due to operators choosing relative primes for TTLs (or so).
|
||||
* Also has to be at least one to break ties (and overwrite cached entry).
|
||||
*/
|
||||
#define PREFETCH_EXPIRY_ADD 60
|
||||
|
||||
#ifdef UNBOUND_ALLOC_STATS
|
||||
/** measure memory leakage */
|
||||
static void
|
||||
@@ -128,7 +141,7 @@ debug_total_mem(size_t calctotal)
|
||||
#endif /* UNBOUND_ALLOC_STATS */
|
||||
|
||||
/** Report on memory usage by this thread and global */
|
||||
void
|
||||
static void
|
||||
worker_mem_report(struct worker* ATTR_UNUSED(worker),
|
||||
struct serviced_query* ATTR_UNUSED(cur_serv))
|
||||
{
|
||||
@@ -165,6 +178,8 @@ worker_mem_report(struct worker* ATTR_UNUSED(worker),
|
||||
+ sizeof(*worker->env.scratch_buffer)
|
||||
+ ldns_buffer_capacity(worker->env.scratch_buffer)
|
||||
+ forwards_get_mem(worker->env.fwds);
|
||||
if(worker->thread_num == 0)
|
||||
me += acl_list_get_mem(worker->daemon->acl);
|
||||
if(cur_serv) {
|
||||
me += serviced_get_mem(cur_serv);
|
||||
}
|
||||
@@ -270,9 +285,10 @@ worker_handle_service_reply(struct comm_point* c, void* arg, int error,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** check request sanity. Returns error code, 0 OK, or -1 discard.
|
||||
/** check request sanity.
|
||||
* @param pkt: the wire packet to examine for sanity.
|
||||
* @param worker: parameters for checking.
|
||||
* @return error code, 0 OK, or -1 discard.
|
||||
*/
|
||||
static int
|
||||
worker_check_request(ldns_buffer* pkt, struct worker* worker)
|
||||
@@ -430,7 +446,8 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
|
||||
uint16_t udpsize = edns->udp_size;
|
||||
int secure = 0;
|
||||
uint32_t timenow = *worker->env.now;
|
||||
int must_validate = !(flags&BIT_CD) && worker->env.need_to_validate;
|
||||
int must_validate = (!(flags&BIT_CD) || worker->env.cfg->ignore_cd)
|
||||
&& worker->env.need_to_validate;
|
||||
struct dns_msg *msg = NULL;
|
||||
struct delegpt *dp;
|
||||
|
||||
@@ -506,7 +523,8 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
|
||||
uint32_t timenow = *worker->env.now;
|
||||
uint16_t udpsize = edns->udp_size;
|
||||
int secure;
|
||||
int must_validate = !(flags&BIT_CD) && worker->env.need_to_validate;
|
||||
int must_validate = (!(flags&BIT_CD) || worker->env.cfg->ignore_cd)
|
||||
&& worker->env.need_to_validate;
|
||||
/* see if it is possible */
|
||||
if(rep->ttl < timenow) {
|
||||
/* the rrsets may have been updated in the meantime.
|
||||
@@ -589,6 +607,24 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Reply to client and perform prefetch to keep cache up to date */
|
||||
static void
|
||||
reply_and_prefetch(struct worker* worker, struct query_info* qinfo,
|
||||
uint16_t flags, struct comm_reply* repinfo, uint32_t leeway)
|
||||
{
|
||||
/* first send answer to client to keep its latency
|
||||
* as small as a cachereply */
|
||||
comm_point_send_reply(repinfo);
|
||||
server_stats_prefetch(&worker->stats, worker);
|
||||
|
||||
/* create the prefetch in the mesh as a normal lookup without
|
||||
* client addrs waiting, which has the cache blacklisted (to bypass
|
||||
* the cache and go to the network for the data). */
|
||||
/* this (potentially) runs the mesh for the new query */
|
||||
mesh_new_prefetch(worker->env.mesh, qinfo, flags, leeway +
|
||||
PREFETCH_EXPIRY_ADD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill CH class answer into buffer. Keeps query.
|
||||
* @param pkt: buffer
|
||||
@@ -703,17 +739,21 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||
worker->stats.unwanted_queries++;
|
||||
return 0;
|
||||
} else if(acl == acl_refuse) {
|
||||
log_addr(VERB_ALGO, "refused query from",
|
||||
&repinfo->addr, repinfo->addrlen);
|
||||
log_buf(VERB_ALGO, "refuse", c->buffer);
|
||||
if(worker->stats.extended)
|
||||
worker->stats.unwanted_queries++;
|
||||
if(worker_check_request(c->buffer, worker) == -1) {
|
||||
comm_point_drop_reply(repinfo);
|
||||
return 0; /* discard this */
|
||||
}
|
||||
ldns_buffer_set_limit(c->buffer, LDNS_HEADER_SIZE);
|
||||
ldns_buffer_write_at(c->buffer, 4,
|
||||
(uint8_t*)"\0\0\0\0\0\0\0\0", 8);
|
||||
LDNS_QR_SET(ldns_buffer_begin(c->buffer));
|
||||
LDNS_RCODE_SET(ldns_buffer_begin(c->buffer),
|
||||
LDNS_RCODE_REFUSED);
|
||||
log_addr(VERB_ALGO, "refused query from",
|
||||
&repinfo->addr, repinfo->addrlen);
|
||||
log_buf(VERB_ALGO, "refuse", c->buffer);
|
||||
if(worker->stats.extended)
|
||||
worker->stats.unwanted_queries++;
|
||||
return 1;
|
||||
}
|
||||
if((ret=worker_check_request(c->buffer, worker)) != 0) {
|
||||
@@ -739,10 +779,16 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||
server_stats_insrcode(&worker->stats, c->buffer);
|
||||
return 1;
|
||||
}
|
||||
if(worker->env.cfg->log_queries) {
|
||||
char ip[128];
|
||||
addr_to_str(&repinfo->addr, repinfo->addrlen, ip, sizeof(ip));
|
||||
log_nametypeclass(0, ip, qinfo.qname, qinfo.qtype, qinfo.qclass);
|
||||
}
|
||||
if(qinfo.qtype == LDNS_RR_TYPE_AXFR ||
|
||||
qinfo.qtype == LDNS_RR_TYPE_IXFR) {
|
||||
verbose(VERB_ALGO, "worker request: refused zone transfer.");
|
||||
log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
|
||||
ldns_buffer_rewind(c->buffer);
|
||||
LDNS_QR_SET(ldns_buffer_begin(c->buffer));
|
||||
LDNS_RCODE_SET(ldns_buffer_begin(c->buffer),
|
||||
LDNS_RCODE_REFUSED);
|
||||
@@ -836,6 +882,17 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||
*(uint16_t*)ldns_buffer_begin(c->buffer),
|
||||
ldns_buffer_read_u16_at(c->buffer, 2), repinfo,
|
||||
&edns)) {
|
||||
/* prefetch it if the prefetch TTL expired */
|
||||
if(worker->env.cfg->prefetch && *worker->env.now >=
|
||||
((struct reply_info*)e->data)->prefetch_ttl) {
|
||||
uint32_t leeway = ((struct reply_info*)e->
|
||||
data)->ttl - *worker->env.now;
|
||||
lock_rw_unlock(&e->lock);
|
||||
reply_and_prefetch(worker, &qinfo,
|
||||
ldns_buffer_read_u16_at(c->buffer, 2),
|
||||
repinfo, leeway);
|
||||
return 0;
|
||||
}
|
||||
lock_rw_unlock(&e->lock);
|
||||
return 1;
|
||||
}
|
||||
@@ -864,14 +921,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||
}
|
||||
|
||||
/* grab a work request structure for this new request */
|
||||
if(worker->env.mesh->num_reply_addrs>worker->request_size*16) {
|
||||
/* protect our memory usage from storing reply addresses */
|
||||
verbose(VERB_ALGO, "Too many requests queued. "
|
||||
"dropping incoming query.");
|
||||
worker->env.mesh->stats_dropped++;
|
||||
comm_point_drop_reply(repinfo);
|
||||
return 0;
|
||||
}
|
||||
mesh_new_client(worker->env.mesh, &qinfo,
|
||||
ldns_buffer_read_u16_at(c->buffer, 2),
|
||||
&edns, repinfo, *(uint16_t*)ldns_buffer_begin(c->buffer));
|
||||
@@ -959,6 +1008,7 @@ void worker_probe_timer_cb(void* arg)
|
||||
struct worker*
|
||||
worker_create(struct daemon* daemon, int id, int* ports, int n)
|
||||
{
|
||||
unsigned int seed;
|
||||
struct worker* worker = (struct worker*)calloc(1,
|
||||
sizeof(struct worker));
|
||||
if(!worker)
|
||||
@@ -976,6 +1026,19 @@ worker_create(struct daemon* daemon, int id, int* ports, int n)
|
||||
free(worker);
|
||||
return NULL;
|
||||
}
|
||||
/* create random state here to avoid locking trouble in RAND_bytes */
|
||||
seed = (unsigned int)time(NULL) ^ (unsigned int)getpid() ^
|
||||
(((unsigned int)worker->thread_num)<<17);
|
||||
/* shift thread_num so it does not match out pid bits */
|
||||
if(!(worker->rndstate = ub_initstate(seed, daemon->rand))) {
|
||||
seed = 0;
|
||||
log_err("could not init random numbers.");
|
||||
tube_delete(worker->cmd);
|
||||
free(worker->ports);
|
||||
free(worker);
|
||||
return NULL;
|
||||
}
|
||||
seed = 0;
|
||||
return worker;
|
||||
}
|
||||
|
||||
@@ -983,7 +1046,6 @@ int
|
||||
worker_init(struct worker* worker, struct config_file *cfg,
|
||||
struct listen_port* ports, int do_sigs)
|
||||
{
|
||||
unsigned int seed;
|
||||
worker->need_to_exit = 0;
|
||||
worker->base = comm_base_create(do_sigs);
|
||||
if(!worker->base) {
|
||||
@@ -1028,16 +1090,6 @@ worker_init(struct worker* worker, struct config_file *cfg,
|
||||
} else { /* !do_sigs */
|
||||
worker->comsig = NULL;
|
||||
}
|
||||
seed = (unsigned int)time(NULL) ^ (unsigned int)getpid() ^
|
||||
(((unsigned int)worker->thread_num)<<17);
|
||||
/* shift thread_num so it does not match out pid bits */
|
||||
if(!(worker->rndstate = ub_initstate(seed, NULL))) {
|
||||
seed = 0;
|
||||
log_err("could not init random numbers.");
|
||||
worker_delete(worker);
|
||||
return 0;
|
||||
}
|
||||
seed = 0;
|
||||
worker->front = listen_create(worker->base, ports,
|
||||
cfg->msg_buffer_size, (int)cfg->incoming_num_tcp,
|
||||
worker_handle_request, worker);
|
||||
@@ -1080,7 +1132,6 @@ worker_init(struct worker* worker, struct config_file *cfg,
|
||||
worker_delete(worker);
|
||||
return 0;
|
||||
}
|
||||
worker->request_size = cfg->num_queries_per_thread;
|
||||
|
||||
server_stats_init(&worker->stats, cfg);
|
||||
alloc_init(&worker->alloc, &worker->daemon->superalloc,
|
||||
@@ -1091,7 +1142,6 @@ worker_init(struct worker* worker, struct config_file *cfg,
|
||||
if(worker->thread_num == 0)
|
||||
log_set_time(worker->env.now);
|
||||
worker->env.worker = worker;
|
||||
worker->env.send_packet = &worker_send_packet;
|
||||
worker->env.send_query = &worker_send_query;
|
||||
worker->env.alloc = &worker->alloc;
|
||||
worker->env.rnd = worker->rndstate;
|
||||
@@ -1180,19 +1230,6 @@ worker_delete(struct worker* worker)
|
||||
free(worker);
|
||||
}
|
||||
|
||||
int
|
||||
worker_send_packet(ldns_buffer* pkt, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int timeout, struct module_qstate* q, int use_tcp)
|
||||
{
|
||||
struct worker* worker = q->env->worker;
|
||||
if(use_tcp) {
|
||||
return pending_tcp_query(worker->back, pkt, addr, addrlen,
|
||||
timeout, worker_handle_reply, q) != 0;
|
||||
}
|
||||
return pending_udp_query(worker->back, pkt, addr, addrlen,
|
||||
timeout*1000, worker_handle_reply, q) != 0;
|
||||
}
|
||||
|
||||
/** compare outbound entry qstates */
|
||||
static int
|
||||
outbound_entry_compare(void* a, void* b)
|
||||
@@ -1206,7 +1243,7 @@ outbound_entry_compare(void* a, void* b)
|
||||
|
||||
struct outbound_entry*
|
||||
worker_send_query(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
uint16_t qclass, uint16_t flags, int dnssec,
|
||||
uint16_t qclass, uint16_t flags, int dnssec, int want_dnssec,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
struct module_qstate* q)
|
||||
{
|
||||
@@ -1217,7 +1254,8 @@ worker_send_query(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
return NULL;
|
||||
e->qstate = q;
|
||||
e->qsent = outnet_serviced_query(worker->back, qname,
|
||||
qnamelen, qtype, qclass, flags, dnssec, addr, addrlen,
|
||||
qnamelen, qtype, qclass, flags, dnssec, want_dnssec,
|
||||
q->env->cfg->tcp_upstream, addr, addrlen,
|
||||
worker_handle_service_reply, e, worker->back->udp_buff,
|
||||
&outbound_entry_compare);
|
||||
if(!e->qsent) {
|
||||
@@ -1242,19 +1280,11 @@ void worker_stats_clear(struct worker* worker)
|
||||
}
|
||||
|
||||
/* --- fake callbacks for fptr_wlist to work --- */
|
||||
int libworker_send_packet(ldns_buffer* ATTR_UNUSED(pkt),
|
||||
struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
socklen_t ATTR_UNUSED(addrlen), int ATTR_UNUSED(timeout),
|
||||
struct module_qstate* ATTR_UNUSED(q), int ATTR_UNUSED(use_tcp))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct outbound_entry* libworker_send_query(uint8_t* ATTR_UNUSED(qname),
|
||||
size_t ATTR_UNUSED(qnamelen), uint16_t ATTR_UNUSED(qtype),
|
||||
uint16_t ATTR_UNUSED(qclass), uint16_t ATTR_UNUSED(flags),
|
||||
int ATTR_UNUSED(dnssec), struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
int ATTR_UNUSED(dnssec), int ATTR_UNUSED(want_dnssec),
|
||||
struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
socklen_t ATTR_UNUSED(addrlen), struct module_qstate* ATTR_UNUSED(q))
|
||||
{
|
||||
log_assert(0);
|
||||
|
||||
+2
-18
@@ -102,9 +102,6 @@ struct worker {
|
||||
/** timer for statistics */
|
||||
struct comm_timer* stat_timer;
|
||||
|
||||
/** number of requests that can be handled by this worker */
|
||||
size_t request_size;
|
||||
|
||||
/** random() table for this worker. */
|
||||
struct ub_randstate* rndstate;
|
||||
/** do we need to restart or quit (on signal) */
|
||||
@@ -167,20 +164,6 @@ void worker_send_cmd(struct worker* worker, enum worker_commands cmd);
|
||||
*/
|
||||
void worker_sighandler(int sig, void* arg);
|
||||
|
||||
/**
|
||||
* Worker service routine to send udp messages for modules.
|
||||
* @param pkt: packet to send.
|
||||
* @param addr: where to.
|
||||
* @param addrlen: length of addr.
|
||||
* @param timeout: seconds to wait until timeout.
|
||||
* @param q: wich query state to reactivate upon return.
|
||||
* @param use_tcp: true to use TCP, false for UDP.
|
||||
* @return: false on failure (memory or socket related). no query was
|
||||
* sent.
|
||||
*/
|
||||
int worker_send_packet(ldns_buffer* pkt, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int timeout, struct module_qstate* q, int use_tcp);
|
||||
|
||||
/**
|
||||
* Worker service routine to send serviced queries to authoritative servers.
|
||||
* @param qname: query name. (host order)
|
||||
@@ -189,6 +172,7 @@ int worker_send_packet(ldns_buffer* pkt, struct sockaddr_storage* addr,
|
||||
* @param qclass: query class. (host order)
|
||||
* @param flags: host order flags word, with opcode and CD bit.
|
||||
* @param dnssec: if set, EDNS record will have DO bit set.
|
||||
* @param want_dnssec: signatures needed.
|
||||
* @param addr: where to.
|
||||
* @param addrlen: length of addr.
|
||||
* @param q: wich query state to reactivate upon return.
|
||||
@@ -197,7 +181,7 @@ int worker_send_packet(ldns_buffer* pkt, struct sockaddr_storage* addr,
|
||||
*/
|
||||
struct outbound_entry* worker_send_query(uint8_t* qname, size_t qnamelen,
|
||||
uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
int want_dnssec, struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
struct module_qstate* q);
|
||||
|
||||
/**
|
||||
|
||||
+922
@@ -1,6 +1,928 @@
|
||||
12 September 2011: Wouter
|
||||
- Reverted dns EDNS backoff fix, it did not help and needs
|
||||
fragmentation fixes instead.
|
||||
- tag 1.4.13rc2
|
||||
|
||||
7 September 2011: Wouter
|
||||
- Fix operation in ipv6 only (do-ip4: no) mode.
|
||||
|
||||
6 September 2011: Wouter
|
||||
- fedora specfile updated.
|
||||
|
||||
5 September 2011: Wouter
|
||||
- tag 1.4.13rc1
|
||||
|
||||
2 September 2011: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
26 August 2011: Wouter
|
||||
- Fix num-threads 0 does not segfault, reported by Simon Deziel.
|
||||
- Fix validation failures due to EDNS backoff retries, the retry
|
||||
for fetch of data has want_dnssec because the iter_indicate_dnssec
|
||||
function returns true when validation failure retry happens, and
|
||||
then the serviced query code does not fallback to noEDNS, even if
|
||||
the cache says it has this. This helps for DLV deployment when
|
||||
the DNSSEC status is not known for sure before the lookup concludes.
|
||||
|
||||
24 August 2011: Wouter
|
||||
- Applied patch from Karel Slany that fixes a memory leak in the
|
||||
unbound python module, in string conversions.
|
||||
|
||||
22 August 2011: Wouter
|
||||
- Fix validation of qtype ANY responses with CNAMEs (thanks Cathy
|
||||
Zhang and Luo Ce). Unbound responds with the RR types that are
|
||||
available at the name for qtype ANY and validates those RR types.
|
||||
It does not test for completeness (i.e. with NSEC or NSEC3 query),
|
||||
and it does not follow the CNAME or DNAME to another name (with
|
||||
even more data for the already large response).
|
||||
- Fix that internally, CNAMEs with NXDOMAIN have that as rcode.
|
||||
- Documented the options that work with control set_option command.
|
||||
- tcp-upstream yes/no option (works with set_option) for tunnels.
|
||||
|
||||
18 August 2011: Wouter
|
||||
- fix autoconf call in makedist crosscompile to RC or snapshot.
|
||||
|
||||
17 August 2011: Wouter
|
||||
- Fix validation of . DS query.
|
||||
- new xml format at IANA, new awk for iana_update.
|
||||
- iana portlist updated.
|
||||
|
||||
10 August 2011: Wouter
|
||||
- Fix python site-packages path to /usr/lib64.
|
||||
- updated patch from Tom.
|
||||
- fix memory and fd leak after out-of-memory condition.
|
||||
|
||||
9 August 2011: Wouter
|
||||
- patch from Tom Hendrikx fixes load of python modules.
|
||||
|
||||
8 August 2011: Wouter
|
||||
- make clean had ldns-src reference, removed.
|
||||
|
||||
1 August 2011: Wouter
|
||||
- Fix autoconf 2.68 warnings
|
||||
|
||||
14 July 2011: Wouter
|
||||
- Unbound implements RFC6303 (since version 1.4.7).
|
||||
- tag 1.4.12rc1 is released as 1.4.12 (without the other fixes in the
|
||||
meantime, those are for 1.4.13).
|
||||
- iana portlist updated.
|
||||
|
||||
13 July 2011: Wouter
|
||||
- Quick fix for contrib/unbound.spec example, no ldns-builtin any more.
|
||||
|
||||
11 July 2011: Wouter
|
||||
- Fix wildcard expansion no-data reply under an optout NSEC3 zone is
|
||||
validated as insecure, reported by Jia Li (lijia@cnnic.cn).
|
||||
|
||||
4 July 2011: Wouter
|
||||
- 1.4.12rc1 tag created.
|
||||
|
||||
1 July 2011: Wouter
|
||||
- version number in example config file.
|
||||
- fix that --enable-static-exe does not complain about it unknown.
|
||||
|
||||
30 June 2011: Wouter
|
||||
- tag relase 1.4.11, trunk is 1.4.12 development.
|
||||
- iana portlist updated.
|
||||
- fix bug#395: id bits of other query may leak out under conditions
|
||||
- fix replyaddr count wrong after jostled queries, which leads to
|
||||
eventual starvation where the daemon has no replyaddrs left to use.
|
||||
- fix comment about rndc port, that referred to the old port number.
|
||||
- fix that the listening socket is not closed when too many remote
|
||||
control connections are made at the same time.
|
||||
- removed ldns-src tarball inside the unbound tarball.
|
||||
|
||||
23 June 2011: Wouter
|
||||
- Changed -flto check to support clang compiler.
|
||||
- tag 1.4.11rc3 created.
|
||||
|
||||
17 June 2011: Wouter
|
||||
- tag 1.4.11rc1 created.
|
||||
- remove warning about signed/unsigned from flex (other flex version).
|
||||
- updated aclocal.m4 and libtool to match.
|
||||
- tag 1.4.11rc2 created.
|
||||
|
||||
16 June 2011: Wouter
|
||||
- log-queries: yesno option, default is no, prints querylog.
|
||||
- version is 1.4.11.
|
||||
|
||||
14 June 2011: Wouter
|
||||
- Use -flto compiler flag for link time optimization, if supported.
|
||||
- iana portlist updated.
|
||||
|
||||
12 June 2011: Wouter
|
||||
- IPv6 service address for d.root-servers.net (2001:500:2D::D).
|
||||
|
||||
10 June 2011: Wouter
|
||||
- unbound-control has version number in the header,
|
||||
UBCT[version]_space_ is the header sent by the client now.
|
||||
- Unbound control port number is registered with IANA:
|
||||
ub-dns-control 8953/tcp unbound dns nameserver control
|
||||
This is the new default for the control-port config setting.
|
||||
- statistics-interval prints the number of jostled queries to log.
|
||||
|
||||
30 May 2011: Wouter
|
||||
- Fix Makefile for U in environment, since wrong U is more common than
|
||||
deansification necessity.
|
||||
- iana portlist updated.
|
||||
- updated ldns tarball to 1.6.10rc2 snapshot of today.
|
||||
|
||||
25 May 2011: Wouter
|
||||
- Fix assertion failure when unbound generates an empty error reply
|
||||
in response to a query, CVE-2011-1922 VU#531342.
|
||||
- This fix is in tag 1.4.10.
|
||||
- defense in depth against the above bug, an error is printed to log
|
||||
instead of an assertion failure.
|
||||
|
||||
10 May 2011: Wouter
|
||||
- bug#386: --enable-allsymbols option links all binaries to libunbound
|
||||
and reduces install size significantly.
|
||||
- feature, ignore-cd-flag: yesno to provide dnssec to legacy servers.
|
||||
- iana portlist updated.
|
||||
- Fix TTL of SOA so negative TTL is separately cached from normal TTL.
|
||||
|
||||
14 April 2011: Wouter
|
||||
- configure created with newer autoconf 2.66.
|
||||
|
||||
12 April 2011: Wouter
|
||||
- bug#378: Fix that configure checks for ldns_get_random presence.
|
||||
|
||||
8 April 2011: Wouter
|
||||
- iana portlist updated.
|
||||
- queries with CD flag set cause DNSSEC validation, but the answer is
|
||||
not withheld if it is bogus. Thus, unbound will retry if it is bad
|
||||
and curb the TTL if it is bad, thus protecting the cache for use by
|
||||
downstream validators.
|
||||
- val-override-date: -1 ignores dates entirely, for NTP usage.
|
||||
|
||||
29 March 2011: Wouter
|
||||
- harden-below-nxdomain: changed so that it activates when the
|
||||
cached nxdomain is dnssec secure. This avoids backwards
|
||||
incompatibility because those old servers do not have dnssec.
|
||||
|
||||
24 March 2011: Wouter
|
||||
- iana portlist updated.
|
||||
- release 1.4.9.
|
||||
- trunk is 1.5.0
|
||||
|
||||
17 March 2011: Wouter
|
||||
- bug#370: new unbound.spec for CentOS 5.x from Harold Jones.
|
||||
Applied but did not do the --disable-gost.
|
||||
|
||||
10 March 2011: Wouter
|
||||
- tag 1.4.9 release candidate 1 created.
|
||||
|
||||
3 March 2011: Wouter
|
||||
- updated ldns to today.
|
||||
|
||||
1 March 2011: Wouter
|
||||
- Fix no ADflag for NXDOMAIN in NSEC3 optout. And wildcard in optout.
|
||||
- give config parse error for multiple names on a stub or forward zone.
|
||||
- updated ldns tarball to 1.6.9(todays snapshot).
|
||||
|
||||
24 February 2011: Wouter
|
||||
- bug #361: Fix, time.elapsed variable not reset with stats_noreset.
|
||||
|
||||
23 February 2011: Wouter
|
||||
- iana portlist updated.
|
||||
- common.sh to version 3.
|
||||
|
||||
18 February 2011: Wouter
|
||||
- common.sh in testdata updated to version 2.
|
||||
|
||||
15 February 2011: Wouter
|
||||
- Added explicit note on unbound-anchor usage:
|
||||
Please note usage of unbound-anchor root anchor is at your own risk
|
||||
and under the terms of our LICENSE (see that file in the source).
|
||||
|
||||
11 February 2011: Wouter
|
||||
- iana portlist updated.
|
||||
- tpkg updated with common.sh for common functionality.
|
||||
|
||||
7 February 2011: Wouter
|
||||
- Added regression test for addition of a .net DS to the root, and
|
||||
cache effects with different TTL for glue and DNSKEY.
|
||||
- iana portlist updated.
|
||||
|
||||
28 January 2011: Wouter
|
||||
- Fix remove private address does not throw away entire response.
|
||||
|
||||
24 January 2011: Wouter
|
||||
- release 1.4.8
|
||||
|
||||
19 January 2011: Wouter
|
||||
- fix bug#349: no -L/usr for ldns.
|
||||
|
||||
18 January 2011: Wouter
|
||||
- ldns 1.6.8 tarball included.
|
||||
- release 1.4.8rc1.
|
||||
|
||||
17 January 2011: Wouter
|
||||
- add get and set option for harden-below-nxdomain feature.
|
||||
- iana portlist updated.
|
||||
|
||||
14 January 2011: Wouter
|
||||
- Fix so a changed NS RRset does not get moved name stuck on old
|
||||
server, for type NS the TTL is not increased.
|
||||
|
||||
13 January 2011: Wouter
|
||||
- Fix prefetch so it does not get stuck on old server for moved names.
|
||||
|
||||
12 January 2011: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
11 January 2011: Wouter
|
||||
- Fix insecure CNAME sequence marked as secure, reported by Bert
|
||||
Hubert.
|
||||
|
||||
10 January 2011: Wouter
|
||||
- faster lruhash get_mem routine.
|
||||
|
||||
4 January 2011: Wouter
|
||||
- bug#346: remove ITAR scripts from contrib, the service is discontinued, use the root.
|
||||
- iana portlist updated.
|
||||
|
||||
23 December 2010: Wouter
|
||||
- Fix in infra cache that could cause rto larger than TOP_TIMEOUT kept.
|
||||
|
||||
21 December 2010: Wouter
|
||||
- algorithm compromise protection using the algorithms signalled in
|
||||
the DS record. Also, trust anchors, DLV, and RFC5011 receive this,
|
||||
and thus, if you have multiple algorithms in your trust-anchor-file
|
||||
then it will now behave different than before. Also, 5011 rollover
|
||||
for algorithms needs to be double-signature until the old algorithm
|
||||
is revoked.
|
||||
It is not an option, because I see no use to turn the security off.
|
||||
- iana portlist updated.
|
||||
|
||||
17 December 2010: Wouter
|
||||
- squelch 'tcp connect: bla' in logfile, (set verbosity 2 to see them).
|
||||
- fix validation in this case: CNAME to nodata for co-hosted opt-in
|
||||
NSEC3 insecure delegation, was bogus, fixed to be insecure.
|
||||
|
||||
16 December 2010: Wouter
|
||||
- Fix our 'BDS' license (typo reported by Xavier Belanger).
|
||||
|
||||
10 December 2010: Wouter
|
||||
- iana portlist updated.
|
||||
- review changes for unbound-anchor.
|
||||
|
||||
2 December 2010: Wouter
|
||||
- feature typetransparent localzone, does not block other RR types.
|
||||
|
||||
1 December 2010: Wouter
|
||||
- Fix bug#338: print address when socket creation fails.
|
||||
|
||||
30 November 2010: Wouter
|
||||
- Fix storage of EDNS failures in the infra cache.
|
||||
- iana portlist updated.
|
||||
|
||||
18 November 2010: Wouter
|
||||
- harden-below-nxdomain option, default off (because very old
|
||||
software may be incompatible). We could enable it by default in
|
||||
the future.
|
||||
|
||||
17 November 2010: Wouter
|
||||
- implement draft-vixie-dnsext-resimprove-00, we stop on NXDOMAIN.
|
||||
- make test output nicer.
|
||||
|
||||
15 November 2010: Wouter
|
||||
- silence 'tcp connect: broken pipe' and 'net down' at low verbosity.
|
||||
- iana portlist updated.
|
||||
- so-sndbuf option for very busy servers, a bit like so-rcvbuf.
|
||||
|
||||
9 November 2010: Wouter
|
||||
- unbound-anchor compiles with openssl 0.9.7.
|
||||
|
||||
8 November 2010: Wouter
|
||||
- release tag 1.4.7.
|
||||
- trunk is version 1.4.8.
|
||||
- Be lenient and accept imgw.pl malformed packet (like BIND).
|
||||
|
||||
5 November 2010: Wouter
|
||||
- do not synthesize a CNAME message from cache for qtype DS.
|
||||
|
||||
4 November 2010: Wouter
|
||||
- Use central entropy to seed threads.
|
||||
|
||||
3 November 2010: Wouter
|
||||
- Change the rtt used to probe EDNS-timeout hosts to 1000 msec.
|
||||
|
||||
2 November 2010: Wouter
|
||||
- tag 1.4.7rc1.
|
||||
- code review.
|
||||
|
||||
1 November 2010: Wouter
|
||||
- GOST code enabled by default (RFC 5933).
|
||||
|
||||
27 October 2010: Wouter
|
||||
- Fix uninit value in dump_infra print.
|
||||
- Fix validation failure for parent and child on same server with an
|
||||
insecure childzone and a CNAME from parent to child.
|
||||
- Configure detects libev-4.00.
|
||||
|
||||
26 October 2010: Wouter
|
||||
- dump_infra and flush_infra commands for unbound-control.
|
||||
- no timeout backoff if meanwhile a query succeeded.
|
||||
- Change of timeout code. No more lost and backoff in blockage.
|
||||
At 12sec timeout (and at least 2x lost before) one probe per IP
|
||||
is allowed only. At 120sec, the IP is blocked. After 15min, a
|
||||
120sec entry has a single retry packet.
|
||||
|
||||
25 October 2010: Wouter
|
||||
- Configure errors if ldns is not found.
|
||||
|
||||
22 October 2010: Wouter
|
||||
- Windows 7 fix for the installer.
|
||||
|
||||
21 October 2010: Wouter
|
||||
- Fix bug where fallback_tcp causes wrong roundtrip and edns
|
||||
observation to be noted in cache. Fix bug where EDNSprobe halted
|
||||
exponential backoff if EDNS status unknown.
|
||||
- new unresponsive host method, exponentially increasing block backoff.
|
||||
- iana portlist updated.
|
||||
|
||||
20 October 2010: Wouter
|
||||
- interface automatic works for some people with ip6 disabled.
|
||||
Therefore the error check is removed, so they can use the option.
|
||||
|
||||
19 October 2010: Wouter
|
||||
- Fix for request list growth, if a server has long timeout but the
|
||||
lost counter is low, then its effective rtt is the one without
|
||||
exponential backoff applied. Because the backoff is not working.
|
||||
The lost counter can then increase and the server is blacklisted,
|
||||
or the lost counter does not increase and the server is working
|
||||
for some queries.
|
||||
|
||||
18 October 2010: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
13 October 2010: Wouter
|
||||
- Fix TCP so it uses a random outgoing-interface.
|
||||
- unbound-anchor handles ADDPEND keystate.
|
||||
|
||||
11 October 2010: Wouter
|
||||
- Fix bug when DLV below a trust-anchor that uses NSEC3 optout where
|
||||
the zone has a secure delegation hosted on the same server did not
|
||||
verify as secure (it was insecure by mistake).
|
||||
- iana portlist updated.
|
||||
- ldns tarball updated (for reading cachedumps with bad RR data).
|
||||
|
||||
1 October 2010: Wouter
|
||||
- test for unbound-anchor. fix for reading certs.
|
||||
- Fix alloc_reg_release for longer uptime in out of memory conditions.
|
||||
|
||||
28 September 2010: Wouter
|
||||
- unbound-anchor working, it creates or updates a root.key file.
|
||||
Use it before you start the validator (e.g. at system boot time).
|
||||
|
||||
27 September 2010: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
24 September 2010: Wouter
|
||||
- bug#329: in example.conf show correct ipv4 link-local 169.254/16.
|
||||
|
||||
23 September 2010: Wouter
|
||||
- unbound-anchor app, unbound requires libexpat (xml parser library).
|
||||
|
||||
22 September 2010: Wouter
|
||||
- compliance with draft-ietf-dnsop-default-local-zones-14, removed
|
||||
reverse ipv6 orchid prefix from builtin list.
|
||||
- iana portlist updated.
|
||||
|
||||
17 September 2010: Wouter
|
||||
- DLV has downgrade protection again, because the RFC says so.
|
||||
- iana portlist updated.
|
||||
|
||||
16 September 2010: Wouter
|
||||
- Algorithm rollover operational reality intrudes, for trust-anchor,
|
||||
5011-store, and DLV-anchor if one key matches it's good enough.
|
||||
- iana portlist updated.
|
||||
- Fix reported validation error in out of memory condition.
|
||||
|
||||
15 September 2010: Wouter
|
||||
- Abide RFC5155 section 9.2: no AD flag for replies with NSEC3 optout.
|
||||
|
||||
14 September 2010: Wouter
|
||||
- increased mesh-max-activation from 1000 to 3000 for crazy domains
|
||||
like _tcp.slb.com with 262 servers.
|
||||
- iana portlist updated.
|
||||
|
||||
13 September 2010: Wouter
|
||||
- bug#327: Fix for cannot access stub zones until the root is primed.
|
||||
|
||||
9 September 2010: Wouter
|
||||
- unresponsive servers are not completely blacklisted (because of
|
||||
firewalls), but also not probed all the time (because of the request
|
||||
list size it generates). The probe rate is 1%.
|
||||
- iana portlist updated.
|
||||
|
||||
20 August 2010: Wouter
|
||||
- openbsd-lint fixes: acl_list_get_mem used if debug-alloc enabled.
|
||||
iterator get_mem includes priv_get_mem. delegpt nodup removed.
|
||||
listen_pushback, query_info_allocqname, write_socket, send_packet,
|
||||
comm_point_set_cb_arg and listen_resume removed.
|
||||
|
||||
19 August 2010: Wouter
|
||||
- Fix bug#321: resolution of rs.ripe.net artifacts with 0x20.
|
||||
Delegpt structures checked for duplicates always.
|
||||
No more nameserver lookups generated when depth is full anyway.
|
||||
- example.conf notes how to do DNSSEC validation and track the root.
|
||||
- iana portlist updated.
|
||||
|
||||
18 August 2010: Wouter
|
||||
- Fix bug#322: configure does not respect CFLAGS on Solaris.
|
||||
Pass CFLAGS="-xO4 -xtarget=generic" on the configure command line
|
||||
if use sun-cc, but some systems need different flags.
|
||||
|
||||
16 August 2010: Wouter
|
||||
- Fix acx_nlnetlabs.m4 configure output for autoconf-2.66 AS_TR_CPP
|
||||
changes, uses m4_bpatsubst now.
|
||||
- make test (or make check) should be more portable and run the unit
|
||||
test and testbound scripts. (make longtest has special requirements).
|
||||
|
||||
13 August 2010: Wouter
|
||||
- More pleasant remote control command parsing.
|
||||
- documentation added for return values reported by doxygen 1.7.1.
|
||||
- iana portlist updated.
|
||||
|
||||
9 August 2010: Wouter
|
||||
- Fix name of rrset printed that failed validation.
|
||||
|
||||
5 August 2010: Wouter
|
||||
- Return NXDOMAIN after chain of CNAMEs ends at name-not-found.
|
||||
|
||||
4 August 2010: Wouter
|
||||
- Fix validation in case a trust anchor enters into a zone with
|
||||
unsupported algorithms.
|
||||
|
||||
3 August 2010: Wouter
|
||||
- updated ldns tarball with bugfixes.
|
||||
- release tag 1.4.6.
|
||||
- trunk becomes 1.4.7 develop.
|
||||
- iana portlist updated.
|
||||
|
||||
22 July 2010: Wouter
|
||||
- more error details on failed remote control connection.
|
||||
|
||||
15 July 2010: Wouter
|
||||
- rlimit adjustments for select and ulimit can happen at the same time.
|
||||
|
||||
14 July 2010: Wouter
|
||||
- Donation text added to README.
|
||||
- Fix integer underflow in prefetch ttl creation from cache. This
|
||||
fixes a potential negative prefetch ttl.
|
||||
|
||||
12 July 2010: Wouter
|
||||
- Changed the defaults for num-queries-per-thread/outgoing-range.
|
||||
For builtin-select: 512/960, for libevent 1024/4096 and for
|
||||
windows 24/48 (because of win api). This makes the ratio this way
|
||||
to improve resilience under heavy load. For high performance, use
|
||||
libevent and possibly higher numbers.
|
||||
|
||||
10 July 2010: Wouter
|
||||
- GOST enabled if SSL is recent and ldns has GOST enabled too.
|
||||
- ldns tarball updated.
|
||||
|
||||
9 July 2010: Wouter
|
||||
- iana portlist updated.
|
||||
- Fix validation of qtype DNSKEY when a key-cache entry exists but
|
||||
no rr-cache entry is used (it expired or prefetch), it then goes
|
||||
back up to the DS or trust-anchor to validate the DNSKEY.
|
||||
|
||||
7 July 2010: Wouter
|
||||
- Neat function prototypes, unshadowed local declarations.
|
||||
|
||||
6 July 2010: Wouter
|
||||
- failure to chown the pidfile is not fatal any more.
|
||||
- testbound uses UTC timezone.
|
||||
- ldns tarball updated (ports and works on Minix 3.1.7). On Minix, add
|
||||
/usr/gnu/bin to PATH, use ./configure AR=/usr/gnu/bin/gar and gmake.
|
||||
|
||||
5 July 2010: Wouter
|
||||
- log if a server is skipped because it is on the donotquery list,
|
||||
at verbosity 4, to enable diagnosis why no queries to 127.0.0.1.
|
||||
- added feature to print configure date, target and options with -h.
|
||||
- added feature to print event backend system details with -h.
|
||||
- wdiff is not actually required by make test, updated requirements.
|
||||
|
||||
1 July 2010: Wouter
|
||||
- Fix RFC4035 compliance with 2.2 statement that the DNSKEY at apex
|
||||
must be signed with all algorithms from the DS rrset at the parent.
|
||||
This is now checked and becomes bogus if not.
|
||||
|
||||
28 June 2010: Wouter
|
||||
- Fix jostle list bug found by Vince (luoce@cnnic), it caused the qps
|
||||
in overload situations to be about 5 qps for the class of shortly
|
||||
serviced queries.
|
||||
The capacity of the resolver is then about (numqueriesperthread / 2)
|
||||
/ (average time for such long queries) qps for long queries.
|
||||
And about (numqueriesperthread / 2)/(jostletimeout in whole seconds)
|
||||
qps for short queries, per thread.
|
||||
- Fix the max number of reply-address count to be applied for duplicate
|
||||
queries, and not for new query list entries. This raises the memory
|
||||
usage to a max of (16+1)*numqueriesperthread reply addresses.
|
||||
|
||||
25 June 2010: Wouter
|
||||
- Fix handling of corner case reply from lame server, follows rfc2308.
|
||||
It could lead to a nodata reply getting into the cache if the search
|
||||
for a non-lame server turned up other misconfigured servers.
|
||||
- unbound.h has extern "C" statement for easier include in c++.
|
||||
|
||||
23 June 2010: Wouter
|
||||
- iana portlist updated.
|
||||
- makedist upgraded cross compile openssl option, like this:
|
||||
./makedist.sh -s -wssl openssl-1.0.0a.tar.gz -w --enable-gost
|
||||
|
||||
22 June 2010: Wouter
|
||||
- Unbound reports libev or libevent correctly in logs in verbose mode.
|
||||
- Fix to unload gost dynamic library module for leak testing.
|
||||
|
||||
18 June 2010: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
17 June 2010: Wouter
|
||||
- Add AAAA to root hints for I.ROOT-SERVERS.NET.
|
||||
|
||||
16 June 2010: Wouter
|
||||
- Fix assertion failure reported by Kai Storbeck from XS4ALL, the
|
||||
assertion was wrong.
|
||||
- updated ldns tarball.
|
||||
|
||||
15 June 2010: Wouter
|
||||
- tag 1.4.5 created.
|
||||
- trunk contains 1.4.6 in development.
|
||||
- Fix TCPreply on systems with no writev, if just 1 byte could be sent.
|
||||
- Fix to use one pointer less for iterator query state store_parent_NS.
|
||||
- makedist crosscompile to windows uses builtin ldns not host ldns.
|
||||
- Max referral count from 30 to 130, because 128 one character domains
|
||||
is valid DNS.
|
||||
- added documentation for the histogram printout to syslog.
|
||||
|
||||
11 June 2010: Wouter
|
||||
- When retry to parent the retrycount is not wiped, so failed
|
||||
nameservers are not tried again.
|
||||
- iana portlist updated.
|
||||
|
||||
10 June 2010: Wouter
|
||||
- Fix bug where a long loop could be entered, now cycle detection
|
||||
has a loop-counter and maximum search amount.
|
||||
|
||||
4 June 2010: Wouter
|
||||
- iana portlist updated.
|
||||
- 1.4.5rc1 tag created.
|
||||
|
||||
3 June 2010: Wouter
|
||||
- ldns tarball updated, 1.6.5.
|
||||
- review comments, split dependency cycle tracking for parentside
|
||||
last resort lookups for A and AAAA so there are more lookup options.
|
||||
|
||||
2 June 2010: Wouter
|
||||
- Fix compile warning if compiled without threads.
|
||||
- updated ldns-tarball with current ldns svn (pre 1.6.5).
|
||||
- GOST disabled-by-default, the algorithm number is allocated but the
|
||||
RFC is still has to pass AUTH48 at the IETF.
|
||||
|
||||
1 June 2010: Wouter
|
||||
- Ignore Z flag in incoming messages too.
|
||||
- Fix storage of negative parent glue if that last resort fails.
|
||||
- libtoolize 2.2.6b, autoconf 2.65 applied to configure.
|
||||
- new splint flags for newer splint install.
|
||||
|
||||
31 May 2010: Wouter
|
||||
- Fix AD flag handling, it could in some cases mistakenly copy the AD
|
||||
flag from upstream servers.
|
||||
- alloc_special_obtain out of memory is not a fatal error any more,
|
||||
enabling unbound to continue longer in out of memory conditions.
|
||||
- parentside names are dispreferred but not said to be dnssec-lame.
|
||||
- parentside check for cached newname glue.
|
||||
- fix parentside and querytargets modulestate, for dump_requestlist.
|
||||
- unbound-control-setup makes keys -rw-r--- so not all users permitted.
|
||||
- fix parentside from cache to be marked dispreferred for bad names.
|
||||
|
||||
28 May 2010: Wouter
|
||||
- iana portlist updated.
|
||||
- parent-child disagreement approach altered. Older fixes are
|
||||
removed in place of a more exhaustive search for misconfigured data
|
||||
available via the parent of a delegation.
|
||||
This is designed to be throttled by cache entries, with TTL from the
|
||||
parent if possible. Additionally the loop-counter is used.
|
||||
It also tests for NS RRset differences between parent and child.
|
||||
The fetch of misconfigured data should be more reliable and thorough.
|
||||
It should work reliably even with no or only partial data in cache.
|
||||
Data received from the child (as always) is deemed more
|
||||
authoritative than information received from the delegation parent.
|
||||
The search for misconfigured data is not performed normally.
|
||||
|
||||
26 May 2010: Wouter
|
||||
- Contribution from Migiel de Vos (Surfnet): nagios patch for
|
||||
unbound-host, in contrib/ (in the source tarball). Makes
|
||||
unbound-host suitable for monitoring dnssec(-chain) status.
|
||||
|
||||
21 May 2010: Wouter
|
||||
- EDNS timeout code will not fire if EDNS status already known.
|
||||
- EDNS failure not stored if EDNS status known to work.
|
||||
|
||||
19 May 2010: Wouter
|
||||
- Fix resolution for domains like safesvc.com.cn. If the iterator
|
||||
can not recurse further and it finds the delegation in a state
|
||||
where it would otherwise have rejected it outhand if so received
|
||||
from a cache lookup, then it can try to ask higherup (with loop
|
||||
protection).
|
||||
- Fix comments in iter_utils:dp_is_useless.
|
||||
|
||||
18 May 2010: Wouter
|
||||
- Fix various compiler warnings from the clang llvm compiler.
|
||||
- iana portlist updated.
|
||||
|
||||
6 May 2010: Wouter
|
||||
- Fix bug#308: spelling error in variable name in parser and lexer.
|
||||
|
||||
4 May 2010: Wouter
|
||||
- Fix dnssec-missing detection that was turned off by server selection.
|
||||
- Conforms to draft-ietf-dnsop-default-local-zones-13. Added default
|
||||
reverse lookup blocks for IPv4 test nets 100.51.198.in-addr.arpa,
|
||||
113.0.203.in-addr.arpa and Orchid prefix 0.1.1.0.0.2.ip6.arpa.
|
||||
|
||||
29 April 2010: Wouter
|
||||
- Fix for dnssec lameness detection to use the key cache.
|
||||
- infra cache entries that are expired are wiped clean. Previously
|
||||
it was possible to not expire host data (if accessed often).
|
||||
|
||||
28 April 2010: Wouter
|
||||
- ldns tarball updated and GOST support is detected and then enabled.
|
||||
- iana portlist updated.
|
||||
- Fix detection of gost support in ldns (reported by Chris Smith).
|
||||
|
||||
27 April 2010: Wouter
|
||||
- unbound-control get_option domain-insecure shows config file items.
|
||||
- fix retry sequence if prime hints are recursion-lame.
|
||||
- autotrust anchor file can be initialized with a ZSK key as well.
|
||||
- harden-referral-path does not result in failures due to max-depth.
|
||||
You can increase the max-depth by adding numbers (' 0') after the
|
||||
target-fetch-policy, this increases the depth to which is checked.
|
||||
|
||||
26 April 2010: Wouter
|
||||
- Compile fix using Sun Studio 12 compiler on Solaris 5.9, use
|
||||
CPPFLAGS during configure process.
|
||||
- if libev is installed on the base system (not libevent), detect
|
||||
it from the event.h header file and link with -lev.
|
||||
- configlexer.lex gets config.h, and configyyrename.h added by make,
|
||||
no more double include.
|
||||
- More strict scrubber (Thanks to George Barwood for the idea):
|
||||
NS set must be pertinent to the query (qname subdomain nsname).
|
||||
- Fix bug#307: In 0x20 backoff fix fallback so the number of
|
||||
outstanding queries does not become -1 and block the request.
|
||||
Fixed handling of recursion-lame in combination with 0x20 fallback.
|
||||
Fix so RRsets are compared canonicalized and sorted if the immediate
|
||||
comparison fails, this makes it work around round-robin sites.
|
||||
|
||||
23 April 2010: Wouter
|
||||
- Squelch log message: sendto failed permission denied for
|
||||
255.255.255.255, it is visible in VERB_DETAIL (verbosity 2).
|
||||
- Fix to fetch data as last resort more tenaciously. When cycle
|
||||
targets cause the server selection to believe there are more options
|
||||
when they really are not there, the server selection is reinitiated.
|
||||
- Fix fetch from blacklisted dnssec lame servers as last resort. The
|
||||
server's IP address is then given in validator errors as well.
|
||||
- Fix local-zone type redirect that did not use the query name for
|
||||
the answer rrset.
|
||||
|
||||
22 April 2010: Wouter
|
||||
- tag 1.4.4.
|
||||
- trunk contains 1.4.5 in development.
|
||||
- Fix validation failure for qtype ANY caused by a RRSIG parse failure.
|
||||
The validator error message was 'no signatures from ...'.
|
||||
|
||||
16 April 2010: Wouter
|
||||
- more portability defines for CMSG_SPACE, CMSG_ALIGN, CMSG_LEN.
|
||||
- tag 1.4.4rc1.
|
||||
|
||||
15 April 2010: Wouter
|
||||
- ECC-GOST algorithm number 12 that is assigned by IANA. New test
|
||||
example key and signatures for GOST. GOST requires openssl-1.0.0.
|
||||
GOST is still disabled by default.
|
||||
|
||||
9 April 2010: Wouter
|
||||
- Fix bug#305: pkt_dname_tolower could read beyond end of buffer or
|
||||
get into an endless loop, if 0x20 was enabled, and buffers are small
|
||||
or particular broken packets are received.
|
||||
- Fix chain of trust with CNAME at an intermediate step, for the DS
|
||||
processing proof.
|
||||
|
||||
8 April 2010: Wouter
|
||||
- Fix validation of queries with wildcard names (*.example).
|
||||
|
||||
6 April 2010: Wouter
|
||||
- Fix EDNS probe for .de DNSSEC testbed failure, where the infra
|
||||
cache timeout coincided with a server update, the current EDNS
|
||||
backoff is less sensitive, and does not cache the backoff unless
|
||||
the backoff actually works and the domain is not expecting DNSSEC.
|
||||
- GOST support with correct algorithm numbers.
|
||||
|
||||
1 April 2010: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
24 March 2010: Wouter
|
||||
- unbound control flushed items are not counted when flushed again.
|
||||
|
||||
23 March 2010: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
22 March 2010: Wouter
|
||||
- unbound-host disables use-syslog from config file so that the
|
||||
config file for the main server can be used more easily.
|
||||
- fix bug#301: unbound-checkconf could not parse interface
|
||||
'0.0.0.0@5353', even though unbound itself worked fine.
|
||||
|
||||
19 March 2010: Wouter
|
||||
- fix fwd_ancil test to pass if the socket options are not supported.
|
||||
|
||||
18 March 2010: Wouter
|
||||
- Fixed random numbers for port, interface and server selection.
|
||||
Removed very small bias.
|
||||
- Refer to the listing in unbound-control man page in the extended
|
||||
statistics entry in the unbound.conf man page.
|
||||
|
||||
16 March 2010: Wouter
|
||||
- Fix interface-automatic for OpenBSD: msg.controllen was too small,
|
||||
also assertions on ancillary data buffer.
|
||||
- check for IP_SENDSRCADDR for interface-automatic or IP_PKTINFO.
|
||||
- for NSEC3 check if signatures are cached.
|
||||
|
||||
15 March 2010: Wouter
|
||||
- unit test for util/regional.c.
|
||||
|
||||
12 March 2010: Wouter
|
||||
- Reordered configure checks so fork and -lnsl -lsocket checks are
|
||||
earlier, and thus later checks benefit from and do not hinder them.
|
||||
- iana portlist updated.
|
||||
- ldns tarball updated.
|
||||
- Fix python use when multithreaded.
|
||||
- Fix solaris python compile.
|
||||
- Include less in config.h and include per code file for ldns, ssl.
|
||||
|
||||
11 March 2010: Wouter
|
||||
- another memory allocation option: --enable-alloc-nonregional.
|
||||
exposes the regional allocations to other memory purifiers.
|
||||
- fix for memory alignment in struct sock_list allocation.
|
||||
- Fix for MacPorts ldns without ssl default, unbound checks if ldns
|
||||
has dnssec functionality and uses the builtin if not.
|
||||
- Fix daemonize on Solaris 10, it did not detach from terminal.
|
||||
- tag 1.4.3 created.
|
||||
- trunk is 1.4.4 in development.
|
||||
- spelling fix in validation error involving cnames.
|
||||
|
||||
10 March 2010: Wouter
|
||||
- --enable-alloc-lite works with test set.
|
||||
- portability in the testset: printf format conversions, prototypes.
|
||||
|
||||
9 March 2010: Wouter
|
||||
- tag 1.4.2 created.
|
||||
- trunk is 1.4.3 in development.
|
||||
- --enable-alloc-lite debug option.
|
||||
|
||||
8 March 2010: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
4 March 2010: Wouter
|
||||
- Fix crash in control channel code.
|
||||
|
||||
3 March 2010: Wouter
|
||||
- better casts in pipe code, brackets placed wrongly.
|
||||
- iana portlist updated.
|
||||
|
||||
1 March 2010: Wouter
|
||||
- make install depends on make all.
|
||||
- Fix 5011 auto-trust-anchor-file initial read to skip RRSIGs.
|
||||
- --enable-checking: enables assertions but does not look nonproduction.
|
||||
- nicer VERB_DETAIL (verbosity 2, unbound-host -d) output, with
|
||||
nxdomain and nodata distinguished.
|
||||
- ldns tarball updated.
|
||||
- --disable-rpath fixed for libtool not found errors.
|
||||
- new fedora specfile from Fedora13 in contrib from Paul Wouters.
|
||||
|
||||
26 February 2010: Wouter
|
||||
- Fixup prototype for lexer cleanup in daemon code.
|
||||
- unbound-control list_stubs, list_forwards, list_local_zones and
|
||||
list_local_data.
|
||||
|
||||
24 February 2010: Wouter
|
||||
- Fix scrubber bug that potentially let NS records through. Reported
|
||||
by Amanda Constant.
|
||||
- Also delete potential poison references from additional.
|
||||
- Fix: no classification of a forwarder as lame, throw away instead.
|
||||
|
||||
23 February 2010: Wouter
|
||||
- libunbound ub_ctx_get_option() added.
|
||||
- unbound-control set_option and get_option commands.
|
||||
- iana portlist updated.
|
||||
|
||||
18 February 2010: Wouter
|
||||
- A little more strict DS scrubbing.
|
||||
- No more blacklisting of unresponsive servers, a 2 minute timeout
|
||||
is backed off to.
|
||||
- RD flag not enabled for dnssec-blacklisted tries, unless necessary.
|
||||
- pickup ldns compile fix, libdl for libcrypto.
|
||||
- log 'tcp connect: connection timed out' only in high verbosity.
|
||||
- unbound-control log_reopen command.
|
||||
- moved get_option code from unbound-checkconf to util/config_file.c
|
||||
|
||||
17 February 2010: Wouter
|
||||
- Disregard DNSKEY from authority section for chain of trust.
|
||||
DS records that are irrelevant to a referral scrubbed. Anti-poison.
|
||||
- iana portlist updated.
|
||||
|
||||
16 February 2010: Wouter
|
||||
- Check for 'no space left on device' (or other errors) when
|
||||
writing updated autotrust anchors and print errno to log.
|
||||
|
||||
15 February 2010: Wouter
|
||||
- Fixed the requery protection, the TTL was 0, it is now 900 seconds,
|
||||
hardcoded. We made the choice to send out more conservatively,
|
||||
protecting against an aggregate effect more than protecting a
|
||||
single user (from their own folly, perhaps in case of misconfig).
|
||||
|
||||
12 February 2010: Wouter
|
||||
- Re-query pattern changed on validation failure. To protect troubled
|
||||
authority servers, unbound caches a failure for the DNSKEY or DS
|
||||
records for the entire zone, and only retries that 900 seconds later.
|
||||
This implies that only a handful of packets are sent extra to the
|
||||
authority if the zone fails.
|
||||
|
||||
11 February 2010: Wouter
|
||||
- ldns tarball update for long label length syntax error fix.
|
||||
- iana portlist updated.
|
||||
|
||||
9 February 2010: Wouter
|
||||
- Fixup in compat snprintf routine, %f 1.02 and %g support.
|
||||
- include math.h for testbound test compile portability.
|
||||
|
||||
2 February 2010: Wouter
|
||||
- Updated url of IANA itar, interim trust anchor repository, in script.
|
||||
|
||||
1 February 2010: Wouter
|
||||
- iana portlist updated.
|
||||
- configure test for memcmp portability.
|
||||
|
||||
27 January 2010: Wouter
|
||||
- removed warning on format string in validator error log statement.
|
||||
- iana portlist updated.
|
||||
|
||||
22 January 2010: Wouter
|
||||
- libtool finish the install of unbound python dynamic library.
|
||||
|
||||
21 January 2010: Wouter
|
||||
- acx_nlnetlabs.m4 synchronised with nsd's version.
|
||||
|
||||
20 January 2010: Wouter
|
||||
- Fixup lookup trouble for parent-child domains on the first query.
|
||||
|
||||
14 January 2010: Wouter
|
||||
- Fixup ldns detection to also check for header files.
|
||||
|
||||
13 January 2010: Wouter
|
||||
- prefetch-key option that performs DNSKEY queries earlier in the
|
||||
validation process, and that could halve the latency on DNSSEC
|
||||
queries. It takes some extra processing (CPU, a cache is needed).
|
||||
|
||||
12 January 2010: Wouter
|
||||
- Fix unbound-checkconf for auto-trust-anchor-file present checks.
|
||||
|
||||
8 January 2010: Wouter
|
||||
- Fix for parent-child disagreement code which could have trouble
|
||||
when (a) ipv6 was disabled and (b) the TTL for parent and child
|
||||
were different. There were two bugs, the parent-side information
|
||||
is fixed to no longer block lookup of child side information and
|
||||
the iterator is fixed to no longer attempt to get ipv6 when it is
|
||||
not enabled and then give up in failure.
|
||||
- test and fixes to make prefetch actually store the answer in the
|
||||
cache. Considers some rrsets 'already expired' but does not allow
|
||||
overwriting of rrsets considered more secure.
|
||||
|
||||
7 January 2010: Wouter
|
||||
- Fixup python documentation (thanks Leo Vandewoestijne).
|
||||
- Work on cache prefetch feature.
|
||||
- Stats for prefetch, in log print stats, unbound-control stats
|
||||
and in unbound_munin plugin.
|
||||
|
||||
6 January 2010: Wouter
|
||||
- iana portlist updated.
|
||||
- bug#291: DNS wireformat max is 255. dname_valid allowed 256 length.
|
||||
- verbose output includes parent-side-address notion for lameness.
|
||||
- documented val-log-level: 2 setting in example.conf and man page.
|
||||
- change unbound-control-setup from 1024(sha1) to 1536(sha256).
|
||||
|
||||
1 January 2010: Wouter
|
||||
- iana portlist updated.
|
||||
|
||||
22 December 2009: Wouter
|
||||
- configure with newer libtool 2.2.6b.
|
||||
|
||||
17 December 2009: Wouter
|
||||
- review comments.
|
||||
- tag 1.4.1.
|
||||
- trunk to version 1.4.2.
|
||||
|
||||
15 December 2009: Wouter
|
||||
- Answer to qclass=ANY queries, with class IN contents.
|
||||
|
||||
+45
-8
@@ -11,16 +11,14 @@ This software is under BSD license, see LICENSE for details.
|
||||
|
||||
* Uses the following libraries;
|
||||
* ldns http://www.nlnetlabs.nl/ldns/ (BSD license)
|
||||
(required) can use tarball from source directory.
|
||||
(required) can use ldns build directory directly with --with-ldns=path.
|
||||
* libevent http://www.monkey.org/~provos/libevent/ (BSD license)
|
||||
(optional) can use builtin alternative instead.
|
||||
|
||||
* Make and install: ./configure; make; make install
|
||||
* Use GNU make; default on linux, often called 'gmake' on BSD and Solaris.
|
||||
* --with-ldns=/path/to/ldns
|
||||
If ldns is not detected on the system, a prepackaged tarball
|
||||
of the ldns library is used to compile and statically link against.
|
||||
If detected on the system, it will dynamically link against it.
|
||||
It will dynamically link against it.
|
||||
* --with-libevent=/path/to/libevent
|
||||
Can be set to either the system install or the build directory.
|
||||
--with-libevent=no (default) gives a builtin alternative
|
||||
@@ -28,10 +26,16 @@ This software is under BSD license, see LICENSE for details.
|
||||
of outgoing ports. This improves randomization and spoof
|
||||
resistance. For the default of 16 ports the builtin alternative
|
||||
works well and is a little faster.
|
||||
* --with-libexpat=/path/to/libexpat
|
||||
Can be set to the install directory of libexpat.
|
||||
* --without-pthreads
|
||||
This disables pthreads. Without this option the pthreads library
|
||||
is detected automatically. Use this option to disable threading
|
||||
altogether, or, on Solaris, also use --with(out)-solaris-threads.
|
||||
* --enable-checking
|
||||
This enables assertions in the code that guard against a variety of
|
||||
programming errors, among which buffer overflows. The program exits
|
||||
with an error if an assertion fails (but the buffer did not overflow).
|
||||
* --enable-static-exe
|
||||
This enables a debug option to statically link, against ldns and
|
||||
libevent libraries.
|
||||
@@ -55,6 +59,13 @@ This software is under BSD license, see LICENSE for details.
|
||||
* --with-chroot-dir=path
|
||||
Set default chroot directory,
|
||||
the default is /usr/local/etc/unbound.
|
||||
* --with-rootkey-file=path
|
||||
Set the default root.key path. This file is read and written.
|
||||
the default is /usr/local/etc/unbound/root.key
|
||||
* --with-rootcert-file=path
|
||||
Set the default root update certificate path. A builtin certificate
|
||||
is used if this file is empty or does not exist.
|
||||
the default is /usr/local/etc/unbound/icannbundle.pem
|
||||
* --with-username=user
|
||||
Set default user name to change to,
|
||||
the default is the "unbound" user.
|
||||
@@ -65,11 +76,10 @@ This software is under BSD license, see LICENSE for details.
|
||||
Compile the python module that processes responses in the server.
|
||||
* --disable-sha2
|
||||
Disable support for RSASHA256 and RSASHA512 crypto.
|
||||
* --enable-gost
|
||||
Enable draft support for GOST crypto.
|
||||
* --disable-gost
|
||||
Disable support for GOST crypto, RFC 5933.
|
||||
|
||||
* 'make test' attempts to run a series of tests, depending on the support
|
||||
programs that are installed.
|
||||
* 'make test' runs a series of self checks.
|
||||
|
||||
Known issues
|
||||
------------
|
||||
@@ -93,6 +103,7 @@ o The warning 'openssl has no entropy, seeding with time', with chroot
|
||||
o On Solaris 5.10 some libtool packages from repositories do not work with
|
||||
gcc, showing errors gcc: unrecognized option `-KPIC'
|
||||
To solve this do ./configure libtool=./libtool [your options...].
|
||||
On Solaris you may pass CFLAGS="-xO4 -xtarget=generic" if you use sun-cc.
|
||||
o If unbound-control (or munin graphs) do not work, this can often be because
|
||||
the unbound-control-setup script creates the keys with restricted
|
||||
permissions, and the files need to be made readable or ownered by both the
|
||||
@@ -111,4 +122,30 @@ o Other code origins are from the NSD (NLnet Labs) and LDNS (NLnet Labs)
|
||||
projects. Such as buffer, region-allocator and red-black tree code.
|
||||
o See Credits file for contributors.
|
||||
|
||||
|
||||
Your Support
|
||||
------------
|
||||
NLnet Labs offers all of its software products as open source, most are
|
||||
published under a BSD license. You can download them, not only from the
|
||||
NLnet Labs website but also through the various OS distributions for
|
||||
which NSD, ldns, and Unbound are packaged. We therefore have little idea
|
||||
who uses our software in production environments and have no direct ties
|
||||
with 'our customers'.
|
||||
|
||||
Therefore, we ask you to contact us at users@NLnetLabs.nl and tell us
|
||||
whether you use one of our products in your production environment,
|
||||
what that environment looks like, and maybe even share some praise.
|
||||
We would like to refer to the fact that your organization is using our
|
||||
products. We will only do that if you explicitly allow us. In all other
|
||||
cases we will keep the information you share with us to ourselves.
|
||||
|
||||
In addition to the moral support you can also support us
|
||||
financially. NLnet Labs is a recognized not-for-profit charity foundation
|
||||
that is chartered to develop open-source software and open-standards
|
||||
for the Internet. If you use our software to satisfaction please express
|
||||
that by giving us a donation. For small donations PayPal can be used. For
|
||||
larger and regular donations please contact us at users@NLnetLabs.nl. Also
|
||||
see http://www.nlnetlabs.nl/labs/contributors/.
|
||||
|
||||
|
||||
* mailto:unbound-bugs@nlnetlabs.nl
|
||||
|
||||
+6
-7
@@ -1,21 +1,20 @@
|
||||
README unbound tests
|
||||
|
||||
There is a test setup for unbound. Use
|
||||
For a quick test that runs unit tests and state machine tests, use
|
||||
make test
|
||||
To make and run the tests. The results are summarized at the end.
|
||||
|
||||
There is a long test setup for unbound that needs tools installed. Use
|
||||
make longtest
|
||||
To make and run the long tests. The results are summarized at the end.
|
||||
|
||||
You need to have the following programs installed and in your PATH.
|
||||
* dig - from the bind-tools package. Used to send DNS queries.
|
||||
* splint (optional) - for lint test
|
||||
* doxygen (optional) - for doc completeness test
|
||||
* ldns-testns (optional) - from ldns examples. Used as DNS auth server.
|
||||
* ldns-testns - from ldns examples. Used as DNS auth server.
|
||||
* xxd and nc (optional) - for (malformed) packet transmission.
|
||||
The optional programs are detected and can be omitted.
|
||||
|
||||
Without any support programs, unittest and testbound can still be used.
|
||||
(cd testdata; ../testcode/mini_tpkg.sh exe 02-unittest.tpkg)
|
||||
(cd testdata; ../testcode/mini_tpkg.sh exe 03-testbound.tpkg)
|
||||
|
||||
testdata/ contains the data for tests.
|
||||
testcode/ contains scripts and c code for the tests.
|
||||
|
||||
|
||||
@@ -69,3 +69,8 @@ later
|
||||
document high scalable, high available unbound setup onepager.
|
||||
- prefetch DNSKEY when DS in delegation seen (nonCD, underTA).
|
||||
- use libevent if available on system by default(?), default outgoing 256to1024
|
||||
|
||||
[1] BIND-like query logging to see who's looking up what and when
|
||||
[2] more logging about stuff like SERVFAIL and REFUSED responses
|
||||
[3] a Makefile that works without gnumake
|
||||
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
|
||||
Specification for the unbound-control protocol.
|
||||
|
||||
Server listens on 953 TCP (localhost by default). Client connects,
|
||||
Server listens on 8953 TCP (localhost by default). Client connects,
|
||||
SSLv3 or TLSv1 connection setup (server selfsigned certificate,
|
||||
client has cert signed by server certificate).
|
||||
|
||||
Port 8953 is registered with IANA as:
|
||||
ub-dns-control 8953/tcp unbound dns nameserver control
|
||||
# Wouter Wijngaards <wouter&nlnetlabs.nl> 10 May 2011
|
||||
On may 11 2011, ticket [IANA #442315].
|
||||
|
||||
Query and Response
|
||||
------------------
|
||||
Client sends
|
||||
UBCT [commandline] \n
|
||||
fixed string UBCT, then an ascii text line, with a command,
|
||||
some whitespace allowed. Line ends with '\n'.
|
||||
UBCT[version] [commandline] \n
|
||||
fixed string UBCT1 (for version 1), then an ascii text line,
|
||||
with a command, some whitespace allowed. Line ends with '\n'.
|
||||
|
||||
Server executes command. And sends reply in ascii text over channel,
|
||||
closes the channel when done.
|
||||
@@ -62,5 +67,4 @@ local_data <resource record string>
|
||||
local_data_add www.example.com. IN A 192.0.2.2
|
||||
if no local_zone exists for it; a transparent zone with the same
|
||||
name as the data is created.
|
||||
|
||||
|
||||
Other commands in the unbound-control manual page.
|
||||
|
||||
+48
-13
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Example configuration file.
|
||||
#
|
||||
# See unbound.conf(5) man page.
|
||||
# See unbound.conf(5) man page, version @version@.
|
||||
#
|
||||
# this is a comment.
|
||||
|
||||
@@ -54,8 +54,9 @@ server:
|
||||
# outgoing-interface: 2001:DB8::6
|
||||
|
||||
# number of ports to allocate per thread, determines the size of the
|
||||
# port range that can be open simultaneously.
|
||||
# outgoing-range: 256
|
||||
# port range that can be open simultaneously. About double the
|
||||
# num-queries-per-thread, or, use as many as the OS will allow you.
|
||||
# outgoing-range: 4096
|
||||
|
||||
# permit unbound to use this port number or port range for
|
||||
# making outgoing queries, using an outgoing interface.
|
||||
@@ -78,6 +79,10 @@ server:
|
||||
# 0 is system default. Use 4m to catch query spikes for busy servers.
|
||||
# so-rcvbuf: 0
|
||||
|
||||
# buffer size for UDP port 53 outgoing (SO_SNDBUF socket option).
|
||||
# 0 is system default. Use 4m to handle spikes on very busy servers.
|
||||
# so-sndbuf: 0
|
||||
|
||||
# EDNS reassembly buffer to advertise to UDP peers (the actual buffer
|
||||
# is set with msg-buffer-size). 1480 can solve fragmentation (timeouts).
|
||||
# edns-buffer-size: 4096
|
||||
@@ -148,6 +153,10 @@ server:
|
||||
# Enable TCP, "yes" or "no".
|
||||
# do-tcp: yes
|
||||
|
||||
# upstream connections use TCP only (and no UDP), "yes" or "no"
|
||||
# useful for tunneling scenarios, default no.
|
||||
# tcp-upstream: no
|
||||
|
||||
# Detach from the terminal, run in background, "yes" or "no".
|
||||
# do-daemonize: yes
|
||||
|
||||
@@ -207,6 +216,9 @@ server:
|
||||
|
||||
# print UTC timestamp in ascii to logfile, default is epoch in seconds.
|
||||
# log-time-ascii: no
|
||||
|
||||
# print one line with time, IP, name, type, class for every query.
|
||||
# log-queries: no
|
||||
|
||||
# the pid file. Can be an absolute path outside of chroot/work dir.
|
||||
# pidfile: "@UNBOUND_PIDFILE@"
|
||||
@@ -252,6 +264,9 @@ server:
|
||||
# Default on, which insists on dnssec data for trust-anchored zones.
|
||||
# harden-dnssec-stripped: yes
|
||||
|
||||
# Harden against queries that fall under dnssec-signed nxdomain names.
|
||||
# harden-below-nxdomain: no
|
||||
|
||||
# Harden the referral path by performing additional queries for
|
||||
# infrastructure data. Validates the replies (if possible).
|
||||
# Default off, because the lookups burden the server. Experimental
|
||||
@@ -270,7 +285,7 @@ server:
|
||||
# private-address: 10.0.0.0/8
|
||||
# private-address: 172.16.0.0/12
|
||||
# private-address: 192.168.0.0/16
|
||||
# private-address: 192.254.0.0/16
|
||||
# private-address: 169.254.0.0/16
|
||||
# private-address: fd00::/8
|
||||
# private-address: fe80::/10
|
||||
|
||||
@@ -294,10 +309,26 @@ server:
|
||||
# if no, localhost can be queried (for testing and debugging).
|
||||
# do-not-query-localhost: yes
|
||||
|
||||
# if yes, perform prefetching of almost expired message cache entries.
|
||||
# prefetch: no
|
||||
|
||||
# if yes, perform key lookups adjacent to normal lookups.
|
||||
# prefetch-key: no
|
||||
|
||||
# module configuration of the server. A string with identifiers
|
||||
# separated by spaces. "iterator" or "validator iterator"
|
||||
# module-config: "validator iterator"
|
||||
|
||||
# File with trusted keys, kept uptodate using RFC5011 probes,
|
||||
# initial file like trust-anchor-file, then it stores metadata.
|
||||
# Use several entries, one per domain name, to track multiple zones.
|
||||
#
|
||||
# If you want to perform DNSSEC validation, run unbound-anchor before
|
||||
# you start unbound (i.e. in the system boot scripts). And enable:
|
||||
# Please note usage of unbound-anchor root anchor is at your own risk
|
||||
# and under the terms of our LICENSE (see that file in the source).
|
||||
# auto-trust-anchor-file: "@UNBOUND_ROOTKEY_FILE@"
|
||||
|
||||
# File with DLV trusted keys. Same format as trust-anchor-file.
|
||||
# There can be only one DLV configured, it is trusted from root down.
|
||||
# Download http://ftp.isc.org/www/dlv/dlv.isc.org.key
|
||||
@@ -306,15 +337,12 @@ server:
|
||||
# File with trusted keys for validation. Specify more than one file
|
||||
# with several entries, one file per entry.
|
||||
# Zone file format, with DS and DNSKEY entries.
|
||||
# Note this gets out of date, use auto-trust-anchor-file please.
|
||||
# trust-anchor-file: ""
|
||||
|
||||
# File with trusted keys, kept uptodate using RFC5011 probes,
|
||||
# initial file like trust-anchor-file, then it stores metadata.
|
||||
# Use several entries, one per domain name, to track multiple zones.
|
||||
# auto-trust-anchor-file: ""
|
||||
|
||||
# Trusted key for validation. DS or DNSKEY. specify the RR on a
|
||||
# single line, surrounded by "". TTL is ignored. class is IN default.
|
||||
# Note this gets out of date, use auto-trust-anchor-file please.
|
||||
# (These examples are from August 2007 and may not be valid anymore).
|
||||
# trust-anchor: "nlnetlabs.nl. DNSKEY 257 3 5 AQPzzTWMz8qSWIQlfRnPckx2BiVmkVN6LPupO3mbz7FhLSnm26n6iG9N Lby97Ji453aWZY3M5/xJBSOS2vWtco2t8C0+xeO1bc/d6ZTy32DHchpW 6rDH1vp86Ll+ha0tmwyy9QP7y2bVw5zSbFCrefk8qCUBgfHm9bHzMG1U BYtEIQ=="
|
||||
# trust-anchor: "jelte.nlnetlabs.nl. DS 42860 5 1 14D739EB566D2B1A5E216A0BA4D17FA9B038BE4A"
|
||||
@@ -323,6 +351,7 @@ server:
|
||||
# with several entries, one file per entry. Like trust-anchor-file
|
||||
# but has a different file format. Format is BIND-9 style format,
|
||||
# the trusted-keys { name flag proto algo "key"; }; clauses are read.
|
||||
# you need external update procedures to track changes in keys.
|
||||
# trusted-keys-file: ""
|
||||
|
||||
# Ignore chain of trust. Domain is treated as insecure.
|
||||
@@ -330,7 +359,7 @@ server:
|
||||
|
||||
# Override the date for validation with a specific fixed date.
|
||||
# Do not set this unless you are debugging signature inception
|
||||
# and expiration. "" or "0" turns the feature off.
|
||||
# and expiration. "" or "0" turns the feature off. -1 ignores date.
|
||||
# val-override-date: ""
|
||||
|
||||
# The time to live for bogus data, rrsets and messages. This avoids
|
||||
@@ -338,7 +367,7 @@ server:
|
||||
# val-bogus-ttl: 60
|
||||
|
||||
# The signature inception and expiration dates are allowed to be off
|
||||
# by 10% of the lifetime of the signature from our local clock.
|
||||
# by 10% of the signature lifetime (expir-incep) from our local clock.
|
||||
# This leeway is capped with a minimum and a maximum. In seconds.
|
||||
# val-sig-skew-min: 3600
|
||||
# val-sig-skew-max: 86400
|
||||
@@ -356,8 +385,13 @@ server:
|
||||
# replies if the message is found secure. The default is off.
|
||||
# val-permissive-mode: no
|
||||
|
||||
# Ignore the CD flag in incoming queries and refuse them bogus data.
|
||||
# Enable it if the only clients of unbound are legacy servers (w2008)
|
||||
# that set CD but cannot validate themselves.
|
||||
# ignore-cd-flag: no
|
||||
|
||||
# Have the validator log failed validations for your diagnosis.
|
||||
# 0: off. 1: A line per failed user query.
|
||||
# 0: off. 1: A line per failed user query. 2: With reason and bad IP.
|
||||
# val-log-level: 0
|
||||
|
||||
# It is possible to configure NSEC3 maximum iteration counts per
|
||||
@@ -398,6 +432,7 @@ server:
|
||||
# o transparent gives local data, but resolves normally for other names
|
||||
# o redirect serves the zone data for any subdomain in the zone.
|
||||
# o nodefault can be used to normally resolve AS112 zones.
|
||||
# o typetransparent resolves normally for other types and other names
|
||||
#
|
||||
# defaults are localhost address, reverse for 127.0.0.1 and ::1
|
||||
# and nxdomain for AS112 zones. If you configure one of these zones
|
||||
@@ -444,7 +479,7 @@ remote-control:
|
||||
# control-interface: ::1
|
||||
|
||||
# port number for remote control operations.
|
||||
# control-port: 953
|
||||
# control-port: 8953
|
||||
|
||||
# unbound server key file.
|
||||
# server-key-file: "@UNBOUND_RUN_DIR@/unbound_server.key"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
.B ub_ctx_create,
|
||||
.B ub_ctx_delete,
|
||||
.B ub_ctx_set_option,
|
||||
.B ub_ctx_get_option,
|
||||
.B ub_ctx_config,
|
||||
.B ub_ctx_set_fwd,
|
||||
.B ub_ctx_resolvconf,
|
||||
@@ -56,6 +57,9 @@
|
||||
\fBub_ctx_set_option\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR opt, \fIchar*\fR val);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_get_option\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR opt, \fIchar**\fR val);
|
||||
.LP
|
||||
\fIint\fR
|
||||
\fBub_ctx_config\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR fname);
|
||||
.LP
|
||||
\fIint\fR
|
||||
@@ -178,6 +182,11 @@ config file format, see \fIunbound.conf\fR(5). Not all options are
|
||||
relevant. For some specific options, such as adding trust anchors, special
|
||||
routines exist. Pass the option name with the trailing ':'.
|
||||
.TP
|
||||
.B ub_ctx_get_option
|
||||
A power\-user interface that gets an option value. Some options cannot be
|
||||
gotten, and others return a newline separated list. Pass the option name
|
||||
without trailing ':'. The returned value must be free(2)d by the caller.
|
||||
.TP
|
||||
.B ub_ctx_config
|
||||
A power\-user interface that lets you specify an unbound config file, see
|
||||
\fIunbound.conf\fR(5), which is read for configuration. Not all options are
|
||||
|
||||
@@ -281,3 +281,14 @@ o Parent and child with different nameserver information.
|
||||
those misconfigured domains where the servers reported by the parent
|
||||
are the only ones working, and servers reported by the child do not.
|
||||
|
||||
o Failure of validation and probing.
|
||||
Retries on a validation failure are now 5x to a different nameserver IP
|
||||
(if possible), and then it gives up, for one name, type, class entry in
|
||||
the message cache. If a DNSKEY or DS fails in the chain of trust in the
|
||||
key cache additionally, after the probing, a bad key entry is created that
|
||||
makes the entire zone bogus for 900 seconds. This is a fixed value at
|
||||
this time and is conservative in sending probes. It makes the compound
|
||||
effect of many resolvers less and easier to handle, but penalizes
|
||||
individual resolvers by having less probes and a longer time before fixes
|
||||
are picked up.
|
||||
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
.TH "unbound-anchor" "8" "@date@" "NLnet Labs" "unbound @version@"
|
||||
.\"
|
||||
.\" unbound-anchor.8 -- unbound anchor maintenance utility manual
|
||||
.\"
|
||||
.\" Copyright (c) 2008, NLnet Labs. All rights reserved.
|
||||
.\"
|
||||
.\" See LICENSE for the license.
|
||||
.\"
|
||||
.\"
|
||||
.SH "NAME"
|
||||
.LP
|
||||
.B unbound\-anchor
|
||||
\- Unbound anchor utility.
|
||||
.SH "SYNOPSIS"
|
||||
.B unbound\-anchor
|
||||
.RB [ opts ]
|
||||
.SH "DESCRIPTION"
|
||||
.B Unbound\-anchor
|
||||
performs setup or update of the root trust anchor for DNSSEC validation.
|
||||
It can be run (as root) from the commandline, or run as part of startup
|
||||
scripts. Before you start the \fIunbound\fR(8) DNS server.
|
||||
.P
|
||||
Suggested usage:
|
||||
.P
|
||||
.nf
|
||||
# in the init scripts.
|
||||
# provide or update the root anchor (if necessary)
|
||||
unbound-anchor -a "@UNBOUND_ROOTKEY_FILE@"
|
||||
# Please note usage of this root anchor is at your own risk
|
||||
# and under the terms of our LICENSE (see source).
|
||||
#
|
||||
# start validating resolver
|
||||
# the unbound.conf contains:
|
||||
# auto-trust-anchor-file: "@UNBOUND_ROOTKEY_FILE@"
|
||||
unbound -c unbound.conf
|
||||
.fi
|
||||
.P
|
||||
This tool provides builtin default contents for the root anchor and root
|
||||
update certificate files.
|
||||
.P
|
||||
It tests if the root anchor file works, and if not, and an update is possible,
|
||||
attempts to update the root anchor using the root update certificate.
|
||||
It performs a https fetch of root-anchors.xml and checks the results, if
|
||||
all checks are successful, it updates the root anchor file. Otherwise
|
||||
the root anchor file is unchanged. It performs RFC5011 tracking if the
|
||||
DNSSEC information available via the DNS makes that possible.
|
||||
.P
|
||||
If does not perform an update if the certificate is expired, if the network
|
||||
is down or other errors occur.
|
||||
.P
|
||||
The available options are:
|
||||
.TP
|
||||
.B \-a \fIfile
|
||||
The root anchor key file, that is read in and written out.
|
||||
Default is @UNBOUND_ROOTKEY_FILE@.
|
||||
If the file does not exist, or is empty, a builtin root key is written to it.
|
||||
.TP
|
||||
.B \-c \fIfile
|
||||
The root update certificate file, that is read in.
|
||||
Default is @UNBOUND_ROOTCERT_FILE@.
|
||||
If the file does not exist, or is empty, a builtin certificate is used.
|
||||
.TP
|
||||
.B \-l
|
||||
List the builtin root key and builtin root update certificate on stdout.
|
||||
.TP
|
||||
.B \-u \fIname
|
||||
The server name, it connects to https://name. Specify without https:// prefix.
|
||||
The default is "data.iana.org". It connects to the port specified with \-P.
|
||||
You can pass an IPv4 addres or IPv6 address (no brackets) if you want.
|
||||
.TP
|
||||
.B \-x \fIpath
|
||||
The pathname to the root\-anchors.xml file on the server. (forms URL with \-u).
|
||||
The default is /root\-anchors/root\-anchors.xml.
|
||||
.TP
|
||||
.B \-s \fIpath
|
||||
The pathname to the root\-anchors.p7s file on the server. (forms URL with \-u).
|
||||
The default is /root\-anchors/root\-anchors.p7s. This file has to be a PKCS7
|
||||
signature over the xml file, using the pem file (\-c) as trust anchor.
|
||||
.TP
|
||||
.B \-4
|
||||
Use IPv4 for domain resolution and contacting the server on https. Default is
|
||||
to use IPv4 and IPv6 where appropriate.
|
||||
.TP
|
||||
.B \-6
|
||||
Use IPv6 for domain resolution and contacting the server on https. Default is
|
||||
to use IPv4 and IPv6 where appropriate.
|
||||
.TP
|
||||
.B \-f \fIresolv.conf
|
||||
Use the given resolv.conf file. Not enabled by default, but you could try to
|
||||
pass /etc/resolv.conf on some systems. It contains the IP addresses of the
|
||||
recursive nameservers to use. However, since this tool could be used to
|
||||
bootstrap that very recursive nameserver, it would not be useful (since
|
||||
that server is not up yet, since we are bootstrapping it). It could be
|
||||
useful in a situation where you know an upstream cache is deployed (and
|
||||
running) and in captive portal situations.
|
||||
.TP
|
||||
.B \-r \fIroot.hints
|
||||
Use the given root.hints file (same syntax as the BIND and Unbound root hints
|
||||
file) to bootstrap domain resolution. By default a list of builtin root
|
||||
hints is used. Unbound\-anchor goes to the network itself for these roots,
|
||||
to resolve the server (\-u option) and to check the root DNSKEY records.
|
||||
It does so, because the tool when used for bootstrapping the recursive
|
||||
resolver, cannot use that recursive resolver itself because it is bootstrapping
|
||||
that server.
|
||||
.TP
|
||||
.B \-v
|
||||
More verbose. Once prints informational messages, multiple times may enable
|
||||
large debug amounts (such as full certificates or byte\-dumps of downloaded
|
||||
files). By default it prints almost nothing. It also prints nothing on
|
||||
errors by default; in that case the original root anchor file is simply
|
||||
left undisturbed, so that a recursive server can start right after it.
|
||||
.TP
|
||||
.B \-C \fIunbound.conf
|
||||
Debug option to read unbound.conf into the resolver process used.
|
||||
.TP
|
||||
.B \-P \fIport
|
||||
Set the port number to use for the https connection. The default is 443.
|
||||
.TP
|
||||
.B \-F
|
||||
Debug option to force update of the root anchor through downloading the xml
|
||||
file and verifying it with the certificate. By default it first tries to
|
||||
update by contacting the DNS, which uses much less bandwidth, is much
|
||||
faster (200 msec not 2 sec), and is nicer to the deployed infrastructure.
|
||||
With this option, it still attempts to do so (and may verbosely tell you),
|
||||
but then ignores the result and goes on to use the xml fallback method.
|
||||
.TP
|
||||
.B \-h
|
||||
Show the version and commandline option help.
|
||||
.TP
|
||||
.B \-v
|
||||
More verbose. Prints output detailing what happens.
|
||||
.SH "EXIT CODE"
|
||||
This tool exits with value 1 if the root anchor was updated using the
|
||||
certificate or if the builtin root-anchor was used. It exits with code
|
||||
0 if no update was necessary, if the update was possible with RFC5011
|
||||
tracking, or if an error occurred.
|
||||
.P
|
||||
You can check the exit value in this manner:
|
||||
.nf
|
||||
unbound-anchor -a "root.key" || logger "Please check root.key"
|
||||
.fi
|
||||
Or something more suitable for your operational environment.
|
||||
.SH "TRUST"
|
||||
The root keys and update certificate included in this tool
|
||||
are provided for convenience and under the terms of our
|
||||
license (see the LICENSE file in the source distribution or
|
||||
http://unbound.nlnetlabs.nl/svn/trunk/LICENSE) and might be stale or
|
||||
not suitable to your purpose.
|
||||
.P
|
||||
By running "unbound\-anchor \-l" the keys and certificate that are
|
||||
configured in the code are printed for your convenience.
|
||||
.P
|
||||
The build\-in configuration can be overridden by providing a root\-cert
|
||||
file and a rootkey file.
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I @UNBOUND_ROOTKEY_FILE@
|
||||
The root anchor file, updated with 5011 tracking, and read and written to.
|
||||
The file is created if it does not exist.
|
||||
.TP
|
||||
.I @UNBOUND_ROOTCERT_FILE@
|
||||
The trusted self\-signed certificate that is used to verify the downloaded
|
||||
DNSSEC root trust anchor. You can update it by fetching it from
|
||||
https://data.iana.org/root\-anchors/icannbundle.pem (and validate it).
|
||||
If the file does not exist or is empty, a builtin version is used.
|
||||
.TP
|
||||
.I https://data.iana.org/root\-anchors/root\-anchors.xml
|
||||
Source for the root key information.
|
||||
.TP
|
||||
.I https://data.iana.org/root\-anchors/root\-anchors.p7s
|
||||
Signature on the root key information.
|
||||
.SH "SEE ALSO"
|
||||
\fIunbound.conf\fR(5),
|
||||
\fIunbound\fR(8).
|
||||
@@ -57,6 +57,11 @@ Change verbosity value for logging. Same values as \fBverbosity\fR keyword in
|
||||
\fIunbound.conf\fR(5). This new setting lasts until the server is issued
|
||||
a reload (taken from config file again), or the next verbosity control command.
|
||||
.TP
|
||||
.B log_reopen
|
||||
Reopen the logfile, close and open it. Useful for logrotation to make the
|
||||
daemon release the file it is logging to. If you are using syslog it will
|
||||
attempt to close and open the syslog (which may not work if chrooted).
|
||||
.TP
|
||||
.B stats
|
||||
Print statistics. Resets the internal counters to zero, this can be
|
||||
controlled using the \fBstatistics\-cumulative\fR config statement.
|
||||
@@ -137,7 +142,55 @@ Show what is worked on. Prints all queries that the server is currently
|
||||
working on. Prints the time that users have been waiting. For internal
|
||||
requests, no time is printed. And then prints out the module status.
|
||||
.TP
|
||||
.B forward [off | addr ... ]
|
||||
.B flush_infra \fIall|IP
|
||||
If all then entire infra cache is emptied. If a specific IP address, the
|
||||
entry for that address is removed from the cache. It contains EDNS, ping
|
||||
and lameness data.
|
||||
.TP
|
||||
.B dump_infra
|
||||
Show the contents of the infra cache.
|
||||
.TP
|
||||
.B set_option \fIopt: val
|
||||
Set the option to the given value without a reload. The cache is
|
||||
therefore not flushed. The option must end with a ':' and whitespace
|
||||
must be between the option and the value. Some values may not have an
|
||||
effect if set this way, the new values are not written to the config file,
|
||||
not all options are supported. This is different from the set_option call
|
||||
in libunbound, where all values work because unbound has not been inited.
|
||||
.IP
|
||||
The values that work are: statistics\-interval, statistics\-cumulative,
|
||||
do\-not\-query\-localhost, harden\-short\-bufsize, harden\-large\-queries,
|
||||
harden\-glue, harden\-dnssec\-stripped, harden\-below\-nxdomain,
|
||||
harden\-referral\-path, prefetch, prefetch\-key, log\-queries,
|
||||
hide\-identity, hide\-version, identity, version, val\-log\-level,
|
||||
val\-log\-squelch, ignore\-cd\-flag, add\-holddown, del\-holddown,
|
||||
keep\-missing, tcp\-upstream.
|
||||
.TP
|
||||
.B get_option \fIopt
|
||||
Get the value of the option. Give the option name without a trailing ':'.
|
||||
The value is printed. If the value is "", nothing is printed
|
||||
and the connection closes. On error 'error ...' is printed (it gives
|
||||
a syntax error on unknown option). For some options a list of values,
|
||||
one on each line, is printed. The options are shown from the config file
|
||||
as modified with set_option. For some options an override may have been
|
||||
taken that does not show up with this command, not results from e.g. the
|
||||
verbosity and forward control commands. Not all options work, see list_stubs,
|
||||
list_forwards, list_local_zones and list_local_data for those.
|
||||
.TP
|
||||
.B list_stubs
|
||||
List the stub zones in use. These are printed one by one to the output.
|
||||
This includes the root hints in use.
|
||||
.TP
|
||||
.B list_forwards
|
||||
List the forward zones in use. These are printed zone by zone to the output.
|
||||
.TP
|
||||
.B list_local_zones
|
||||
List the local zones in use. These are printed one per line with zone type.
|
||||
.TP
|
||||
.B list_local_data
|
||||
List the local data RRs in use. The resource records are printed.
|
||||
.TP
|
||||
.B forward \fR[\fIoff\fR | \fIaddr ...\fR ]
|
||||
Setup forwarding mode. Configures if the server should ask other upstream
|
||||
nameservers, should go to the internet root nameservers itself, or show
|
||||
the current config. You could pass the nameservers after a DHCP update.
|
||||
@@ -163,8 +216,10 @@ The unbound\-control program exits with status code 1 on error, 0 on success.
|
||||
The setup requires a self\-signed certificate and private keys for both
|
||||
the server and client. The script \fIunbound\-control\-setup\fR generates
|
||||
these in the default run directory, or with \-d in another directory.
|
||||
If you change the access control permissions on the key files you can decide
|
||||
who can use unbound\-control, by default owner and group but not all users.
|
||||
Run the script under the same username as you have configured in unbound.conf
|
||||
so that the daemon is permitted to read the files, for example with:
|
||||
or as root, so that the daemon is permitted to read the files, for example with:
|
||||
.nf
|
||||
sudo \-u unbound unbound\-control\-setup
|
||||
.fi
|
||||
@@ -186,6 +241,13 @@ number of queries that were successfully answered using a cache lookup
|
||||
.I threadX.num.cachemiss
|
||||
number of queries that needed recursive processing
|
||||
.TP
|
||||
.I threadX.num.prefetch
|
||||
number of cache prefetches performed. This number is included in
|
||||
cachehits, as the original query had the unprefetched answer from cache,
|
||||
and resulted in recursive processing, taking a slot in the requestlist.
|
||||
Not part of the recursivereplies (or the histogram thereof) or cachemiss,
|
||||
as a cache response was sent.
|
||||
.TP
|
||||
.I threadX.num.recursivereplies
|
||||
The number of replies sent to queries that needed recursive processing. Could be smaller than threadX.num.cachemiss if due to timeouts no replies were sent for some queries.
|
||||
.TP
|
||||
@@ -227,6 +289,9 @@ summed over threads.
|
||||
.I total.num.cachemiss
|
||||
summed over threads.
|
||||
.TP
|
||||
.I total.num.prefetch
|
||||
summed over threads.
|
||||
.TP
|
||||
.I total.num.recursivereplies
|
||||
summed over threads.
|
||||
.TP
|
||||
|
||||
+110
-35
@@ -92,7 +92,10 @@ The verbosity can also be increased from the commandline, see \fIunbound\fR(8).
|
||||
.TP
|
||||
.B statistics\-interval: \fI<seconds>
|
||||
The number of seconds between printing statistics to the log for every thread.
|
||||
Disable with value 0 or "". Default is disabled.
|
||||
Disable with value 0 or "". Default is disabled. The histogram statistics
|
||||
are only printed if replies were sent during the statistics interval,
|
||||
requestlist statistics are printed for every interval (but can be 0).
|
||||
This is because the median calculation requires data to be present.
|
||||
.TP
|
||||
.B statistics\-cumulative: \fI<yes or no>
|
||||
If enabled, statistics are cumulative since starting unbound, without clearing
|
||||
@@ -100,7 +103,8 @@ the statistics counters after logging the statistics. Default is no.
|
||||
.TP
|
||||
.B extended\-statistics: \fI<yes or no>
|
||||
If enabled, extended statistics are printed from \fIunbound\-control\fR(8).
|
||||
Default is off, because keeping track of more statistics takes time.
|
||||
Default is off, because keeping track of more statistics takes time. The
|
||||
counters are listed in \fIunbound\-control\fR(8).
|
||||
.TP
|
||||
.B num\-threads: \fI<number>
|
||||
The number of threads to create to serve clients. Use 1 for no threading.
|
||||
@@ -120,9 +124,8 @@ interface and port number), if not specified the default port (from
|
||||
.TP
|
||||
.B interface\-automatic: \fI<yes or no>
|
||||
Detect source interface on UDP queries and copy them to replies. This
|
||||
feature is experimental, and needs support in your OS for IPv6
|
||||
(and its socket options) and IPv4 (and have source\-interface socket options).
|
||||
Default value is no.
|
||||
feature is experimental, and needs support in your OS for particular socket
|
||||
options. Default value is no.
|
||||
.TP
|
||||
.B outgoing\-interface: \fI<ip address>
|
||||
Interface to use to connect to the network. This interface is used to send
|
||||
@@ -137,8 +140,9 @@ sent via a random outgoing interface to counter spoofing.
|
||||
.TP
|
||||
.B outgoing\-range: \fI<number>
|
||||
Number of ports to open. This number of file descriptors can be opened per
|
||||
thread. Must be at least 1. Default is 256. Larger numbers need extra
|
||||
resources from the operating system.
|
||||
thread. Must be at least 1. Default depends on compile options. Larger
|
||||
numbers need extra resources from the operating system. For performance a
|
||||
a very large value is best, use libevent to make this possible.
|
||||
.TP
|
||||
.B outgoing\-port\-permit: \fI<port number or range>
|
||||
Permit unbound to open this port or range of ports for use to send queries.
|
||||
@@ -201,7 +205,7 @@ The number of queries that every thread will service simultaneously.
|
||||
If more queries arrive that need servicing, and no queries can be jostled out
|
||||
(see \fIjostle\-timeout\fR), then the queries are dropped. This forces
|
||||
the client to resend after a timeout; allowing the server time to work on
|
||||
the existing queries. Default 1024.
|
||||
the existing queries. Default depends on compile options, 512 or 1024.
|
||||
.TP
|
||||
.B jostle\-timeout: \fI<msec>
|
||||
Timeout used when the server is very busy. Set to a value that usually
|
||||
@@ -210,6 +214,11 @@ arrive, then 50% of the queries are allowed to run to completion, and
|
||||
the other 50% are replaced with the new incoming query if they have already
|
||||
spent more than their allowed time. This protects against denial of
|
||||
service by slow queries or high query rates. Default 200 milliseconds.
|
||||
The effect is that the qps for long-lasting queries is about
|
||||
(numqueriesperthread / 2) / (average time for such long queries) qps.
|
||||
The qps for short queries can be about (numqueriesperthread / 2)
|
||||
/ (jostletimeout in whole seconds) qps per thread, about (1024/2)*5 = 2560
|
||||
qps by default.
|
||||
.TP
|
||||
.B so\-rcvbuf: \fI<number>
|
||||
If not 0, then set the SO_RCVBUF socket option to get more buffer
|
||||
@@ -222,6 +231,17 @@ net.core.rmem_max. On BSD change kern.ipc.maxsockbuf in /etc/sysctl.conf.
|
||||
On OpenBSD change header and recompile kernel. On Solaris ndd \-set
|
||||
/dev/udp udp_max_buf 8388608.
|
||||
.TP
|
||||
.B so\-sndbuf: \fI<number>
|
||||
If not 0, then set the SO_SNDBUF socket option to get more buffer space on
|
||||
UDP port 53 outgoing queries. This for very busy servers handles spikes
|
||||
in answer traffic, otherwise 'send: resource temporarily unavailable'
|
||||
can get logged, the buffer overrun is also visible by netstat \-su.
|
||||
Default is 0 (use system value). Specify the number of bytes to ask
|
||||
for, try "4m" on a very busy server. The OS caps it at a maximum, on
|
||||
linux unbound needs root permission to bypass the limit, or the admin
|
||||
can use sysctl net.core.wmem_max. On BSD, Solaris changes are similar
|
||||
to so\-rcvbuf.
|
||||
.TP
|
||||
.B rrset\-cache\-size: \fI<number>
|
||||
Number of bytes size of the RRset cache. Default is 4 megabytes.
|
||||
A plain number is in bytes, append 'k', 'm' or 'g' for kilobytes, megabytes
|
||||
@@ -280,6 +300,10 @@ Enable or disable whether UDP queries are answered or issued. Default is yes.
|
||||
.B do\-tcp: \fI<yes or no>
|
||||
Enable or disable whether TCP queries are answered or issued. Default is yes.
|
||||
.TP
|
||||
.B tcp\-upstream: \fI<yes or no>
|
||||
Enable or disable whether the upstream queries use TCP only for transport.
|
||||
Default is no. Useful in tunneling scenarios.
|
||||
.TP
|
||||
.B do\-daemonize: \fI<yes or no>
|
||||
Enable or disable whether the unbound server forks into the background as
|
||||
a daemon. Default is yes.
|
||||
@@ -375,6 +399,12 @@ Sets logfile lines to use a timestamp in UTC ascii. Default is no, which
|
||||
prints the seconds since 1970 in brackets. No effect if using syslog, in
|
||||
that case syslog formats the timestamp printed into the log files.
|
||||
.TP
|
||||
.B log\-queries: \fI<yes or no>
|
||||
Prints one line per query to the log, with the log timestamp and IP address,
|
||||
name, type and class. Default is no. Note that it takes time to print these
|
||||
lines which makes the server (significantly) slower. Odd (nonprintable)
|
||||
characters in names are printed as '?'.
|
||||
.TP
|
||||
.B pidfile: \fI<filename>
|
||||
The process id is written to the file. Default is "@UNBOUND_PIDFILE@".
|
||||
So,
|
||||
@@ -446,6 +476,15 @@ removes DNSSEC data from packets, or a zone changes from signed to
|
||||
unsigned to badly signed often. If turned off you run the risk of a
|
||||
downgrade attack that disables security for a zone. Default is on.
|
||||
.TP
|
||||
.B harden\-below\-nxdomain: \fI<yes or no>
|
||||
From draft-vixie-dnsext-resimprove, returns nxdomain to queries for a name
|
||||
below another name that is already known to be nxdomain. DNSSEC mandates
|
||||
noerror for empty nonterminals, hence this is possible. Very old software
|
||||
might return nxdomain for empty nonterminals (that usually happen for reverse
|
||||
IP address lookups), and thus may be incompatible with this. To try to avoid
|
||||
this only DNSSEC-secure nxdomains are used, because the old software does not
|
||||
have DNSSEC. Default is off.
|
||||
.TP
|
||||
.B harden\-referral\-path: \fI<yes or no>
|
||||
Harden the referral path by performing additional queries for
|
||||
infrastructure data. Validates the replies if trust anchors are configured
|
||||
@@ -455,6 +494,8 @@ path to the answer.
|
||||
Default off, because it burdens the authority servers, and it is
|
||||
not RFC standard, and could lead to performance problems because of the
|
||||
extra query load that is generated. Experimental option.
|
||||
If you enable it consider adding more numbers after the target\-fetch\-policy
|
||||
to increase the max depth that is checked to.
|
||||
.TP
|
||||
.B use\-caps\-for\-id: \fI<yes or no>
|
||||
Use 0x20\-encoded random bits in the query to foil spoof attempts.
|
||||
@@ -476,7 +517,7 @@ that you configured is allowed to, and you can specify additional
|
||||
names using \fBprivate\-domain\fR. No private addresses are enabled
|
||||
by default. We consider to enable this for the RFC1918 private IP
|
||||
address space by default in later releases. That would enable private
|
||||
addresses for 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 192.254.0.0/16
|
||||
addresses for 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 169.254.0.0/16
|
||||
fd00::/8 and fe80::/10, since the RFC standards say these addresses
|
||||
should not be visible on the public internet. Turning on 127.0.0.0/8
|
||||
would hinder many spamblocklists as they use that.
|
||||
@@ -503,6 +544,17 @@ If yes, localhost is added to the do\-not\-query\-address entries, both
|
||||
IP6 ::1 and IP4 127.0.0.1/8. If no, then localhost can be used to send
|
||||
queries to. Default is yes.
|
||||
.TP
|
||||
.B prefetch: \fI<yes or no>
|
||||
If yes, message cache elements are prefetched before they expire to
|
||||
keep the cache up to date. Default is no. Turning it on gives about
|
||||
10 percent more traffic and load on the machine, but popular items do
|
||||
not expire from the cache.
|
||||
.TP
|
||||
.B prefetch-key: \fI<yes or no>
|
||||
If yes, fetch the DNSKEYs earlier in the validation process, when a DS
|
||||
record is encountered. This lowers the latency of requests. It does use
|
||||
a little more CPU. Also if the cache is set to 0, it is no use. Default is no.
|
||||
.TP
|
||||
.B module\-config: \fI<"module names">
|
||||
Module configuration, a list of module names separated by spaces, surround
|
||||
the string with quotes (""). The modules can be validator, iterator.
|
||||
@@ -566,21 +618,24 @@ externally can create validation failures for that internal domain.
|
||||
Default is "" or "0", which disables this debugging feature. If enabled by
|
||||
giving a RRSIG style date, that date is used for verifying RRSIG inception
|
||||
and expiration dates, instead of the current date. Do not set this unless
|
||||
you are debugging signature inception and expiration.
|
||||
you are debugging signature inception and expiration. The value \-1 ignores
|
||||
the date altogether, useful for some special applications.
|
||||
.TP
|
||||
.B val\-sig\-skew\-min: \fI<seconds>
|
||||
Minimum number of seconds of clock skew to apply to validated signatures.
|
||||
A value of 10% of the signature lifetime is used, capped by this setting.
|
||||
Default is 3600 (1 hour) which allows for daylight savings differences.
|
||||
Lower this value for more strict checking of short lived signatures.
|
||||
A value of 10% of the signature lifetime (expiration \- inception) is
|
||||
used, capped by this setting. Default is 3600 (1 hour) which allows for
|
||||
daylight savings differences. Lower this value for more strict checking
|
||||
of short lived signatures.
|
||||
.TP
|
||||
.B val\-sig\-skew\-max: \fI<seconds>
|
||||
Maximum number of seconds of clock skew to apply to validated signatures.
|
||||
A value of 10% of the signature lifetime is used, capped by this setting.
|
||||
Default is 86400 (24 hours) which allows for timezone setting problems in
|
||||
stable domains. Setting both min and max very low disables the clock skew
|
||||
allowances. Setting both min and max very high makes the validator check
|
||||
the signature timestamps less strictly.
|
||||
A value of 10% of the signature lifetime (expiration \- inception)
|
||||
is used, capped by this setting. Default is 86400 (24 hours) which
|
||||
allows for timezone setting problems in stable domains. Setting both
|
||||
min and max very low disables the clock skew allowances. Setting both
|
||||
min and max very high makes the validator check the signature timestamps
|
||||
less strictly.
|
||||
.TP
|
||||
.B val\-bogus\-ttl: \fI<number>
|
||||
The time to live for bogus data. This is data that has failed validation;
|
||||
@@ -596,11 +651,13 @@ to protect the users that rely on this validator for authentication from
|
||||
protentially bad data in the additional section.
|
||||
.TP
|
||||
.B val\-log\-level: \fI<number>
|
||||
Have the validator print validation failures to the log. Regardless of the
|
||||
verbosity setting. Default is 0, off. At 1, for every user query that fails
|
||||
a line is printed to the logs. This way you can monitor what happens with
|
||||
validation. Use a diagnosis tool, such as dig or drill, to find out why
|
||||
validation is failing for these queries.
|
||||
Have the validator print validation failures to the log. Regardless of
|
||||
the verbosity setting. Default is 0, off. At 1, for every user query
|
||||
that fails a line is printed to the logs. This way you can monitor what
|
||||
happens with validation. Use a diagnosis tool, such as dig or drill,
|
||||
to find out why validation is failing for these queries. At 2, not only
|
||||
the query that failed is printed but also the reason why unbound thought
|
||||
it was wrong and which server sent the faulty data.
|
||||
.TP
|
||||
.B val\-permissive\-mode: \fI<yes or no>
|
||||
Instruct the validator to mark bogus messages as indeterminate. The security
|
||||
@@ -610,6 +667,14 @@ receives the bogus data. For messages that are found to be secure the AD bit
|
||||
is set in replies. Also logging is performed as for full validation.
|
||||
The default value is "no".
|
||||
.TP
|
||||
.B ignore\-cd\-flag: \fI<yes or no>
|
||||
Instruct unbound to ignore the CD flag from clients and refuse to
|
||||
return bogus answers to them. Thus, the CD (Checking Disabled) flag
|
||||
does not disable checking any more. This is useful if legacy (w2008)
|
||||
servers that set the CD flag but cannot validate DNSSEC themselves are
|
||||
the clients, and then unbound provides them with DNSSEC protection.
|
||||
The default value is "no".
|
||||
.TP
|
||||
.B val\-nsec3\-keysize\-iterations: \fI<"list of values">
|
||||
List of keysize and iteration count values, separated by spaces, surrounded
|
||||
by quotes. Default is "1024 150 2048 500 4096 2500". This determines the
|
||||
@@ -655,11 +720,12 @@ A plain number is in bytes, append 'k', 'm' or 'g' for kilobytes, megabytes
|
||||
or gigabytes (1024*1024 bytes in a megabyte).
|
||||
.TP
|
||||
.B local\-zone: \fI<zone> <type>
|
||||
Configure a local zone. The type determines the answer to give if there is
|
||||
no match from local\-data. The types are deny, refuse, static, transparent,
|
||||
redirect, nodefault, and are explained below. After that the default settings
|
||||
are listed. Use local\-data: to enter data into the local zone. Answers for
|
||||
local zones are authoritative DNS answers. By default the zones are class IN.
|
||||
Configure a local zone. The type determines the answer to give if
|
||||
there is no match from local\-data. The types are deny, refuse, static,
|
||||
transparent, redirect, nodefault, typetransparent, and are explained
|
||||
below. After that the default settings are listed. Use local\-data: to
|
||||
enter data into the local zone. Answers for local zones are authoritative
|
||||
DNS answers. By default the zones are class IN.
|
||||
.IP
|
||||
If you need more complicated authoritative data, with referrals, wildcards,
|
||||
CNAME/DNAME support, or DNSSEC authoritative service, setup a stub\-zone for
|
||||
@@ -687,6 +753,13 @@ given in localdata, then a noerror nodata answer is returned.
|
||||
If no local\-zone is given local\-data causes a transparent zone
|
||||
to be created by default.
|
||||
.TP 10
|
||||
\h'5'\fItypetransparent\fR
|
||||
If there is a match from local data, the query is answered. If the query
|
||||
is for a different name, or for the same name but for a different type,
|
||||
the query is resolved normally. So, similar to transparent but types
|
||||
that are not listed in local data are resolved normally, so if an A record
|
||||
is in the local data that does not cause a nodata reply for AAAA queries.
|
||||
.TP 10
|
||||
\h'5'\fIredirect\fR
|
||||
The query is answered from the local data for the zone name.
|
||||
There may be no local data beneath the zone name.
|
||||
@@ -760,7 +833,8 @@ records are provided.
|
||||
.TP 10
|
||||
\h'5'\fIreverse RFC3330 IP4 this, link\-local, testnet and broadcast\fR
|
||||
Reverse data for zones 0.in\-addr.arpa, 254.169.in\-addr.arpa,
|
||||
2.0.192.in\-addr.arpa, 255.255.255.255.in\-addr.arpa.
|
||||
2.0.192.in\-addr.arpa (TEST NET 1), 100.51.198.in\-addr.arpa (TEST NET 2),
|
||||
113.0.203.in\-addr.arpa (TEST NET 3), 255.255.255.255.in\-addr.arpa.
|
||||
.TP 10
|
||||
\h'5'\fIreverse RFC4291 IP6 unspecified\fR
|
||||
Reverse data for zone
|
||||
@@ -781,6 +855,8 @@ tutorials and examples. You can remove the block on this zone with:
|
||||
.nf
|
||||
local\-zone: 8.B.D.0.1.0.0.2.ip6.arpa. nodefault
|
||||
.fi
|
||||
You can also selectively unblock a part of the zone by making that part
|
||||
transparent with a local\-zone statement.
|
||||
This also works with the other default zones.
|
||||
.\" End of local-zone listing.
|
||||
.TP 5
|
||||
@@ -822,10 +898,9 @@ By default localhost (127.0.0.1 and ::1) is listened to.
|
||||
Use 0.0.0.0 and ::0 to listen to all interfaces.
|
||||
.TP 5
|
||||
.B control\-port: <port number>
|
||||
The port number to listen on for control commands, default is 953
|
||||
(that is the same port number named uses to listen to rndc).
|
||||
If you change this port number, and permissions have been dropped, a
|
||||
reload is not sufficient to open the port again, you must then restart.
|
||||
The port number to listen on for control commands, default is 8953.
|
||||
If you change this port number, and permissions have been dropped,
|
||||
a reload is not sufficient to open the port again, you must then restart.
|
||||
.TP 5
|
||||
.B server\-key\-file: "<private key file>"
|
||||
Path to the server private key, by default unbound_server.key.
|
||||
@@ -920,7 +995,7 @@ The
|
||||
clause gives the settings for the \fIpython\fR(1) script module. This module
|
||||
acts like the iterator and validator modules do, on queries and answers.
|
||||
To enable the script module it has to be compiled into the daemon,
|
||||
and the word "python" has to be put in the \fBmodule\-conf:\fR option
|
||||
and the word "python" has to be put in the \fBmodule\-config:\fR option
|
||||
(usually first, or between the validator and iterator).
|
||||
.TP
|
||||
.B python\-script: \fI<python file>\fR
|
||||
@@ -940,7 +1015,7 @@ server:
|
||||
num\-threads: 1
|
||||
outgoing\-num\-tcp: 1 # this limits TCP service, uses less buffers.
|
||||
incoming\-num\-tcp: 1
|
||||
outgoing\-range: 16 # uses less memory, but less performance.
|
||||
outgoing\-range: 60 # uses less memory, but less performance.
|
||||
msg\-buffer\-size: 8192 # note this limits service, 'no huge stuff'.
|
||||
msg\-cache\-size: 100k
|
||||
msg\-cache\-slabs: 1
|
||||
|
||||
+929
-550
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2006-12-25.00
|
||||
scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
@@ -515,5 +515,6 @@ done
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
|
||||
+84
-40
@@ -69,16 +69,19 @@ struct delegpt* delegpt_copy(struct delegpt* dp, struct regional* region)
|
||||
if(!delegpt_set_name(copy, region, dp->name))
|
||||
return NULL;
|
||||
copy->bogus = dp->bogus;
|
||||
copy->has_parent_side_NS = dp->has_parent_side_NS;
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
if(!delegpt_add_ns(copy, region, ns->name))
|
||||
if(!delegpt_add_ns(copy, region, ns->name, (int)ns->lame))
|
||||
return NULL;
|
||||
copy->nslist->resolved = ns->resolved;
|
||||
copy->nslist->got4 = ns->got4;
|
||||
copy->nslist->got6 = ns->got6;
|
||||
copy->nslist->done_pside4 = ns->done_pside4;
|
||||
copy->nslist->done_pside6 = ns->done_pside6;
|
||||
}
|
||||
for(a = dp->target_list; a; a = a->next_target) {
|
||||
if(!delegpt_add_addr(copy, region, &a->addr, a->addrlen,
|
||||
a->bogus, a->lame, 0))
|
||||
a->bogus, a->lame))
|
||||
return NULL;
|
||||
}
|
||||
return copy;
|
||||
@@ -93,7 +96,8 @@ delegpt_set_name(struct delegpt* dp, struct regional* region, uint8_t* name)
|
||||
}
|
||||
|
||||
int
|
||||
delegpt_add_ns(struct delegpt* dp, struct regional* region, uint8_t* name)
|
||||
delegpt_add_ns(struct delegpt* dp, struct regional* region, uint8_t* name,
|
||||
int lame)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
size_t len;
|
||||
@@ -113,6 +117,9 @@ delegpt_add_ns(struct delegpt* dp, struct regional* region, uint8_t* name)
|
||||
ns->resolved = 0;
|
||||
ns->got4 = 0;
|
||||
ns->got6 = 0;
|
||||
ns->lame = (uint8_t)lame;
|
||||
ns->done_pside4 = 0;
|
||||
ns->done_pside6 = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -147,35 +154,36 @@ delegpt_find_addr(struct delegpt* dp, struct sockaddr_storage* addr,
|
||||
int
|
||||
delegpt_add_target(struct delegpt* dp, struct regional* region,
|
||||
uint8_t* name, size_t namelen, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int bogus, int lame, int nodup)
|
||||
socklen_t addrlen, int bogus, int lame)
|
||||
{
|
||||
struct delegpt_ns* ns = delegpt_find_ns(dp, name, namelen);
|
||||
if(!ns) {
|
||||
/* ignore it */
|
||||
return 1;
|
||||
}
|
||||
if(addr_is_ip6(addr, addrlen))
|
||||
ns->got6 = 1;
|
||||
else ns->got4 = 1;
|
||||
if(ns->got4 && ns->got6)
|
||||
ns->resolved = 1;
|
||||
return delegpt_add_addr(dp, region, addr, addrlen, bogus, lame, nodup);
|
||||
if(!lame) {
|
||||
if(addr_is_ip6(addr, addrlen))
|
||||
ns->got6 = 1;
|
||||
else ns->got4 = 1;
|
||||
if(ns->got4 && ns->got6)
|
||||
ns->resolved = 1;
|
||||
}
|
||||
return delegpt_add_addr(dp, region, addr, addrlen, bogus, lame);
|
||||
}
|
||||
|
||||
int
|
||||
delegpt_add_addr(struct delegpt* dp, struct regional* region,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, int bogus,
|
||||
int lame, int nodup)
|
||||
int lame)
|
||||
{
|
||||
struct delegpt_addr* a;
|
||||
if(nodup) {
|
||||
if((a = delegpt_find_addr(dp, addr, addrlen))) {
|
||||
if(bogus)
|
||||
a->bogus = bogus;
|
||||
if(!lame)
|
||||
a->lame = 0;
|
||||
return 1;
|
||||
}
|
||||
/* check for duplicates */
|
||||
if((a = delegpt_find_addr(dp, addr, addrlen))) {
|
||||
if(bogus)
|
||||
a->bogus = bogus;
|
||||
if(!lame)
|
||||
a->lame = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
a = (struct delegpt_addr*)regional_alloc(region,
|
||||
@@ -243,21 +251,26 @@ void delegpt_log(enum verbosity_value v, struct delegpt* dp)
|
||||
delegpt_count_ns(dp, &numns, &missing);
|
||||
delegpt_count_addr(dp, &numaddr, &numres, &numavail);
|
||||
log_info("DelegationPoint<%s>: %u names (%u missing), "
|
||||
"%u addrs (%u result, %u avail)",
|
||||
"%u addrs (%u result, %u avail)%s",
|
||||
buf, (unsigned)numns, (unsigned)missing,
|
||||
(unsigned)numaddr, (unsigned)numres, (unsigned)numavail);
|
||||
(unsigned)numaddr, (unsigned)numres, (unsigned)numavail,
|
||||
(dp->has_parent_side_NS?" parentNS":" cacheNS"));
|
||||
if(verbosity >= VERB_ALGO) {
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
dname_str(ns->name, buf);
|
||||
log_info(" %s %s%s%s%s", buf, (ns->resolved?"*":""),
|
||||
log_info(" %s %s%s%s%s%s%s%s", buf,
|
||||
(ns->resolved?"*":""),
|
||||
(ns->got4?" A":""), (ns->got6?" AAAA":""),
|
||||
(dp->bogus?" BOGUS":"") );
|
||||
(dp->bogus?" BOGUS":""), (ns->lame?" PARENTSIDE":""),
|
||||
(ns->done_pside4?" PSIDE_A":""),
|
||||
(ns->done_pside6?" PSIDE_AAAA":""));
|
||||
}
|
||||
for(a = dp->target_list; a; a = a->next_target) {
|
||||
if(a->bogus)
|
||||
log_addr(VERB_ALGO, " BOGUS ",
|
||||
&a->addr, a->addrlen);
|
||||
else log_addr(VERB_ALGO, " ", &a->addr, a->addrlen);
|
||||
const char* str = " ";
|
||||
if(a->bogus && a->lame) str = " BOGUS ADDR_LAME ";
|
||||
else if(a->bogus) str = " BOGUS ";
|
||||
else if(a->lame) str = " ADDR_LAME ";
|
||||
log_addr(VERB_ALGO, str, &a->addr, a->addrlen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,6 +287,16 @@ delegpt_add_unused_targets(struct delegpt* dp)
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
delegpt_count_targets(struct delegpt* dp)
|
||||
{
|
||||
struct delegpt_addr* a;
|
||||
size_t n = 0;
|
||||
for(a = dp->target_list; a; a = a->next_target)
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
size_t
|
||||
delegpt_count_missing_targets(struct delegpt* dp)
|
||||
{
|
||||
@@ -322,9 +345,10 @@ delegpt_from_message(struct dns_msg* msg, struct regional* region)
|
||||
dp = delegpt_create(region);
|
||||
if(!dp)
|
||||
return NULL;
|
||||
dp->has_parent_side_NS = 1; /* created from message */
|
||||
if(!delegpt_set_name(dp, region, ns_rrset->rk.dname))
|
||||
return NULL;
|
||||
if(!delegpt_rrset_add_ns(dp, region, ns_rrset))
|
||||
if(!delegpt_rrset_add_ns(dp, region, ns_rrset, 0))
|
||||
return NULL;
|
||||
|
||||
/* add glue, A and AAAA in answer and additional section */
|
||||
@@ -336,10 +360,10 @@ delegpt_from_message(struct dns_msg* msg, struct regional* region)
|
||||
continue;
|
||||
|
||||
if(ntohs(s->rk.type) == LDNS_RR_TYPE_A) {
|
||||
if(!delegpt_add_rrset_A(dp, region, s, 0, 0))
|
||||
if(!delegpt_add_rrset_A(dp, region, s, 0))
|
||||
return NULL;
|
||||
} else if(ntohs(s->rk.type) == LDNS_RR_TYPE_AAAA) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, s, 0, 0))
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, s, 0))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -348,7 +372,7 @@ delegpt_from_message(struct dns_msg* msg, struct regional* region)
|
||||
|
||||
int
|
||||
delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* ns_rrset)
|
||||
struct ub_packed_rrset_key* ns_rrset, int lame)
|
||||
{
|
||||
struct packed_rrset_data* nsdata = (struct packed_rrset_data*)
|
||||
ns_rrset->entry.data;
|
||||
@@ -361,7 +385,7 @@ delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region,
|
||||
(size_t)ldns_read_uint16(nsdata->rr_data[i]))
|
||||
continue; /* bad format */
|
||||
/* add rdata of NS (= wirefmt dname), skip rdatalen bytes */
|
||||
if(!delegpt_add_ns(dp, region, nsdata->rr_data[i]+2))
|
||||
if(!delegpt_add_ns(dp, region, nsdata->rr_data[i]+2, lame))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -369,7 +393,7 @@ delegpt_rrset_add_ns(struct delegpt* dp, struct regional* region,
|
||||
|
||||
int
|
||||
delegpt_add_rrset_A(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* ak, int lame, int nodup)
|
||||
struct ub_packed_rrset_key* ak, int lame)
|
||||
{
|
||||
struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data;
|
||||
size_t i;
|
||||
@@ -384,7 +408,7 @@ delegpt_add_rrset_A(struct delegpt* dp, struct regional* region,
|
||||
memmove(&sa.sin_addr, d->rr_data[i]+2, INET_SIZE);
|
||||
if(!delegpt_add_target(dp, region, ak->rk.dname,
|
||||
ak->rk.dname_len, (struct sockaddr_storage*)&sa,
|
||||
len, (d->security==sec_status_bogus), lame, nodup))
|
||||
len, (d->security==sec_status_bogus), lame))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -392,7 +416,7 @@ delegpt_add_rrset_A(struct delegpt* dp, struct regional* region,
|
||||
|
||||
int
|
||||
delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* ak, int lame, int nodup)
|
||||
struct ub_packed_rrset_key* ak, int lame)
|
||||
{
|
||||
struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data;
|
||||
size_t i;
|
||||
@@ -407,7 +431,7 @@ delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region,
|
||||
memmove(&sa.sin6_addr, d->rr_data[i]+2, INET6_SIZE);
|
||||
if(!delegpt_add_target(dp, region, ak->rk.dname,
|
||||
ak->rk.dname_len, (struct sockaddr_storage*)&sa,
|
||||
len, (d->security==sec_status_bogus), lame, nodup))
|
||||
len, (d->security==sec_status_bogus), lame))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -415,16 +439,16 @@ delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* region,
|
||||
|
||||
int
|
||||
delegpt_add_rrset(struct delegpt* dp, struct regional* region,
|
||||
struct ub_packed_rrset_key* rrset)
|
||||
struct ub_packed_rrset_key* rrset, int lame)
|
||||
{
|
||||
if(!rrset)
|
||||
return 1;
|
||||
if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_NS)
|
||||
return delegpt_rrset_add_ns(dp, region, rrset);
|
||||
return delegpt_rrset_add_ns(dp, region, rrset, lame);
|
||||
else if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_A)
|
||||
return delegpt_add_rrset_A(dp, region, rrset, 0, 1);
|
||||
return delegpt_add_rrset_A(dp, region, rrset, lame);
|
||||
else if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_AAAA)
|
||||
return delegpt_add_rrset_AAAA(dp, region, rrset, 0, 1);
|
||||
return delegpt_add_rrset_AAAA(dp, region, rrset, lame);
|
||||
log_warn("Unknown rrset type added to delegpt");
|
||||
return 1;
|
||||
}
|
||||
@@ -448,3 +472,23 @@ void delegpt_add_neg_msg(struct delegpt* dp, struct msgreply_entry* msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void delegpt_no_ipv6(struct delegpt* dp)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
/* no ipv6, so only ipv4 is enough to resolve a nameserver */
|
||||
if(ns->got4)
|
||||
ns->resolved = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void delegpt_no_ipv4(struct delegpt* dp)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
/* no ipv4, so only ipv6 is enough to resolve a nameserver */
|
||||
if(ns->got6)
|
||||
ns->resolved = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+47
-15
@@ -74,6 +74,11 @@ struct delegpt {
|
||||
|
||||
/** if true, the NS RRset was bogus. All info is bad. */
|
||||
int bogus;
|
||||
/** if true, the parent-side NS record has been applied:
|
||||
* its names have been added and their addresses can follow later.
|
||||
* Also true if the delegationpoint was created from a delegation
|
||||
* message and thus contains the parent-side-info already. */
|
||||
uint8_t has_parent_side_NS;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -90,13 +95,26 @@ struct delegpt_ns {
|
||||
* If the name has been resolved. false if not queried for yet.
|
||||
* true if the A, AAAA queries have been generated.
|
||||
* marked true if those queries fail.
|
||||
* and marked true is got4 and got6 are both true.
|
||||
* and marked true if got4 and got6 are both true.
|
||||
*/
|
||||
int resolved;
|
||||
/** if the ipv4 address is in the delegpt */
|
||||
uint8_t got4;
|
||||
/** if the ipv6 address is in the delegpt */
|
||||
uint8_t got6;
|
||||
/**
|
||||
* If the name is parent-side only and thus dispreferred.
|
||||
* Its addresses become dispreferred as well
|
||||
*/
|
||||
uint8_t lame;
|
||||
/** if the parent-side ipv4 address has been looked up (last resort).
|
||||
* Also enabled if a parent-side cache entry exists, or a parent-side
|
||||
* negative-cache entry exists. */
|
||||
uint8_t done_pside4;
|
||||
/** if the parent-side ipv6 address has been looked up (last resort).
|
||||
* Also enabled if a parent-side cache entry exists, or a parent-side
|
||||
* negative-cache entry exists. */
|
||||
uint8_t done_pside6;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -155,20 +173,22 @@ int delegpt_set_name(struct delegpt* dp, struct regional* regional,
|
||||
* @param dp: delegation point.
|
||||
* @param regional: where to allocate the info.
|
||||
* @param name: domain name in wire format.
|
||||
* @param lame: name is lame, disprefer it.
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_ns(struct delegpt* dp, struct regional* regional,
|
||||
uint8_t* name);
|
||||
uint8_t* name, int lame);
|
||||
|
||||
/**
|
||||
* Add NS rrset; calls add_ns repeatedly.
|
||||
* @param dp: delegation point.
|
||||
* @param regional: where to allocate the info.
|
||||
* @param ns_rrset: NS rrset.
|
||||
* return 0 on alloc error.
|
||||
* @param lame: rrset is lame, disprefer it.
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* ns_rrset);
|
||||
struct ub_packed_rrset_key* ns_rrset, int lame);
|
||||
|
||||
/**
|
||||
* Add target address to the delegation point.
|
||||
@@ -181,13 +201,11 @@ int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* regional,
|
||||
* @param addrlen: the length of addr.
|
||||
* @param bogus: security status for the address, pass true if bogus.
|
||||
* @param lame: address is lame.
|
||||
* @param nodup: if true, no address duplicates are made by this add.
|
||||
* name duplicates are always filtered.
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_target(struct delegpt* dp, struct regional* regional,
|
||||
uint8_t* name, size_t namelen, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int bogus, int lame, int nodup);
|
||||
socklen_t addrlen, int bogus, int lame);
|
||||
|
||||
/**
|
||||
* Add A RRset to delegpt.
|
||||
@@ -195,11 +213,10 @@ int delegpt_add_target(struct delegpt* dp, struct regional* regional,
|
||||
* @param regional: where to allocate the info.
|
||||
* @param rrset: RRset A to add.
|
||||
* @param lame: rrset is lame, disprefer it.
|
||||
* @param nodup: if true, no duplicates are made by this add. takes time.
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset_A(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset, int lame, int nodup);
|
||||
struct ub_packed_rrset_key* rrset, int lame);
|
||||
|
||||
/**
|
||||
* Add AAAA RRset to delegpt.
|
||||
@@ -207,11 +224,10 @@ int delegpt_add_rrset_A(struct delegpt* dp, struct regional* regional,
|
||||
* @param regional: where to allocate the info.
|
||||
* @param rrset: RRset AAAA to add.
|
||||
* @param lame: rrset is lame, disprefer it.
|
||||
* @param nodup: if true, no duplicates are made by this add. takes time.
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset, int lame, int nodup);
|
||||
struct ub_packed_rrset_key* rrset, int lame);
|
||||
|
||||
/**
|
||||
* Add any RRset to delegpt.
|
||||
@@ -219,10 +235,11 @@ int delegpt_add_rrset_AAAA(struct delegpt* dp, struct regional* regional,
|
||||
* @param dp: delegation point.
|
||||
* @param regional: where to allocate the info.
|
||||
* @param rrset: RRset to add, NS, A, AAAA.
|
||||
* @param lame: rrset is lame, disprefer it.
|
||||
* @return 0 on alloc error.
|
||||
*/
|
||||
int delegpt_add_rrset(struct delegpt* dp, struct regional* regional,
|
||||
struct ub_packed_rrset_key* rrset);
|
||||
struct ub_packed_rrset_key* rrset, int lame);
|
||||
|
||||
/**
|
||||
* Add address to the delegation point. No servername is associated or checked.
|
||||
@@ -232,12 +249,10 @@ int delegpt_add_rrset(struct delegpt* dp, struct regional* regional,
|
||||
* @param addrlen: the length of addr.
|
||||
* @param bogus: if address is bogus.
|
||||
* @param lame: if address is lame.
|
||||
* @param nodup: if true, no duplicates are made by this add. takes time.
|
||||
* @return false on error.
|
||||
*/
|
||||
int delegpt_add_addr(struct delegpt* dp, struct regional* regional,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, int bogus,
|
||||
int lame, int nodup);
|
||||
struct sockaddr_storage* addr, socklen_t addrlen, int bogus, int lame);
|
||||
|
||||
/**
|
||||
* Find NS record in name list of delegation point.
|
||||
@@ -286,6 +301,9 @@ void delegpt_add_unused_targets(struct delegpt* dp);
|
||||
*/
|
||||
size_t delegpt_count_missing_targets(struct delegpt* dp);
|
||||
|
||||
/** count total number of targets in dp */
|
||||
size_t delegpt_count_targets(struct delegpt* dp);
|
||||
|
||||
/**
|
||||
* Create new delegation point from a dns message
|
||||
*
|
||||
@@ -314,4 +332,18 @@ struct delegpt* delegpt_from_message(struct dns_msg* msg,
|
||||
*/
|
||||
void delegpt_add_neg_msg(struct delegpt* dp, struct msgreply_entry* msg);
|
||||
|
||||
/**
|
||||
* Register the fact that there is no ipv6 and thus AAAAs are not going
|
||||
* to be queried for or be useful.
|
||||
* @param dp: the delegation point. Updated to reflect no ipv6.
|
||||
*/
|
||||
void delegpt_no_ipv6(struct delegpt* dp);
|
||||
|
||||
/**
|
||||
* Register the fact that there is no ipv4 and thus As are not going
|
||||
* to be queried for or be useful.
|
||||
* @param dp: the delegation point. Updated to reflect no ipv4.
|
||||
*/
|
||||
void delegpt_no_ipv4(struct delegpt* dp);
|
||||
|
||||
#endif /* ITERATOR_ITER_DELEGPT_H */
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "util/net_help.h"
|
||||
|
||||
struct iter_donotq*
|
||||
donotq_create()
|
||||
donotq_create(void)
|
||||
{
|
||||
struct iter_donotq* dq = (struct iter_donotq*)calloc(1,
|
||||
sizeof(struct iter_donotq));
|
||||
|
||||
@@ -65,7 +65,7 @@ struct iter_donotq {
|
||||
* Create donotqueryaddresses structure
|
||||
* @return new structure or NULL on error.
|
||||
*/
|
||||
struct iter_donotq* donotq_create();
|
||||
struct iter_donotq* donotq_create(void);
|
||||
|
||||
/**
|
||||
* Delete donotqueryaddresses structure.
|
||||
|
||||
+9
-4
@@ -40,6 +40,9 @@
|
||||
* Keep track of forward zones and config settings.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/rdata.h"
|
||||
#include "ldns/dname.h"
|
||||
#include "ldns/rr.h"
|
||||
#include "iterator/iter_fwd.h"
|
||||
#include "iterator/iter_delegpt.h"
|
||||
#include "util/regional.h"
|
||||
@@ -64,7 +67,7 @@ fwd_cmp(const void* k1, const void* k2)
|
||||
}
|
||||
|
||||
struct iter_forwards*
|
||||
forwards_create()
|
||||
forwards_create(void)
|
||||
{
|
||||
struct iter_forwards* fwd = (struct iter_forwards*)calloc(1,
|
||||
sizeof(struct iter_forwards));
|
||||
@@ -187,7 +190,7 @@ read_fwds_host(struct iter_forwards* fwd, struct config_stub* s,
|
||||
s->name, p->str);
|
||||
return 0;
|
||||
}
|
||||
if(!delegpt_add_ns(dp, fwd->region, ldns_rdf_data(rdf))) {
|
||||
if(!delegpt_add_ns(dp, fwd->region, ldns_rdf_data(rdf), 0)) {
|
||||
ldns_rdf_deep_free(rdf);
|
||||
log_err("out of memory");
|
||||
return 0;
|
||||
@@ -212,8 +215,7 @@ read_fwds_addr(struct iter_forwards* fwd, struct config_stub* s,
|
||||
s->name, p->str);
|
||||
return 0;
|
||||
}
|
||||
if(!delegpt_add_addr(dp, fwd->region, &addr, addrlen,
|
||||
0, 0, 1)) {
|
||||
if(!delegpt_add_addr(dp, fwd->region, &addr, addrlen, 0, 0)) {
|
||||
log_err("out of memory");
|
||||
return 0;
|
||||
}
|
||||
@@ -232,6 +234,9 @@ read_forwards(struct iter_forwards* fwd, struct config_file* cfg)
|
||||
log_err("out of memory");
|
||||
return 0;
|
||||
}
|
||||
/* set flag that parent side NS information is included.
|
||||
* Asking a (higher up) server on the internet is not useful */
|
||||
dp->has_parent_side_NS = 1;
|
||||
if(!read_fwds_name(fwd, s, dp) ||
|
||||
!read_fwds_host(fwd, s, dp) ||
|
||||
!read_fwds_addr(fwd, s, dp))
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ struct iter_forward_zone {
|
||||
* Create forwards
|
||||
* @return new forwards or NULL on error.
|
||||
*/
|
||||
struct iter_forwards* forwards_create();
|
||||
struct iter_forwards* forwards_create(void);
|
||||
|
||||
/**
|
||||
* Delete forwards.
|
||||
|
||||
+23
-10
@@ -40,6 +40,8 @@
|
||||
* Keep track of stub and root hints, and read those from config.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/dname.h"
|
||||
#include "ldns/rr.h"
|
||||
#include "iterator/iter_hints.h"
|
||||
#include "iterator/iter_delegpt.h"
|
||||
#include "util/regional.h"
|
||||
@@ -49,7 +51,7 @@
|
||||
#include "util/data/dname.h"
|
||||
|
||||
struct iter_hints*
|
||||
hints_create()
|
||||
hints_create(void)
|
||||
{
|
||||
struct iter_hints* hints = (struct iter_hints*)calloc(1,
|
||||
sizeof(struct iter_hints));
|
||||
@@ -83,10 +85,10 @@ ah(struct delegpt* dp, struct regional* r, const char* sv, const char* ip)
|
||||
log_err("could not parse %s", sv);
|
||||
return 0;
|
||||
}
|
||||
if(!delegpt_add_ns(dp, r, ldns_rdf_data(rdf)) ||
|
||||
if(!delegpt_add_ns(dp, r, ldns_rdf_data(rdf), 0) ||
|
||||
!extstrtoaddr(ip, &addr, &addrlen) ||
|
||||
!delegpt_add_target(dp, r, ldns_rdf_data(rdf), ldns_rdf_size(rdf),
|
||||
&addr, addrlen, 0, 0, 1)) {
|
||||
&addr, addrlen, 0, 0)) {
|
||||
ldns_rdf_deep_free(rdf);
|
||||
return 0;
|
||||
}
|
||||
@@ -105,11 +107,12 @@ compile_time_root_prime(struct regional* r, int do_ip4, int do_ip6)
|
||||
; on server FTP.INTERNIC.NET
|
||||
; -OR- RS.INTERNIC.NET
|
||||
;
|
||||
; related version of root zone: 2008051300
|
||||
; related version of root zone: 2010061700
|
||||
*/
|
||||
struct delegpt* dp = delegpt_create(r);
|
||||
if(!dp)
|
||||
return NULL;
|
||||
dp->has_parent_side_NS = 1;
|
||||
if(!delegpt_set_name(dp, r, (uint8_t*)"\000"))
|
||||
return NULL;
|
||||
if(do_ip4) {
|
||||
@@ -129,8 +132,10 @@ compile_time_root_prime(struct regional* r, int do_ip4, int do_ip6)
|
||||
}
|
||||
if(do_ip6) {
|
||||
if(!ah(dp, r, "A.ROOT-SERVERS.NET.", "2001:503:ba3e::2:30")) return 0;
|
||||
if(!ah(dp, r, "D.ROOT-SERVERS.NET.", "2001:500:2d::d")) return 0;
|
||||
if(!ah(dp, r, "F.ROOT-SERVERS.NET.", "2001:500:2f::f")) return 0;
|
||||
if(!ah(dp, r, "H.ROOT-SERVERS.NET.", "2001:500:1::803f:235")) return 0;
|
||||
if(!ah(dp, r, "I.ROOT-SERVERS.NET.", "2001:7fe::53")) return 0;
|
||||
if(!ah(dp, r, "J.ROOT-SERVERS.NET.", "2001:503:c27::2:30")) return 0;
|
||||
if(!ah(dp, r, "K.ROOT-SERVERS.NET.", "2001:7fd::1")) return 0;
|
||||
if(!ah(dp, r, "L.ROOT-SERVERS.NET.", "2001:500:3::42")) return 0;
|
||||
@@ -200,7 +205,7 @@ read_stubs_host(struct iter_hints* hints, struct config_stub* s,
|
||||
s->name, p->str);
|
||||
return 0;
|
||||
}
|
||||
if(!delegpt_add_ns(dp, hints->region, ldns_rdf_data(rdf))) {
|
||||
if(!delegpt_add_ns(dp, hints->region, ldns_rdf_data(rdf), 0)) {
|
||||
ldns_rdf_deep_free(rdf);
|
||||
log_err("out of memory");
|
||||
return 0;
|
||||
@@ -225,8 +230,7 @@ read_stubs_addr(struct iter_hints* hints, struct config_stub* s,
|
||||
s->name, p->str);
|
||||
return 0;
|
||||
}
|
||||
if(!delegpt_add_addr(dp, hints->region, &addr, addrlen,
|
||||
0, 0, 1)) {
|
||||
if(!delegpt_add_addr(dp, hints->region, &addr, addrlen, 0, 0)) {
|
||||
log_err("out of memory");
|
||||
return 0;
|
||||
}
|
||||
@@ -245,6 +249,7 @@ read_stubs(struct iter_hints* hints, struct config_file* cfg)
|
||||
log_err("out of memory");
|
||||
return 0;
|
||||
}
|
||||
dp->has_parent_side_NS = 1;
|
||||
if(!read_stubs_name(hints, s, dp) ||
|
||||
!read_stubs_host(hints, s, dp) ||
|
||||
!read_stubs_addr(hints, s, dp))
|
||||
@@ -281,6 +286,7 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
return 0;
|
||||
}
|
||||
verbose(VERB_QUERY, "Reading root hints from %s", fname);
|
||||
dp->has_parent_side_NS = 1;
|
||||
while(!feof(f)) {
|
||||
status = ldns_rr_new_frm_fp_l(&rr, f,
|
||||
&default_ttl, &origin, &prev_rr, &lineno);
|
||||
@@ -295,7 +301,7 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
}
|
||||
if(ldns_rr_get_type(rr) == LDNS_RR_TYPE_NS) {
|
||||
if(!delegpt_add_ns(dp, hints->region,
|
||||
ldns_rdf_data(ldns_rr_rdf(rr, 0)))) {
|
||||
ldns_rdf_data(ldns_rr_rdf(rr, 0)), 0)) {
|
||||
log_err("out of memory reading root hints");
|
||||
goto stop_read;
|
||||
}
|
||||
@@ -319,7 +325,7 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
ldns_rdf_data(ldns_rr_owner(rr)),
|
||||
ldns_rdf_size(ldns_rr_owner(rr)),
|
||||
(struct sockaddr_storage*)&sa, len,
|
||||
0, 0, 1)) {
|
||||
0, 0)) {
|
||||
log_err("out of memory reading root hints");
|
||||
goto stop_read;
|
||||
}
|
||||
@@ -335,7 +341,7 @@ read_root_hints(struct iter_hints* hints, char* fname)
|
||||
ldns_rdf_data(ldns_rr_owner(rr)),
|
||||
ldns_rdf_size(ldns_rr_owner(rr)),
|
||||
(struct sockaddr_storage*)&sa, len,
|
||||
0, 0, 1)) {
|
||||
0, 0)) {
|
||||
log_err("out of memory reading root hints");
|
||||
goto stop_read;
|
||||
}
|
||||
@@ -446,6 +452,13 @@ hints_lookup_stub(struct iter_hints* hints, uint8_t* qname,
|
||||
len, labs, qclass);
|
||||
if(!r) return NULL;
|
||||
|
||||
/* If there is no cache (root prime situation) */
|
||||
if(cache_dp == NULL) {
|
||||
if(r->dp->namelabs != 1)
|
||||
return r; /* no cache dp, use any non-root stub */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the stub is same as the delegation we got
|
||||
* And has noprime set, we need to 'prime' to use this stub instead.
|
||||
|
||||
@@ -81,7 +81,7 @@ struct iter_hints_stub {
|
||||
* Create hints
|
||||
* @return new hints or NULL on error.
|
||||
*/
|
||||
struct iter_hints* hints_create();
|
||||
struct iter_hints* hints_create(void);
|
||||
|
||||
/**
|
||||
* Delete hints.
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ldns/dname.h"
|
||||
#include "iterator/iter_priv.h"
|
||||
#include "util/regional.h"
|
||||
#include "util/log.h"
|
||||
@@ -50,7 +51,7 @@
|
||||
#include "util/net_help.h"
|
||||
#include "util/storage/dnstree.h"
|
||||
|
||||
struct iter_priv* priv_create()
|
||||
struct iter_priv* priv_create(void)
|
||||
{
|
||||
struct iter_priv* priv = (struct iter_priv*)calloc(1, sizeof(*priv));
|
||||
if(!priv)
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#ifndef ITERATOR_ITER_PRIV_H
|
||||
#define ITERATOR_ITER_PRIV_H
|
||||
#include "util/rbtree.h"
|
||||
#include "ldns/buffer.h"
|
||||
struct iter_env;
|
||||
struct config_file;
|
||||
struct regional;
|
||||
@@ -73,7 +74,7 @@ struct iter_priv {
|
||||
* Create priv structure
|
||||
* @return new structure or NULL on error.
|
||||
*/
|
||||
struct iter_priv* priv_create();
|
||||
struct iter_priv* priv_create(void);
|
||||
|
||||
/**
|
||||
* Delete priv structure.
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
* one of the response types.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/packet.h"
|
||||
#include "iterator/iter_resptype.h"
|
||||
#include "iterator/iter_delegpt.h"
|
||||
#include "services/cache/dns.h"
|
||||
@@ -53,6 +54,8 @@ response_type_from_cache(struct dns_msg* msg,
|
||||
/* If the message is NXDOMAIN, then it is an ANSWER. */
|
||||
if(FLAGS_GET_RCODE(msg->rep->flags) == LDNS_RCODE_NXDOMAIN)
|
||||
return RESPONSE_TYPE_ANSWER;
|
||||
if(request->qtype == LDNS_RR_TYPE_ANY)
|
||||
return RESPONSE_TYPE_ANSWER;
|
||||
|
||||
/* First we look at the answer section. This can tell us if this is
|
||||
* CNAME or positive ANSWER. */
|
||||
@@ -105,7 +108,6 @@ response_type_from_server(int rdset,
|
||||
{
|
||||
uint8_t* origzone = (uint8_t*)"\000"; /* the default */
|
||||
struct ub_packed_rrset_key* s;
|
||||
size_t origzonelen = 1;
|
||||
size_t i;
|
||||
|
||||
if(!msg || !request)
|
||||
@@ -117,6 +119,15 @@ response_type_from_server(int rdset,
|
||||
if( (msg->rep->flags&BIT_RA) &&
|
||||
!(msg->rep->flags&BIT_AA) && !rdset)
|
||||
return RESPONSE_TYPE_REC_LAME;
|
||||
/* it could be a CNAME with NXDOMAIN rcode */
|
||||
for(i=0; i<msg->rep->an_numrrsets; i++) {
|
||||
s = msg->rep->rrsets[i];
|
||||
if(ntohs(s->rk.type) == LDNS_RR_TYPE_CNAME &&
|
||||
query_dname_compare(request->qname,
|
||||
s->rk.dname) == 0) {
|
||||
return RESPONSE_TYPE_CNAME;
|
||||
}
|
||||
}
|
||||
return RESPONSE_TYPE_ANSWER;
|
||||
}
|
||||
|
||||
@@ -129,7 +140,6 @@ response_type_from_server(int rdset,
|
||||
|
||||
if(dp) {
|
||||
origzone = dp->name;
|
||||
origzonelen = dp->namelen;
|
||||
}
|
||||
|
||||
/* First we look at the answer section. This can tell us if this is a
|
||||
@@ -142,7 +152,7 @@ response_type_from_server(int rdset,
|
||||
* answer is there directly, our answer is there after
|
||||
* a cname, or there is just a cname. */
|
||||
for(i=0; i<msg->rep->an_numrrsets; i++) {
|
||||
struct ub_packed_rrset_key* s = msg->rep->rrsets[i];
|
||||
s = msg->rep->rrsets[i];
|
||||
|
||||
/* if the answer section has NS rrset, and qtype ANY
|
||||
* and the delegation is lower, and no CNAMEs followed,
|
||||
@@ -180,6 +190,9 @@ response_type_from_server(int rdset,
|
||||
get_cname_target(s, &mname, &mname_len);
|
||||
}
|
||||
}
|
||||
/* not a referral, and qtype any, thus an answer */
|
||||
if(request->qtype == LDNS_RR_TYPE_ANY)
|
||||
return RESPONSE_TYPE_ANSWER;
|
||||
/* if we encountered a CNAME (or a bunch of CNAMEs), and
|
||||
* still got to here, then it is a CNAME response.
|
||||
* (This is regardless of the AA bit at this point) */
|
||||
@@ -226,14 +239,21 @@ response_type_from_server(int rdset,
|
||||
/* Or if a lame server is deployed,
|
||||
* which gives ns==zone delegation from cache
|
||||
* without AA bit as well, with nodata nosoa*/
|
||||
/* real answer must be +AA and SOA RFC(2308),
|
||||
* so this is wrong, and we SERVFAIL it if
|
||||
* this is the only possible reply, if it
|
||||
* is misdeployed the THROWAWAY makes us pick
|
||||
* the next server from the selection */
|
||||
if(msg->rep->an_numrrsets==0 &&
|
||||
!(msg->rep->flags&BIT_AA) && !rdset)
|
||||
return RESPONSE_TYPE_REC_LAME;
|
||||
return RESPONSE_TYPE_THROWAWAY;
|
||||
return RESPONSE_TYPE_ANSWER;
|
||||
}
|
||||
/* If we are getting a referral upwards (or to
|
||||
* the same zone), then the server is 'lame'. */
|
||||
if(dname_subdomain_c(origzone, s->rk.dname)) {
|
||||
if(rdset) /* forward or reclame not LAME */
|
||||
return RESPONSE_TYPE_THROWAWAY;
|
||||
return RESPONSE_TYPE_LAME;
|
||||
}
|
||||
/* If the NS set is below the delegation point we
|
||||
|
||||
+58
-13
@@ -303,6 +303,15 @@ pkt_sub(ldns_buffer* pkt, uint8_t* comprname, uint8_t* zone)
|
||||
return dname_subdomain_c(buf, zone);
|
||||
}
|
||||
|
||||
/** check subdomain with decompression, compressed is parent */
|
||||
static int
|
||||
sub_of_pkt(ldns_buffer* pkt, uint8_t* zone, uint8_t* comprname)
|
||||
{
|
||||
uint8_t buf[LDNS_MAX_DOMAINLEN+1];
|
||||
dname_pkt_copy(pkt, buf, comprname);
|
||||
return dname_subdomain_c(zone, buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine normalizes a response. This includes removing "irrelevant"
|
||||
* records from the answer and additional sections and (re)synthesizing
|
||||
@@ -354,10 +363,6 @@ scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
"too long");
|
||||
return 0;
|
||||
}
|
||||
/* internally we have CNAME'd/DNAME'd chains ending
|
||||
* in nxdomain with NOERROR rcode, change rcode
|
||||
* to reflect this (if needed) */
|
||||
FLAGS_SET_RCODE(msg->flags, LDNS_RCODE_NOERROR);
|
||||
if(nx && nx->type == LDNS_RR_TYPE_CNAME &&
|
||||
dname_pkt_compare(pkt, sname, nx->dname) == 0) {
|
||||
/* check next cname */
|
||||
@@ -396,14 +401,21 @@ scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
|
||||
/* Follow the CNAME chain. */
|
||||
if(rrset->type == LDNS_RR_TYPE_CNAME) {
|
||||
uint8_t* oldsname = sname;
|
||||
if(!parse_get_cname_target(rrset, &sname, &snamelen))
|
||||
return 0;
|
||||
prev = rrset;
|
||||
rrset = rrset->rrset_all_next;
|
||||
/* internally we have CNAME'd/DNAME'd chains ending
|
||||
* in nxdomain with NOERROR rcode, change rcode
|
||||
* to reflect this (if needed) */
|
||||
FLAGS_SET_RCODE(msg->flags, LDNS_RCODE_NOERROR);
|
||||
/* in CNAME ANY response, can have data after CNAME */
|
||||
if(qinfo->qtype == LDNS_RR_TYPE_ANY) {
|
||||
while(rrset && rrset->section ==
|
||||
LDNS_SECTION_ANSWER &&
|
||||
dname_pkt_compare(pkt, oldsname,
|
||||
rrset->dname) == 0) {
|
||||
prev = rrset;
|
||||
rrset = rrset->rrset_all_next;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -437,6 +449,12 @@ scrub_normalize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
}
|
||||
/* only one NS set allowed in authority section */
|
||||
if(rrset->type==LDNS_RR_TYPE_NS) {
|
||||
/* NS set must be pertinent to the query */
|
||||
if(!sub_of_pkt(pkt, qinfo->qname, rrset->dname)) {
|
||||
remove_rrset("normalize: removing irrelevant "
|
||||
"RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
}
|
||||
if(nsset == NULL) {
|
||||
nsset = rrset;
|
||||
} else {
|
||||
@@ -518,6 +536,18 @@ store_rrset(ldns_buffer* pkt, struct msg_parse* msg, struct module_env* env,
|
||||
env->alloc, now);
|
||||
}
|
||||
|
||||
/** Check if there are SOA records in the authority section (negative) */
|
||||
static int
|
||||
soa_in_auth(struct msg_parse* msg)
|
||||
{
|
||||
struct rrset_parse* rrset;
|
||||
for(rrset = msg->rrset_first; rrset; rrset = rrset->rrset_all_next)
|
||||
if(rrset->type == LDNS_RR_TYPE_SOA &&
|
||||
rrset->section == LDNS_SECTION_AUTHORITY)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if right hand name in NSEC is within zone
|
||||
* @param rrset: the NSEC rrset
|
||||
@@ -534,7 +564,7 @@ static int sanitize_nsec_is_overreach(struct rrset_parse* rrset,
|
||||
for(rr = rrset->rr_first; rr; rr = rr->next) {
|
||||
rhs = rr->ttl_data+4+2;
|
||||
len = ldns_read_uint16(rr->ttl_data+4);
|
||||
if(!(len=dname_valid(rhs, len))) {
|
||||
if(!dname_valid(rhs, len)) {
|
||||
/* malformed domain name in rdata */
|
||||
return 1;
|
||||
}
|
||||
@@ -566,6 +596,8 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
struct query_info* qinfo, uint8_t* zonename, struct module_env* env,
|
||||
struct iter_env* ie)
|
||||
{
|
||||
int del_addi = 0; /* if additional-holding rrsets are deleted, we
|
||||
do not trust the normalized additional-A-AAAA any more */
|
||||
struct rrset_parse* rrset, *prev;
|
||||
prev = NULL;
|
||||
rrset = msg->rrset_first;
|
||||
@@ -590,6 +622,7 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
* Remainders of CNAME chains are cut off and resolved by iterator. */
|
||||
while(rrset && rrset->section == LDNS_SECTION_ANSWER) {
|
||||
if(dname_pkt_compare(pkt, qinfo->qname, rrset->dname) != 0) {
|
||||
if(has_additional(rrset->type)) del_addi = 1;
|
||||
remove_rrset("sanitize: removing extraneous answer "
|
||||
"RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
@@ -613,9 +646,9 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
if( (rrset->type == LDNS_RR_TYPE_A ||
|
||||
rrset->type == LDNS_RR_TYPE_AAAA) &&
|
||||
priv_rrset_bad(ie->priv, pkt, rrset)) {
|
||||
/* set servfail, so the classification becomes
|
||||
* THROWAWAY, instead of LAME or other unwanted */
|
||||
FLAGS_SET_RCODE(msg->flags, LDNS_RCODE_SERVFAIL);
|
||||
|
||||
/* do not set servfail since this leads to too
|
||||
* many drops of other people using rfc1918 space */
|
||||
remove_rrset("sanitize: removing public name with "
|
||||
"private address", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
@@ -633,10 +666,15 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
rrset->type == LDNS_RR_TYPE_NS &&
|
||||
rrset->section == LDNS_SECTION_AUTHORITY &&
|
||||
FLAGS_GET_RCODE(msg->flags) ==
|
||||
LDNS_RCODE_NOERROR) {
|
||||
LDNS_RCODE_NOERROR && !soa_in_auth(msg) &&
|
||||
sub_of_pkt(pkt, zonename, rrset->dname)) {
|
||||
/* noerror, nodata and this NS rrset is above
|
||||
* the zone. This is LAME!
|
||||
* Leave in the NS for lame classification. */
|
||||
/* remove everything from the additional
|
||||
* (we dont want its glue that was approved
|
||||
* during the normalize action) */
|
||||
del_addi = 1;
|
||||
} else if(!env->cfg->harden_glue) {
|
||||
/* store in cache! Since it is relevant
|
||||
* (from normalize) it will be picked up
|
||||
@@ -646,11 +684,17 @@ scrub_sanitize(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
"poison RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
} else {
|
||||
if(has_additional(rrset->type)) del_addi = 1;
|
||||
remove_rrset("sanitize: removing potential "
|
||||
"poison RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(del_addi && rrset->section == LDNS_SECTION_ADDITIONAL) {
|
||||
remove_rrset("sanitize: removing potential "
|
||||
"poison reference RRset:", pkt, msg, prev, &rrset);
|
||||
continue;
|
||||
}
|
||||
/* check if right hand side of NSEC is within zone */
|
||||
if(rrset->type == LDNS_RR_TYPE_NSEC &&
|
||||
sanitize_nsec_is_overreach(rrset, zonename)) {
|
||||
@@ -676,6 +720,7 @@ scrub_message(ldns_buffer* pkt, struct msg_parse* msg,
|
||||
return 0;
|
||||
if( !(msg->flags&BIT_QR) )
|
||||
return 0;
|
||||
msg->flags &= ~(BIT_AD|BIT_Z); /* force off bit AD and Z */
|
||||
|
||||
/* make sure that a query is echoed back when NOERROR or NXDOMAIN */
|
||||
/* this is not required for basic operation but is a forgery
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#ifndef ITERATOR_ITER_SCRUB_H
|
||||
#define ITERATOR_ITER_SCRUB_H
|
||||
#include "ldns/buffer.h"
|
||||
struct msg_parse;
|
||||
struct query_info;
|
||||
struct regional;
|
||||
|
||||
+333
-119
@@ -60,11 +60,13 @@
|
||||
#include "util/random.h"
|
||||
#include "util/fptr_wlist.h"
|
||||
#include "validator/val_anchor.h"
|
||||
#include "validator/val_kcache.h"
|
||||
#include "validator/val_kentry.h"
|
||||
|
||||
/** time when nameserver glue is said to be 'recent' */
|
||||
#define SUSPICION_RECENT_EXPIRY 86400
|
||||
/** penalty to validation failed blacklisted IPs */
|
||||
#define BLACKLIST_PENALTY (USEFUL_SERVER_TOP_TIMEOUT*3)
|
||||
#define BLACKLIST_PENALTY (USEFUL_SERVER_TOP_TIMEOUT*4)
|
||||
|
||||
/** fillup fetch policy array */
|
||||
static void
|
||||
@@ -130,6 +132,7 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
||||
return 0;
|
||||
}
|
||||
iter_env->supports_ipv6 = cfg->do_ip6;
|
||||
iter_env->supports_ipv4 = cfg->do_ip4;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -148,6 +151,7 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
||||
* o The address is bogus (DNSSEC validation failure).
|
||||
* o Listed as donotquery
|
||||
* o is ipv6 but no ipv6 support (in operating system).
|
||||
* o is ipv4 but no ipv4 support (in operating system).
|
||||
* o is lame
|
||||
* Otherwise, an rtt in milliseconds.
|
||||
* 0 .. USEFUL_SERVER_TOP_TIMEOUT-1
|
||||
@@ -158,15 +162,17 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
|
||||
* This value exactly is given for unresponsive blacklisted.
|
||||
* USEFUL_SERVER_TOP_TIMEOUT+1
|
||||
* For non-blacklisted servers: huge timeout, but has traffic.
|
||||
* USEFUL_SERVER_TOP_TIMEOUT ..
|
||||
* dnsseclame servers get penalty
|
||||
* also for parent-side lame servers (lame in delegpt).
|
||||
* USEFUL_SERVER_TOP_TIMEOUT*1 ..
|
||||
* parent-side lame servers get this penalty. A dispreferential
|
||||
* server. (lame in delegpt).
|
||||
* USEFUL_SERVER_TOP_TIMEOUT*2 ..
|
||||
* dnsseclame servers get penalty
|
||||
* USEFUL_SERVER_TOP_TIMEOUT*3 ..
|
||||
* recursion lame servers get penalty
|
||||
* UNKNOWN_SERVER_NICENESS
|
||||
* If no information is known about the server, this is
|
||||
* returned. 376 msec or so.
|
||||
* +BLACKLIST_PENALTY (of USEFUL_TOP_TIMEOUT*3) for dnssec failed IPs.
|
||||
* +BLACKLIST_PENALTY (of USEFUL_TOP_TIMEOUT*4) for dnssec failed IPs.
|
||||
*
|
||||
* When a final value is chosen that is dnsseclame ; dnsseclameness checking
|
||||
* is turned off (so we do not discard the reply).
|
||||
@@ -179,43 +185,47 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
|
||||
struct delegpt_addr* a)
|
||||
{
|
||||
int rtt, lame, reclame, dnsseclame, lost;
|
||||
int rtt, lame, reclame, dnsseclame;
|
||||
if(a->bogus)
|
||||
return -1; /* address of server is bogus */
|
||||
if(donotq_lookup(iter_env->donotq, &a->addr, a->addrlen)) {
|
||||
log_addr(VERB_ALGO, "skip addr on the donotquery list",
|
||||
&a->addr, a->addrlen);
|
||||
return -1; /* server is on the donotquery list */
|
||||
}
|
||||
if(!iter_env->supports_ipv6 && addr_is_ip6(&a->addr, a->addrlen)) {
|
||||
return -1; /* there is no ip6 available */
|
||||
}
|
||||
if(!iter_env->supports_ipv4 && !addr_is_ip6(&a->addr, a->addrlen)) {
|
||||
return -1; /* there is no ip4 available */
|
||||
}
|
||||
/* check lameness - need zone , class info */
|
||||
if(infra_get_lame_rtt(env->infra_cache, &a->addr, a->addrlen,
|
||||
name, namelen, qtype, &lame, &dnsseclame, &reclame,
|
||||
&rtt, &lost, now)) {
|
||||
&rtt, now)) {
|
||||
log_addr(VERB_ALGO, "servselect", &a->addr, a->addrlen);
|
||||
verbose(VERB_ALGO, " rtt=%d%s%s%s", rtt,
|
||||
verbose(VERB_ALGO, " rtt=%d%s%s%s%s", rtt,
|
||||
lame?" LAME":"",
|
||||
dnsseclame?" DNSSEC_LAME":"",
|
||||
reclame?" REC_LAME":"");
|
||||
reclame?" REC_LAME":"",
|
||||
a->lame?" ADDR_LAME":"");
|
||||
if(lame)
|
||||
return -1; /* server is lame */
|
||||
else if(rtt >= USEFUL_SERVER_TOP_TIMEOUT &&
|
||||
lost >= USEFUL_SERVER_MAX_LOST)
|
||||
/* server is unresponsive */
|
||||
return USEFUL_SERVER_TOP_TIMEOUT;
|
||||
else if(rtt >= USEFUL_SERVER_TOP_TIMEOUT)
|
||||
/* server is unresponsive */
|
||||
return USEFUL_SERVER_TOP_TIMEOUT;
|
||||
/* select remainder from worst to best */
|
||||
else if(reclame)
|
||||
return rtt+USEFUL_SERVER_TOP_TIMEOUT*3; /* nonpref */
|
||||
else if(dnsseclame )
|
||||
return rtt+USEFUL_SERVER_TOP_TIMEOUT*2; /* nonpref */
|
||||
else if(a->lame)
|
||||
return rtt+USEFUL_SERVER_TOP_TIMEOUT+1; /* nonpref */
|
||||
else if(rtt >= USEFUL_SERVER_TOP_TIMEOUT) /* not blacklisted*/
|
||||
return USEFUL_SERVER_TOP_TIMEOUT+1;
|
||||
else if(reclame)
|
||||
return rtt+USEFUL_SERVER_TOP_TIMEOUT*2; /* nonpref */
|
||||
else if(dnsseclame )
|
||||
return rtt+USEFUL_SERVER_TOP_TIMEOUT; /* nonpref */
|
||||
else return rtt;
|
||||
}
|
||||
/* no server information present */
|
||||
if(a->lame)
|
||||
return USEFUL_SERVER_TOP_TIMEOUT+1; /* nonpref */
|
||||
return USEFUL_SERVER_TOP_TIMEOUT+1+UNKNOWN_SERVER_NICENESS; /* nonpref */
|
||||
return UNKNOWN_SERVER_NICENESS;
|
||||
}
|
||||
|
||||
@@ -307,7 +317,7 @@ iter_filter_order(struct iter_env* iter_env, struct module_env* env,
|
||||
struct delegpt_addr*
|
||||
iter_server_selection(struct iter_env* iter_env,
|
||||
struct module_env* env, struct delegpt* dp,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, int* dnssec_expected,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype, int* dnssec_lame,
|
||||
int* chase_to_rd, int open_target, struct sock_list* blacklist)
|
||||
{
|
||||
int sel;
|
||||
@@ -319,20 +329,28 @@ iter_server_selection(struct iter_env* iter_env,
|
||||
if(num == 0)
|
||||
return NULL;
|
||||
verbose(VERB_ALGO, "selrtt %d", selrtt);
|
||||
if(selrtt > USEFUL_SERVER_TOP_TIMEOUT*2) {
|
||||
verbose(VERB_ALGO, "chase to recursion lame server");
|
||||
*chase_to_rd = 1;
|
||||
}
|
||||
if(selrtt > USEFUL_SERVER_TOP_TIMEOUT) {
|
||||
verbose(VERB_ALGO, "chase to dnssec lame server");
|
||||
*dnssec_expected = 0;
|
||||
}
|
||||
if(selrtt == USEFUL_SERVER_TOP_TIMEOUT) {
|
||||
verbose(VERB_ALGO, "chase to blacklisted lame server");
|
||||
/* the best choice is a blacklisted, unresponsive server,
|
||||
* we need to throttle down our traffic towards it */
|
||||
if(ub_random(env->rnd) % 100 != 1) {
|
||||
/* 99% of the time, drop query */
|
||||
if(selrtt > BLACKLIST_PENALTY) {
|
||||
if(selrtt-BLACKLIST_PENALTY > USEFUL_SERVER_TOP_TIMEOUT*3) {
|
||||
verbose(VERB_ALGO, "chase to "
|
||||
"blacklisted recursion lame server");
|
||||
*chase_to_rd = 1;
|
||||
}
|
||||
if(selrtt-BLACKLIST_PENALTY > USEFUL_SERVER_TOP_TIMEOUT*2) {
|
||||
verbose(VERB_ALGO, "chase to "
|
||||
"blacklisted dnssec lame server");
|
||||
*dnssec_lame = 1;
|
||||
}
|
||||
} else {
|
||||
if(selrtt > USEFUL_SERVER_TOP_TIMEOUT*3) {
|
||||
verbose(VERB_ALGO, "chase to recursion lame server");
|
||||
*chase_to_rd = 1;
|
||||
}
|
||||
if(selrtt > USEFUL_SERVER_TOP_TIMEOUT*2) {
|
||||
verbose(VERB_ALGO, "chase to dnssec lame server");
|
||||
*dnssec_lame = 1;
|
||||
}
|
||||
if(selrtt == USEFUL_SERVER_TOP_TIMEOUT) {
|
||||
verbose(VERB_ALGO, "chase to blacklisted lame server");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -347,9 +365,9 @@ iter_server_selection(struct iter_env* iter_env,
|
||||
|
||||
/* randomly select a target from the list */
|
||||
log_assert(num > 1);
|
||||
/* we do not need secure random numbers here, but
|
||||
* we do need it to be threadsafe, so we use this */
|
||||
sel = ub_random(env->rnd) % num;
|
||||
/* grab secure random number, to pick unexpected server.
|
||||
* also we need it to be threadsafe. */
|
||||
sel = ub_random_max(env->rnd, num);
|
||||
a = dp->result_list;
|
||||
prev = NULL;
|
||||
while(sel > 0 && a) {
|
||||
@@ -402,9 +420,9 @@ dns_copy_msg(struct dns_msg* from, struct regional* region)
|
||||
|
||||
int
|
||||
iter_dns_store(struct module_env* env, struct query_info* msgqinf,
|
||||
struct reply_info* msgrep, int is_referral)
|
||||
struct reply_info* msgrep, int is_referral, uint32_t leeway)
|
||||
{
|
||||
return dns_cache_store(env, msgqinf, msgrep, is_referral);
|
||||
return dns_cache_store(env, msgqinf, msgrep, is_referral, leeway);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -415,58 +433,10 @@ iter_ns_probability(struct ub_randstate* rnd, int n, int m)
|
||||
return 1;
|
||||
/* we do not need secure random numbers here, but
|
||||
* we do need it to be threadsafe, so we use this */
|
||||
sel = ub_random(rnd) % m;
|
||||
sel = ub_random_max(rnd, m);
|
||||
return (sel < n);
|
||||
}
|
||||
|
||||
int iter_suspect_exists(struct query_info* qinfo, struct delegpt* dp,
|
||||
struct module_env* env)
|
||||
{
|
||||
struct ub_packed_rrset_key* r;
|
||||
if(qinfo->qtype != LDNS_RR_TYPE_A && qinfo->qtype != LDNS_RR_TYPE_AAAA)
|
||||
return 0; /* not glue type */
|
||||
if(!dname_subdomain_c(qinfo->qname, dp->name))
|
||||
return 0; /* not in-zone */
|
||||
if(!delegpt_find_ns(dp, qinfo->qname, qinfo->qname_len))
|
||||
return 0; /* not glue */
|
||||
|
||||
/* do we suspect that it exists? lookup with time=0 */
|
||||
r = rrset_cache_lookup(env->rrset_cache, qinfo->qname,
|
||||
qinfo->qname_len, qinfo->qtype, qinfo->qclass, 0, 0, 0);
|
||||
if(r) {
|
||||
struct packed_rrset_data* d = (struct packed_rrset_data*)
|
||||
r->entry.data;
|
||||
/* if it is valid, no need for queries to parent zone */
|
||||
if(*env->now <= d->ttl) {
|
||||
lock_rw_unlock(&r->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
/* was it recently expired? */
|
||||
if( (*env->now - d->ttl) <= SUSPICION_RECENT_EXPIRY) {
|
||||
verbose(VERB_ALGO, "suspect glue at parent: "
|
||||
"rrset recently expired");
|
||||
lock_rw_unlock(&r->entry.lock);
|
||||
return 1;
|
||||
}
|
||||
lock_rw_unlock(&r->entry.lock);
|
||||
}
|
||||
|
||||
/* so, qinfo not there, does the other A/AAAA type exist in cache? */
|
||||
r=rrset_cache_lookup(env->rrset_cache, qinfo->qname, qinfo->qname_len,
|
||||
(qinfo->qtype==LDNS_RR_TYPE_A)?LDNS_RR_TYPE_AAAA:LDNS_RR_TYPE_A,
|
||||
qinfo->qclass, 0, *env->now, 0);
|
||||
if(r) {
|
||||
/* it exists and explains why the glue is there */
|
||||
lock_rw_unlock(&r->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* neither exist, so logically, one should exist for a nameserver */
|
||||
verbose(VERB_ALGO, "suspect glue at parent: "
|
||||
"neither A nor AAAA exist in cache");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** detect dependency cycle for query and target */
|
||||
static int
|
||||
causes_cycle(struct module_qstate* qstate, uint8_t* name, size_t namelen,
|
||||
@@ -505,17 +475,42 @@ iter_mark_cycle_targets(struct module_qstate* qstate, struct delegpt* dp)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
iter_mark_pside_cycle_targets(struct module_qstate* qstate, struct delegpt* dp)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
if(ns->done_pside4 && ns->done_pside6)
|
||||
continue;
|
||||
/* see if this ns as target causes dependency cycle */
|
||||
if(causes_cycle(qstate, ns->name, ns->namelen,
|
||||
LDNS_RR_TYPE_A, qstate->qinfo.qclass)) {
|
||||
log_nametypeclass(VERB_QUERY, "skipping target due "
|
||||
"to dependency cycle", ns->name,
|
||||
LDNS_RR_TYPE_A, qstate->qinfo.qclass);
|
||||
ns->done_pside4 = 1;
|
||||
}
|
||||
if(causes_cycle(qstate, ns->name, ns->namelen,
|
||||
LDNS_RR_TYPE_AAAA, qstate->qinfo.qclass)) {
|
||||
log_nametypeclass(VERB_QUERY, "skipping target due "
|
||||
"to dependency cycle", ns->name,
|
||||
LDNS_RR_TYPE_AAAA, qstate->qinfo.qclass);
|
||||
ns->done_pside6 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
iter_dp_is_useless(struct query_info* qinfo, uint16_t qflags,
|
||||
struct delegpt* dp)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
/* check:
|
||||
* o RD qflag is off.
|
||||
* o RD qflag is on.
|
||||
* o no addresses are provided.
|
||||
* o all NS items are required glue.
|
||||
* OR
|
||||
* o RD qflag is off.
|
||||
* o RD qflag is on.
|
||||
* o no addresses are provided.
|
||||
* o the query is for one of the nameservers in dp,
|
||||
* and that nameserver is a glue-name for this dp.
|
||||
@@ -561,6 +556,23 @@ iter_indicates_dnssec(struct module_env* env, struct delegpt* dp,
|
||||
reply_find_rrset_section_ns(msg->rep, dp->name, dp->namelen,
|
||||
LDNS_RR_TYPE_DS, dclass))
|
||||
return 1;
|
||||
/* look in key cache */
|
||||
if(env->key_cache) {
|
||||
struct key_entry_key* kk = key_cache_obtain(env->key_cache,
|
||||
dp->name, dp->namelen, dclass, env->scratch, *env->now);
|
||||
if(kk) {
|
||||
if(query_dname_compare(kk->name, dp->name) == 0) {
|
||||
if(key_entry_isgood(kk) || key_entry_isbad(kk)) {
|
||||
regional_free_all(env->scratch);
|
||||
return 1;
|
||||
} else if(key_entry_isnull(kk)) {
|
||||
regional_free_all(env->scratch);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
regional_free_all(env->scratch);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -665,12 +677,13 @@ rrset_equal(struct ub_packed_rrset_key* k1, struct ub_packed_rrset_key* k2)
|
||||
}
|
||||
|
||||
int
|
||||
reply_equal(struct reply_info* p, struct reply_info* q)
|
||||
reply_equal(struct reply_info* p, struct reply_info* q, ldns_buffer* scratch)
|
||||
{
|
||||
size_t i;
|
||||
if(p->flags != q->flags ||
|
||||
p->qdcount != q->qdcount ||
|
||||
p->ttl != q->ttl ||
|
||||
p->prefetch_ttl != q->prefetch_ttl ||
|
||||
p->security != q->security ||
|
||||
p->an_numrrsets != q->an_numrrsets ||
|
||||
p->ns_numrrsets != q->ns_numrrsets ||
|
||||
@@ -678,63 +691,190 @@ reply_equal(struct reply_info* p, struct reply_info* q)
|
||||
p->rrset_count != q->rrset_count)
|
||||
return 0;
|
||||
for(i=0; i<p->rrset_count; i++) {
|
||||
if(!rrset_equal(p->rrsets[i], q->rrsets[i]))
|
||||
return 0;
|
||||
if(!rrset_equal(p->rrsets[i], q->rrsets[i])) {
|
||||
/* fallback procedure: try to sort and canonicalize */
|
||||
ldns_rr_list* pl, *ql;
|
||||
pl = packed_rrset_to_rr_list(p->rrsets[i], scratch);
|
||||
ql = packed_rrset_to_rr_list(q->rrsets[i], scratch);
|
||||
if(!pl || !ql) {
|
||||
ldns_rr_list_deep_free(pl);
|
||||
ldns_rr_list_deep_free(ql);
|
||||
return 0;
|
||||
}
|
||||
ldns_rr_list2canonical(pl);
|
||||
ldns_rr_list2canonical(ql);
|
||||
ldns_rr_list_sort(pl);
|
||||
ldns_rr_list_sort(ql);
|
||||
if(ldns_rr_list_compare(pl, ql) != 0) {
|
||||
ldns_rr_list_deep_free(pl);
|
||||
ldns_rr_list_deep_free(ql);
|
||||
return 0;
|
||||
}
|
||||
ldns_rr_list_deep_free(pl);
|
||||
ldns_rr_list_deep_free(ql);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
iter_store_inzone_glue(struct module_env* env, struct query_info* qinfo,
|
||||
struct reply_info* rep)
|
||||
iter_store_parentside_rrset(struct module_env* env,
|
||||
struct ub_packed_rrset_key* rrset)
|
||||
{
|
||||
struct rrset_ref ref;
|
||||
struct ub_packed_rrset_key* rrset;
|
||||
if(qinfo->qtype != LDNS_RR_TYPE_A && qinfo->qtype != LDNS_RR_TYPE_AAAA)
|
||||
return;
|
||||
rrset = reply_find_rrset(rep, qinfo->qname, qinfo->qname_len,
|
||||
qinfo->qtype, qinfo->qclass);
|
||||
if(!rrset)
|
||||
return;
|
||||
/* got A or AAAA glue rrset. store it in case its handy */
|
||||
rrset = packed_rrset_copy_alloc(rrset, env->alloc, *env->now);
|
||||
if(!rrset) {
|
||||
log_err("malloc failure in store_inzone_glue");
|
||||
log_err("malloc failure in store_parentside_rrset");
|
||||
return;
|
||||
}
|
||||
rrset->rk.flags |= PACKED_RRSET_PARENT_SIDE;
|
||||
rrset->entry.hash = rrset_key_hash(&rrset->rk);
|
||||
ref.key = rrset;
|
||||
ref.id = rrset->id;
|
||||
/* ignore ret: it was in the cache, ref updated */
|
||||
/* ignore ret: if it was in the cache, ref updated */
|
||||
(void)rrset_cache_update(env->rrset_cache, &ref, env->alloc, *env->now);
|
||||
}
|
||||
|
||||
/** fetch NS record from reply, if any */
|
||||
static struct ub_packed_rrset_key*
|
||||
reply_get_NS_rrset(struct reply_info* rep)
|
||||
{
|
||||
size_t i;
|
||||
for(i=0; i<rep->rrset_count; i++) {
|
||||
if(rep->rrsets[i]->rk.type == htons(LDNS_RR_TYPE_NS)) {
|
||||
return rep->rrsets[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
iter_store_parentside_NS(struct module_env* env, struct reply_info* rep)
|
||||
{
|
||||
struct ub_packed_rrset_key* rrset = reply_get_NS_rrset(rep);
|
||||
if(rrset) {
|
||||
log_rrset_key(VERB_ALGO, "store parent-side NS", rrset);
|
||||
iter_store_parentside_rrset(env, rrset);
|
||||
}
|
||||
}
|
||||
|
||||
void iter_store_parentside_neg(struct module_env* env,
|
||||
struct query_info* qinfo, struct reply_info* rep)
|
||||
{
|
||||
/* TTL: NS from referral in iq->deleg_msg,
|
||||
* or first RR from iq->response,
|
||||
* or servfail5secs if !iq->response */
|
||||
uint32_t ttl = NORR_TTL;
|
||||
struct ub_packed_rrset_key* neg;
|
||||
struct packed_rrset_data* newd;
|
||||
if(rep) {
|
||||
struct ub_packed_rrset_key* rrset = reply_get_NS_rrset(rep);
|
||||
if(!rrset && rep->rrset_count != 0) rrset = rep->rrsets[0];
|
||||
if(rrset) ttl = ub_packed_rrset_ttl(rrset);
|
||||
}
|
||||
/* create empty rrset to store */
|
||||
neg = (struct ub_packed_rrset_key*)regional_alloc(env->scratch,
|
||||
sizeof(struct ub_packed_rrset_key));
|
||||
if(!neg) {
|
||||
log_err("out of memory in store_parentside_neg");
|
||||
return;
|
||||
}
|
||||
memset(&neg->entry, 0, sizeof(neg->entry));
|
||||
neg->entry.key = neg;
|
||||
neg->rk.type = htons(qinfo->qtype);
|
||||
neg->rk.rrset_class = htons(qinfo->qclass);
|
||||
neg->rk.flags = 0;
|
||||
neg->rk.dname = regional_alloc_init(env->scratch, qinfo->qname,
|
||||
qinfo->qname_len);
|
||||
if(!neg->rk.dname) {
|
||||
log_err("out of memory in store_parentside_neg");
|
||||
return;
|
||||
}
|
||||
neg->rk.dname_len = qinfo->qname_len;
|
||||
neg->entry.hash = rrset_key_hash(&neg->rk);
|
||||
newd = (struct packed_rrset_data*)regional_alloc_zero(env->scratch,
|
||||
sizeof(struct packed_rrset_data) + sizeof(size_t) +
|
||||
sizeof(uint8_t*) + sizeof(uint32_t) + sizeof(uint16_t));
|
||||
if(!newd) {
|
||||
log_err("out of memory in store_parentside_neg");
|
||||
return;
|
||||
}
|
||||
neg->entry.data = newd;
|
||||
newd->ttl = ttl;
|
||||
/* entry must have one RR, otherwise not valid in cache.
|
||||
* put in one RR with empty rdata: those are ignored as nameserver */
|
||||
newd->count = 1;
|
||||
newd->rrsig_count = 0;
|
||||
newd->trust = rrset_trust_ans_noAA;
|
||||
newd->rr_len = (size_t*)((uint8_t*)newd +
|
||||
sizeof(struct packed_rrset_data));
|
||||
newd->rr_len[0] = 0 /* zero len rdata */ + sizeof(uint16_t);
|
||||
packed_rrset_ptr_fixup(newd);
|
||||
newd->rr_ttl[0] = newd->ttl;
|
||||
ldns_write_uint16(newd->rr_data[0], 0 /* zero len rdata */);
|
||||
/* store it */
|
||||
log_rrset_key(VERB_ALGO, "store parent-side negative", neg);
|
||||
iter_store_parentside_rrset(env, neg);
|
||||
}
|
||||
|
||||
int
|
||||
iter_lookup_inzone_glue(struct module_env* env, struct delegpt* dp,
|
||||
iter_lookup_parent_NS_from_cache(struct module_env* env, struct delegpt* dp,
|
||||
struct regional* region, struct query_info* qinfo)
|
||||
{
|
||||
struct ub_packed_rrset_key* akey;
|
||||
akey = rrset_cache_lookup(env->rrset_cache, qinfo->qname,
|
||||
qinfo->qname_len, qinfo->qtype, qinfo->qclass,
|
||||
akey = rrset_cache_lookup(env->rrset_cache, dp->name,
|
||||
dp->namelen, LDNS_RR_TYPE_NS, qinfo->qclass,
|
||||
PACKED_RRSET_PARENT_SIDE, *env->now, 0);
|
||||
if(akey) {
|
||||
if(qinfo->qtype == LDNS_RR_TYPE_A) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 1, 1)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
} else if(qinfo->qtype == LDNS_RR_TYPE_AAAA) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 1, 1)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
log_rrset_key(VERB_ALGO, "found parent-side NS in cache", akey);
|
||||
dp->has_parent_side_NS = 1;
|
||||
/* and mark the new names as lame */
|
||||
if(!delegpt_rrset_add_ns(dp, region, akey, 1)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int iter_lookup_parent_glue_from_cache(struct module_env* env,
|
||||
struct delegpt* dp, struct regional* region, struct query_info* qinfo)
|
||||
{
|
||||
struct ub_packed_rrset_key* akey;
|
||||
struct delegpt_ns* ns;
|
||||
size_t num = delegpt_count_targets(dp);
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
/* get cached parentside A */
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_A, qinfo->qclass,
|
||||
PACKED_RRSET_PARENT_SIDE, *env->now, 0);
|
||||
if(akey) {
|
||||
log_rrset_key(VERB_ALGO, "found parent-side", akey);
|
||||
ns->done_pside4 = 1;
|
||||
/* a negative-cache-element has no addresses it adds */
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 1))
|
||||
log_err("malloc failure in lookup_parent_glue");
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
/* get cached parentside AAAA */
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_AAAA, qinfo->qclass,
|
||||
PACKED_RRSET_PARENT_SIDE, *env->now, 0);
|
||||
if(akey) {
|
||||
log_rrset_key(VERB_ALGO, "found parent-side", akey);
|
||||
ns->done_pside6 = 1;
|
||||
/* a negative-cache-element has no addresses it adds */
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 1))
|
||||
log_err("malloc failure in lookup_parent_glue");
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
}
|
||||
/* see if new (but lame) addresses have become available */
|
||||
return delegpt_count_targets(dp) != num;
|
||||
}
|
||||
|
||||
int
|
||||
iter_get_next_root(struct iter_hints* hints, struct iter_forwards* fwd,
|
||||
uint16_t* c)
|
||||
@@ -753,3 +893,77 @@ iter_get_next_root(struct iter_hints* hints, struct iter_forwards* fwd,
|
||||
else *c = c2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
iter_scrub_ds(struct dns_msg* msg, struct ub_packed_rrset_key* ns, uint8_t* z)
|
||||
{
|
||||
/* Only the DS record for the delegation itself is expected.
|
||||
* We allow DS for everything between the bailiwick and the
|
||||
* zonecut, thus DS records must be at or above the zonecut.
|
||||
* And the DS records must be below the server authority zone.
|
||||
* The answer section is already scrubbed. */
|
||||
size_t i = msg->rep->an_numrrsets;
|
||||
while(i < (msg->rep->an_numrrsets + msg->rep->ns_numrrsets)) {
|
||||
struct ub_packed_rrset_key* s = msg->rep->rrsets[i];
|
||||
if(ntohs(s->rk.type) == LDNS_RR_TYPE_DS &&
|
||||
(!ns || !dname_subdomain_c(ns->rk.dname, s->rk.dname)
|
||||
|| query_dname_compare(z, s->rk.dname) == 0)) {
|
||||
log_nametypeclass(VERB_ALGO, "removing irrelevant DS",
|
||||
s->rk.dname, ntohs(s->rk.type),
|
||||
ntohs(s->rk.rrset_class));
|
||||
memmove(msg->rep->rrsets+i, msg->rep->rrsets+i+1,
|
||||
sizeof(struct ub_packed_rrset_key*) *
|
||||
(msg->rep->rrset_count-i-1));
|
||||
msg->rep->ns_numrrsets--;
|
||||
msg->rep->rrset_count--;
|
||||
/* stay at same i, but new record */
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void iter_dec_attempts(struct delegpt* dp, int d)
|
||||
{
|
||||
struct delegpt_addr* a;
|
||||
for(a=dp->target_list; a; a = a->next_target) {
|
||||
if(a->attempts >= OUTBOUND_MSG_RETRY) {
|
||||
/* add back to result list */
|
||||
a->next_result = dp->result_list;
|
||||
dp->result_list = a;
|
||||
}
|
||||
if(a->attempts > d)
|
||||
a->attempts -= d;
|
||||
else a->attempts = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void iter_merge_retry_counts(struct delegpt* dp, struct delegpt* old)
|
||||
{
|
||||
struct delegpt_addr* a, *o, *prev;
|
||||
for(a=dp->target_list; a; a = a->next_target) {
|
||||
o = delegpt_find_addr(old, &a->addr, a->addrlen);
|
||||
if(o) {
|
||||
log_addr(VERB_ALGO, "copy attempt count previous dp",
|
||||
&a->addr, a->addrlen);
|
||||
a->attempts = o->attempts;
|
||||
}
|
||||
}
|
||||
prev = NULL;
|
||||
a = dp->usable_list;
|
||||
while(a) {
|
||||
if(a->attempts >= OUTBOUND_MSG_RETRY) {
|
||||
log_addr(VERB_ALGO, "remove from usable list dp",
|
||||
&a->addr, a->addrlen);
|
||||
/* remove from result list */
|
||||
if(prev)
|
||||
prev->next_usable = a->next_usable;
|
||||
else dp->usable_list = a->next_usable;
|
||||
/* prev stays the same */
|
||||
a = a->next_usable;
|
||||
continue;
|
||||
}
|
||||
prev = a;
|
||||
a = a->next_usable;
|
||||
}
|
||||
}
|
||||
|
||||
+92
-29
@@ -43,6 +43,7 @@
|
||||
#ifndef ITERATOR_ITER_UTILS_H
|
||||
#define ITERATOR_ITER_UTILS_H
|
||||
#include "iterator/iter_resptype.h"
|
||||
#include "ldns/buffer.h"
|
||||
struct iter_env;
|
||||
struct iter_hints;
|
||||
struct iter_forwards;
|
||||
@@ -57,6 +58,7 @@ struct query_info;
|
||||
struct reply_info;
|
||||
struct module_qstate;
|
||||
struct sock_list;
|
||||
struct ub_packed_rrset_key;
|
||||
|
||||
/**
|
||||
* Process config options and set iterator module state.
|
||||
@@ -78,7 +80,7 @@ int iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg);
|
||||
* @param name: zone name (for lameness check).
|
||||
* @param namelen: length of name.
|
||||
* @param qtype: query type that we want to send.
|
||||
* @param dnssec_expected: set to 0, if a known dnssec-lame server is selected
|
||||
* @param dnssec_lame: set to 1, if a known dnssec-lame server is selected
|
||||
* these are not preferred, but are used as a last resort.
|
||||
* @param chase_to_rd: set to 1 if a known recursion lame server is selected
|
||||
* these are not preferred, but are used as a last resort.
|
||||
@@ -90,7 +92,7 @@ int iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg);
|
||||
*/
|
||||
struct delegpt_addr* iter_server_selection(struct iter_env* iter_env,
|
||||
struct module_env* env, struct delegpt* dp, uint8_t* name,
|
||||
size_t namelen, uint16_t qtype, int* dnssec_expected,
|
||||
size_t namelen, uint16_t qtype, int* dnssec_lame,
|
||||
int* chase_to_rd, int open_target, struct sock_list* blacklist);
|
||||
|
||||
/**
|
||||
@@ -118,10 +120,11 @@ struct dns_msg* dns_copy_msg(struct dns_msg* from, struct regional* regional);
|
||||
* @param rep: reply in dns_msg from dns_alloc_msg for example.
|
||||
* @param is_referral: If true, then the given message to be stored is a
|
||||
* referral. The cache implementation may use this as a hint.
|
||||
* @param leeway: prefetch TTL leeway to expire old rrsets quicker.
|
||||
* @return 0 on alloc error (out of memory).
|
||||
*/
|
||||
int iter_dns_store(struct module_env* env, struct query_info* qinf,
|
||||
struct reply_info* rep, int is_referral);
|
||||
struct reply_info* rep, int is_referral, uint32_t leeway);
|
||||
|
||||
/**
|
||||
* Select randomly with n/m probability.
|
||||
@@ -142,17 +145,13 @@ int iter_ns_probability(struct ub_randstate* rnd, int n, int m);
|
||||
void iter_mark_cycle_targets(struct module_qstate* qstate, struct delegpt* dp);
|
||||
|
||||
/**
|
||||
* See if query is in-zone glue and we suspect that it exists.
|
||||
* Suspicion that it exists, is if there is no A or AAAA in cache (since
|
||||
* one of them is expected for an NS record) or the qtype is in cache but
|
||||
* was recently expired (so we have seen this data recently).
|
||||
* @param qinfo: query info.
|
||||
* @param dp: delegation point we are at.
|
||||
* @param env: environment with rrset cache.
|
||||
* @return true if suspect that this glue exists.
|
||||
* Mark targets that result in a dependency cycle as done, so they
|
||||
* will not get selected as targets. For the parent-side lookups.
|
||||
* @param qstate: query state.
|
||||
* @param dp: delegpt to mark ns in.
|
||||
*/
|
||||
int iter_suspect_exists(struct query_info* qinfo, struct delegpt* dp,
|
||||
struct module_env* env);
|
||||
void iter_mark_pside_cycle_targets(struct module_qstate* qstate,
|
||||
struct delegpt* dp);
|
||||
|
||||
/**
|
||||
* See if delegation is useful or offers immediately no targets for
|
||||
@@ -160,6 +159,7 @@ int iter_suspect_exists(struct query_info* qinfo, struct delegpt* dp,
|
||||
* @param qinfo: query name and type
|
||||
* @param qflags: query flags with RD flag
|
||||
* @param dp: delegpt to check.
|
||||
* @return true if dp is useless.
|
||||
*/
|
||||
int iter_dp_is_useless(struct query_info* qinfo, uint16_t qflags,
|
||||
struct delegpt* dp);
|
||||
@@ -208,31 +208,69 @@ int iter_msg_from_zone(struct dns_msg* msg, struct delegpt* dp,
|
||||
* @param p: reply one. The reply has rrset data pointers in region.
|
||||
* Does not check rrset-IDs
|
||||
* @param q: reply two
|
||||
* @param buf: scratch buffer.
|
||||
* @return if one and two are equal.
|
||||
*/
|
||||
int reply_equal(struct reply_info* p, struct reply_info* q);
|
||||
int reply_equal(struct reply_info* p, struct reply_info* q, ldns_buffer* buf);
|
||||
|
||||
/**
|
||||
* Store in-zone glue in seperate rrset cache entries for later last-resort
|
||||
* lookups in case the child-side versions of this information fails.
|
||||
* Store parent-side rrset in seperate rrset cache entries for later
|
||||
* last-resort * lookups in case the child-side versions of this information
|
||||
* fails.
|
||||
* @param env: environment with cache, time, ...
|
||||
* @param qinfo: query info. must match the information stored to avoid
|
||||
* Kaminsky-style trouble.
|
||||
* @param rep: reply with possibly A or AAAA content to store.
|
||||
* @param rrset: the rrset to store (copied).
|
||||
* Failure to store is logged, but otherwise ignored.
|
||||
*/
|
||||
void iter_store_inzone_glue(struct module_env* env, struct query_info* qinfo,
|
||||
struct reply_info* rep);
|
||||
void iter_store_parentside_rrset(struct module_env* env,
|
||||
struct ub_packed_rrset_key* rrset);
|
||||
|
||||
/**
|
||||
* Find in-zone glue from rrset cache again.
|
||||
* @param env: query env with rrset cache and time.
|
||||
* @param dp: delegation point to store result in.
|
||||
* @param region: region to alloc result in.
|
||||
* @param qinfo: query into that is pertinent.
|
||||
* @return false on malloc failure.
|
||||
* Store parent-side NS records from a referral message
|
||||
* @param env: environment with cache, time, ...
|
||||
* @param rep: response with NS rrset.
|
||||
* Failure to store is logged, but otherwise ignored.
|
||||
*/
|
||||
int iter_lookup_inzone_glue(struct module_env* env, struct delegpt* dp,
|
||||
struct regional* region, struct query_info* qinfo);
|
||||
void iter_store_parentside_NS(struct module_env* env, struct reply_info* rep);
|
||||
|
||||
/**
|
||||
* Store parent-side negative element, the parentside rrset does not exist,
|
||||
* creates an rrset with empty rdata in the rrset cache with PARENTSIDE flag.
|
||||
* @param env: environment with cache, time, ...
|
||||
* @param qinfo: the identity of the rrset that is missing.
|
||||
* @param rep: delegation response or answer response, to glean TTL from.
|
||||
* (malloc) failure is logged but otherwise ignored.
|
||||
*/
|
||||
void iter_store_parentside_neg(struct module_env* env,
|
||||
struct query_info* qinfo, struct reply_info* rep);
|
||||
|
||||
/**
|
||||
* Add parent NS record if that exists in the cache. This is both new
|
||||
* information and acts like a timeout throttle on retries.
|
||||
* @param env: query env with rrset cache and time.
|
||||
* @param dp: delegation point to store result in. Also this dp is used to
|
||||
* see which NS name is needed.
|
||||
* @param region: region to alloc result in.
|
||||
* @param qinfo: pertinent information, the qclass.
|
||||
* @return false on malloc failure.
|
||||
* if true, the routine worked and if such cached information
|
||||
* existed dp->has_parent_side_NS is set true.
|
||||
*/
|
||||
int iter_lookup_parent_NS_from_cache(struct module_env* env,
|
||||
struct delegpt* dp, struct regional* region, struct query_info* qinfo);
|
||||
|
||||
/**
|
||||
* Add parent-side glue if that exists in the cache. This is both new
|
||||
* information and acts like a timeout throttle on retries to fetch them.
|
||||
* @param env: query env with rrset cache and time.
|
||||
* @param dp: delegation point to store result in. Also this dp is used to
|
||||
* see which NS name is needed.
|
||||
* @param region: region to alloc result in.
|
||||
* @param qinfo: pertinent information, the qclass.
|
||||
* @return: true, it worked, no malloc failures, and new addresses (lame)
|
||||
* have been added, giving extra options as query targets.
|
||||
*/
|
||||
int iter_lookup_parent_glue_from_cache(struct module_env* env,
|
||||
struct delegpt* dp, struct regional* region, struct query_info* qinfo);
|
||||
|
||||
/**
|
||||
* Lookup next root-hint or root-forward entry.
|
||||
@@ -244,4 +282,29 @@ int iter_lookup_inzone_glue(struct module_env* env, struct delegpt* dp,
|
||||
int iter_get_next_root(struct iter_hints* hints, struct iter_forwards* fwd,
|
||||
uint16_t* c);
|
||||
|
||||
/**
|
||||
* Remove DS records that are inappropriate before they are cached.
|
||||
* @param msg: the response to scrub.
|
||||
* @param ns: RRSET that is the NS record for the referral.
|
||||
* if NULL, then all DS records are removed from the authority section.
|
||||
* @param z: zone name that the response is from.
|
||||
*/
|
||||
void iter_scrub_ds(struct dns_msg* msg, struct ub_packed_rrset_key* ns,
|
||||
uint8_t* z);
|
||||
|
||||
/**
|
||||
* Remove query attempts from all available ips. For 0x20.
|
||||
* @param dp: delegpt.
|
||||
* @param d: decrease.
|
||||
*/
|
||||
void iter_dec_attempts(struct delegpt* dp, int d);
|
||||
|
||||
/**
|
||||
* Add retry counts from older delegpt to newer delegpt.
|
||||
* Does not waste time on timeout'd (or other failing) addresses.
|
||||
* @param dp: new delegationpoint.
|
||||
* @param old: old delegationpoint.
|
||||
*/
|
||||
void iter_merge_retry_counts(struct delegpt* dp, struct delegpt* old);
|
||||
|
||||
#endif /* ITERATOR_ITER_UTILS_H */
|
||||
|
||||
+413
-100
@@ -41,6 +41,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ldns/ldns.h"
|
||||
#include "iterator/iterator.h"
|
||||
#include "iterator/iter_utils.h"
|
||||
#include "iterator/iter_hints.h"
|
||||
@@ -119,6 +120,7 @@ iter_new(struct module_qstate* qstate, int id)
|
||||
iq->wait_priming_stub = 0;
|
||||
iq->refetch_glue = 0;
|
||||
iq->dnssec_expected = 0;
|
||||
iq->dnssec_lame_query = 0;
|
||||
iq->chase_flags = qstate->query_flags;
|
||||
/* Start with the (current) qname. */
|
||||
iq->qchase = qstate->qinfo;
|
||||
@@ -195,6 +197,12 @@ error_supers(struct module_qstate* qstate, int id, struct module_qstate* super)
|
||||
delegpt_log(VERB_ALGO, super_iq->dp);
|
||||
log_assert(0);
|
||||
return;
|
||||
} else {
|
||||
/* see if the failure did get (parent-lame) info */
|
||||
if(!cache_fill_missing(super->env,
|
||||
super_iq->qchase.qclass, super->region,
|
||||
super_iq->dp))
|
||||
log_err("out of memory adding missing");
|
||||
}
|
||||
dpns->resolved = 1; /* mark as failed */
|
||||
super_iq->num_target_queries--;
|
||||
@@ -247,10 +255,11 @@ error_response_cache(struct module_qstate* qstate, int id, int rcode)
|
||||
FLAGS_SET_RCODE(err.flags, rcode);
|
||||
err.qdcount = 1;
|
||||
err.ttl = NORR_TTL;
|
||||
err.prefetch_ttl = PREFETCH_TTL_CALC(err.ttl);
|
||||
/* do not waste time trying to validate this servfail */
|
||||
err.security = sec_status_indeterminate;
|
||||
verbose(VERB_ALGO, "store error response in message cache");
|
||||
if(!iter_dns_store(qstate->env, &qstate->qinfo, &err, 0)) {
|
||||
if(!iter_dns_store(qstate->env, &qstate->qinfo, &err, 0, 0)) {
|
||||
log_err("error_response_cache: could not store error (nomem)");
|
||||
}
|
||||
return error_response(qstate, id, rcode);
|
||||
@@ -314,11 +323,8 @@ iter_prepend(struct iter_qstate* iq, struct dns_msg* msg,
|
||||
(msg->rep->ns_numrrsets + msg->rep->ar_numrrsets) *
|
||||
sizeof(struct ub_packed_rrset_key*));
|
||||
|
||||
/* if the rcode was NXDOMAIN, and we prepended DNAME/CNAMEs, then
|
||||
* it should now be NOERROR. */
|
||||
if(FLAGS_GET_RCODE(msg->rep->flags) == LDNS_RCODE_NXDOMAIN) {
|
||||
FLAGS_SET_RCODE(msg->rep->flags, LDNS_RCODE_NOERROR);
|
||||
}
|
||||
/* NXDOMAIN rcode can stay if we prepended DNAME/CNAMEs, because
|
||||
* this is what recursors should give. */
|
||||
msg->rep->rrset_count += num_an + num_ns;
|
||||
msg->rep->an_numrrsets += num_an;
|
||||
msg->rep->ns_numrrsets += num_ns;
|
||||
@@ -454,8 +460,7 @@ handle_cname_response(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
* @param initial_state The initial response state (normally this
|
||||
* is QUERY_RESP_STATE, unless it is known that the request won't
|
||||
* need iterative processing
|
||||
* @param final_state The final state for the response to this
|
||||
* request.
|
||||
* @param finalstate The final state for the response to this request.
|
||||
* @param subq_ret: if newly allocated, the subquerystate, or NULL if it does
|
||||
* not need initialisation.
|
||||
* @param v: if true, validation is done on the subquery.
|
||||
@@ -465,13 +470,13 @@ static int
|
||||
generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
uint16_t qclass, struct module_qstate* qstate, int id,
|
||||
struct iter_qstate* iq, enum iter_state initial_state,
|
||||
enum iter_state final_state, struct module_qstate** subq_ret, int v)
|
||||
enum iter_state finalstate, struct module_qstate** subq_ret, int v)
|
||||
{
|
||||
struct module_qstate* subq = NULL;
|
||||
struct iter_qstate* subiq = NULL;
|
||||
uint16_t qflags = 0; /* OPCODE QUERY, no flags */
|
||||
struct query_info qinf;
|
||||
int prime = (final_state == PRIME_RESP_STATE)?1:0;
|
||||
int prime = (finalstate == PRIME_RESP_STATE)?1:0;
|
||||
qinf.qname = qname;
|
||||
qinf.qname_len = qnamelen;
|
||||
qinf.qtype = qtype;
|
||||
@@ -488,13 +493,6 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
if(!v)
|
||||
qflags |= BIT_CD;
|
||||
|
||||
fptr_ok(fptr_whitelist_modenv_detect_cycle(
|
||||
qstate->env->detect_cycle));
|
||||
if((*qstate->env->detect_cycle)(qstate, &qinf, qflags, prime)){
|
||||
log_query_info(VERB_DETAIL, "cycle detected", &qinf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* attach subquery, lookup existing or make a new one */
|
||||
fptr_ok(fptr_whitelist_modenv_attach_sub(qstate->env->attach_sub));
|
||||
if(!(*qstate->env->attach_sub)(qstate, &qinf, qflags, prime, &subq)) {
|
||||
@@ -521,7 +519,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
subiq->depth = iq->depth+1;
|
||||
outbound_list_init(&subiq->outlist);
|
||||
subiq->state = initial_state;
|
||||
subiq->final_state = final_state;
|
||||
subiq->final_state = finalstate;
|
||||
subiq->qchase = subq->qinfo;
|
||||
subiq->chase_flags = subq->query_flags;
|
||||
subiq->refetch_glue = 0;
|
||||
@@ -536,6 +534,7 @@ generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype,
|
||||
* @param ie: iterator global state.
|
||||
* @param id: module id.
|
||||
* @param qclass: the class to prime.
|
||||
* @return 0 on failure
|
||||
*/
|
||||
static int
|
||||
prime_root(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
@@ -595,6 +594,8 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
* @param q: request name.
|
||||
* @return true if a priming subrequest was made, false if not. The will only
|
||||
* issue a priming request if it detects an unprimed stub.
|
||||
* Uses value of 2 to signal during stub-prime in root-prime situation
|
||||
* that a noprime-stub is available and resolution can continue.
|
||||
*/
|
||||
static int
|
||||
prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
@@ -620,6 +621,8 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
|
||||
/* is it a noprime stub (always use) */
|
||||
if(stub->noprime) {
|
||||
int r = 0;
|
||||
if(iq->dp == NULL) r = 2;
|
||||
/* copy the dp out of the fixed hints structure, so that
|
||||
* it can be changed when servicing this query */
|
||||
iq->dp = delegpt_copy(stub_dp, qstate->region);
|
||||
@@ -630,7 +633,7 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
}
|
||||
log_nametypeclass(VERB_DETAIL, "use stub", stub_dp->name,
|
||||
LDNS_RR_TYPE_NS, q->qclass);
|
||||
return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Otherwise, we need to (re)prime the stub. */
|
||||
@@ -687,12 +690,15 @@ static void
|
||||
generate_a_aaaa_check(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
int id)
|
||||
{
|
||||
struct iter_env* ie = (struct iter_env*)qstate->env->modinfo[id];
|
||||
struct module_qstate* subq;
|
||||
size_t i;
|
||||
struct reply_info* rep = iq->response->rep;
|
||||
struct ub_packed_rrset_key* s;
|
||||
log_assert(iq->dp);
|
||||
|
||||
if(iq->depth == ie->max_dependency_depth)
|
||||
return;
|
||||
/* walk through additional, and check if in-zone,
|
||||
* only relevant A, AAAA are left after scrub anyway */
|
||||
for(i=rep->an_numrrsets+rep->ns_numrrsets; i<rep->rrset_count; i++) {
|
||||
@@ -738,9 +744,12 @@ generate_a_aaaa_check(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
static void
|
||||
generate_ns_check(struct module_qstate* qstate, struct iter_qstate* iq, int id)
|
||||
{
|
||||
struct iter_env* ie = (struct iter_env*)qstate->env->modinfo[id];
|
||||
struct module_qstate* subq;
|
||||
log_assert(iq->dp);
|
||||
|
||||
if(iq->depth == ie->max_dependency_depth)
|
||||
return;
|
||||
/* is this query the same as the nscheck? */
|
||||
if(qstate->qinfo.qtype == LDNS_RR_TYPE_NS &&
|
||||
query_dname_compare(iq->dp->name, qstate->qinfo.qname)==0 &&
|
||||
@@ -776,6 +785,56 @@ generate_ns_check(struct module_qstate* qstate, struct iter_qstate* iq, int id)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a DNSKEY prefetch query to get the DNSKEY for the DS record we
|
||||
* just got in a referral (where we have dnssec_expected, thus have trust
|
||||
* anchors above it). Note that right after calling this routine the
|
||||
* iterator detached subqueries (because of following the referral), and thus
|
||||
* the DNSKEY query becomes detached, its return stored in the cache for
|
||||
* later lookup by the validator. This cache lookup by the validator avoids
|
||||
* the roundtrip incurred by the DNSKEY query. The DNSKEY query is now
|
||||
* performed at about the same time the original query is sent to the domain,
|
||||
* thus the two answers are likely to be returned at about the same time,
|
||||
* saving a roundtrip from the validated lookup.
|
||||
*
|
||||
* @param qstate: the qtstate that triggered the need to prime.
|
||||
* @param iq: iterator query state.
|
||||
* @param id: module id.
|
||||
*/
|
||||
static void
|
||||
generate_dnskey_prefetch(struct module_qstate* qstate,
|
||||
struct iter_qstate* iq, int id)
|
||||
{
|
||||
struct module_qstate* subq;
|
||||
log_assert(iq->dp);
|
||||
|
||||
/* is this query the same as the prefetch? */
|
||||
if(qstate->qinfo.qtype == LDNS_RR_TYPE_DNSKEY &&
|
||||
query_dname_compare(iq->dp->name, qstate->qinfo.qname)==0 &&
|
||||
(qstate->query_flags&BIT_RD) && !(qstate->query_flags&BIT_CD)){
|
||||
return;
|
||||
}
|
||||
|
||||
/* if the DNSKEY is in the cache this lookup will stop quickly */
|
||||
log_nametypeclass(VERB_ALGO, "schedule dnskey prefetch",
|
||||
iq->dp->name, LDNS_RR_TYPE_DNSKEY, iq->qchase.qclass);
|
||||
if(!generate_sub_request(iq->dp->name, iq->dp->namelen,
|
||||
LDNS_RR_TYPE_DNSKEY, iq->qchase.qclass, qstate, id, iq,
|
||||
INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0)) {
|
||||
/* we'll be slower, but it'll work */
|
||||
verbose(VERB_ALGO, "could not generate dnskey prefetch");
|
||||
return;
|
||||
}
|
||||
if(subq) {
|
||||
struct iter_qstate* subiq =
|
||||
(struct iter_qstate*)subq->minfo[id];
|
||||
/* this qstate has the right delegation for the dnskey lookup*/
|
||||
/* make copy to avoid use of stub dp by different qs/threads */
|
||||
subiq->dp = delegpt_copy(iq->dp, subq->region);
|
||||
/* if !subiq->dp, it'll start from the cache, no problem */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* See if the query needs forwarding.
|
||||
*
|
||||
@@ -879,8 +938,13 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
msg = val_neg_getmsg(qstate->env->neg_cache, &iq->qchase,
|
||||
qstate->region, qstate->env->rrset_cache,
|
||||
qstate->env->scratch_buffer,
|
||||
*qstate->env->now, 1/*add SOA*/);
|
||||
*qstate->env->now, 1/*add SOA*/, NULL);
|
||||
}
|
||||
/* item taken from cache does not match our query name, thus
|
||||
* security needs to be re-examined later */
|
||||
if(msg && query_dname_compare(qstate->qinfo.qname,
|
||||
iq->qchase.qname) != 0)
|
||||
msg->rep->security = sec_status_unchecked;
|
||||
}
|
||||
if(msg) {
|
||||
/* handle positive cache response */
|
||||
@@ -889,7 +953,9 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
if(verbosity >= VERB_ALGO) {
|
||||
log_dns_msg("msg from cache lookup", &msg->qinfo,
|
||||
msg->rep);
|
||||
verbose(VERB_ALGO, "msg ttl is %d", (int)msg->rep->ttl);
|
||||
verbose(VERB_ALGO, "msg ttl is %d, prefetch ttl %d",
|
||||
(int)msg->rep->ttl,
|
||||
(int)msg->rep->prefetch_ttl);
|
||||
}
|
||||
|
||||
if(type == RESPONSE_TYPE_CNAME) {
|
||||
@@ -952,10 +1018,16 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
delname = iq->qchase.qname;
|
||||
delnamelen = iq->qchase.qname_len;
|
||||
}
|
||||
if(iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue) {
|
||||
if(iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue ||
|
||||
(iq->qchase.qtype == LDNS_RR_TYPE_NS && qstate->prefetch_leeway)) {
|
||||
/* remove first label from delname, root goes to hints,
|
||||
* but only to fetch glue, not for qtype=DS. */
|
||||
if(dname_is_root(delname) && iq->refetch_glue)
|
||||
/* also when prefetching an NS record, fetch it again from
|
||||
* its parent, just as if it expired, so that you do not
|
||||
* get stuck on an older nameserver that gives old NSrecords */
|
||||
if(dname_is_root(delname) && (iq->refetch_glue ||
|
||||
(iq->qchase.qtype == LDNS_RR_TYPE_NS &&
|
||||
qstate->prefetch_leeway)))
|
||||
delname = NULL; /* go to root priming */
|
||||
else dname_remove_label(&delname, &delnamelen);
|
||||
iq->refetch_glue = 0; /* if CNAME causes restart, no refetch */
|
||||
@@ -974,6 +1046,12 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
/* If the cache has returned nothing, then we have a
|
||||
* root priming situation. */
|
||||
if(iq->dp == NULL) {
|
||||
/* if there is a stub, then no root prime needed */
|
||||
int r = prime_stub(qstate, iq, ie, id, &iq->qchase);
|
||||
if(r == 2)
|
||||
break; /* got noprime-stub-zone, continue */
|
||||
else if(r)
|
||||
return 0; /* stub prime request made */
|
||||
if(forwards_lookup_root(qstate->env->fwds,
|
||||
iq->qchase.qclass)) {
|
||||
/* forward zone root, no root prime needed */
|
||||
@@ -1101,10 +1179,12 @@ processInitRequest2(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
*
|
||||
* @param qstate: query state.
|
||||
* @param iq: iterator query state.
|
||||
* @param id: module id.
|
||||
* @return true, advancing the event to the QUERYTARGETS_STATE.
|
||||
*/
|
||||
static int
|
||||
processInitRequest3(struct module_qstate* qstate, struct iter_qstate* iq)
|
||||
processInitRequest3(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
int id)
|
||||
{
|
||||
log_query_info(VERB_QUERY, "resolving (init part 3): ",
|
||||
&qstate->qinfo);
|
||||
@@ -1124,15 +1204,75 @@ processInitRequest3(struct module_qstate* qstate, struct iter_qstate* iq)
|
||||
sock_list_insert(&qstate->reply_origin, NULL, 0, qstate->region);
|
||||
return final_state(iq);
|
||||
}
|
||||
|
||||
/* After this point, unset the RD flag -- this query is going to
|
||||
* be sent to an auth. server. */
|
||||
iq->chase_flags &= ~BIT_RD;
|
||||
|
||||
/* if dnssec expected, fetch key for the trust-anchor or cached-DS */
|
||||
if(iq->dnssec_expected && qstate->env->cfg->prefetch_key &&
|
||||
!(qstate->query_flags&BIT_CD)) {
|
||||
generate_dnskey_prefetch(qstate, iq, id);
|
||||
fptr_ok(fptr_whitelist_modenv_detach_subs(
|
||||
qstate->env->detach_subs));
|
||||
(*qstate->env->detach_subs)(qstate);
|
||||
}
|
||||
|
||||
/* Jump to the next state. */
|
||||
return next_state(iq, QUERYTARGETS_STATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a basic query, generate a parent-side "target" query.
|
||||
* These are subordinate queries for missing delegation point target addresses,
|
||||
* for which only the parent of the delegation provides correct IP addresses.
|
||||
*
|
||||
* @param qstate: query state.
|
||||
* @param iq: iterator query state.
|
||||
* @param id: module id.
|
||||
* @param name: target qname.
|
||||
* @param namelen: target qname length.
|
||||
* @param qtype: target qtype (either A or AAAA).
|
||||
* @param qclass: target qclass.
|
||||
* @return true on success, false on failure.
|
||||
*/
|
||||
static int
|
||||
generate_parentside_target_query(struct module_qstate* qstate,
|
||||
struct iter_qstate* iq, int id, uint8_t* name, size_t namelen,
|
||||
uint16_t qtype, uint16_t qclass)
|
||||
{
|
||||
struct module_qstate* subq;
|
||||
if(!generate_sub_request(name, namelen, qtype, qclass, qstate,
|
||||
id, iq, INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0))
|
||||
return 0;
|
||||
if(subq) {
|
||||
struct iter_qstate* subiq =
|
||||
(struct iter_qstate*)subq->minfo[id];
|
||||
/* blacklist the cache - we want to fetch parent stuff */
|
||||
sock_list_insert(&subq->blacklist, NULL, 0, subq->region);
|
||||
subiq->query_for_pside_glue = 1;
|
||||
if(dname_subdomain_c(name, iq->dp->name)) {
|
||||
subiq->dp = delegpt_copy(iq->dp, subq->region);
|
||||
subiq->dnssec_expected = iter_indicates_dnssec(
|
||||
qstate->env, subiq->dp, NULL,
|
||||
subq->qinfo.qclass);
|
||||
subiq->refetch_glue = 1;
|
||||
} else {
|
||||
subiq->dp = dns_cache_find_delegation(qstate->env,
|
||||
name, namelen, qtype, qclass, subq->region,
|
||||
&subiq->deleg_msg, *qstate->env->now);
|
||||
/* if no dp, then it's from root, refetch unneeded */
|
||||
if(subiq->dp) {
|
||||
subiq->dnssec_expected = iter_indicates_dnssec(
|
||||
qstate->env, subiq->dp, NULL,
|
||||
subq->qinfo.qclass);
|
||||
subiq->refetch_glue = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
log_nametypeclass(VERB_QUERY, "new pside target", name, qtype, qclass);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a basic query, generate a "target" query. These are subordinate
|
||||
* queries for missing delegation point target addresses.
|
||||
@@ -1154,18 +1294,6 @@ generate_target_query(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
if(!generate_sub_request(name, namelen, qtype, qclass, qstate,
|
||||
id, iq, INIT_REQUEST_STATE, FINISHED_STATE, &subq, 0))
|
||||
return 0;
|
||||
if(subq) {
|
||||
struct iter_qstate* subiq =
|
||||
(struct iter_qstate*)subq->minfo[id];
|
||||
if(dname_subdomain_c(name, iq->dp->name)) {
|
||||
verbose(VERB_ALGO, "refetch of target glue");
|
||||
subiq->refetch_glue = 1;
|
||||
subiq->dp = delegpt_copy(iq->dp, subq->region);
|
||||
subiq->dnssec_expected = iter_indicates_dnssec(
|
||||
qstate->env, subiq->dp, NULL,
|
||||
subq->qinfo.qclass);
|
||||
}
|
||||
}
|
||||
log_nametypeclass(VERB_QUERY, "new target", name, qtype, qclass);
|
||||
return 1;
|
||||
}
|
||||
@@ -1189,10 +1317,13 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
struct iter_env* ie, int id, int maxtargets, int* num)
|
||||
{
|
||||
int query_count = 0;
|
||||
struct delegpt_ns* ns = iq->dp->nslist;
|
||||
struct delegpt_ns* ns;
|
||||
int missing;
|
||||
int toget = 0;
|
||||
|
||||
if(iq->depth == ie->max_dependency_depth)
|
||||
return 0;
|
||||
|
||||
iter_mark_cycle_targets(qstate, iq->dp);
|
||||
missing = (int)delegpt_count_missing_targets(iq->dp);
|
||||
log_assert(maxtargets != 0); /* that would not be useful */
|
||||
@@ -1227,16 +1358,24 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
/* Send the AAAA request. */
|
||||
if(!generate_target_query(qstate, iq, id,
|
||||
ns->name, ns->namelen,
|
||||
LDNS_RR_TYPE_AAAA, iq->qchase.qclass))
|
||||
LDNS_RR_TYPE_AAAA, iq->qchase.qclass)) {
|
||||
*num = query_count;
|
||||
if(query_count > 0)
|
||||
qstate->ext_state[id] = module_wait_subquery;
|
||||
return 0;
|
||||
}
|
||||
query_count++;
|
||||
}
|
||||
/* Send the A request. */
|
||||
if(!ns->got4) {
|
||||
if(ie->supports_ipv4 && !ns->got4) {
|
||||
if(!generate_target_query(qstate, iq, id,
|
||||
ns->name, ns->namelen,
|
||||
LDNS_RR_TYPE_A, iq->qchase.qclass))
|
||||
LDNS_RR_TYPE_A, iq->qchase.qclass)) {
|
||||
*num = query_count;
|
||||
if(query_count > 0)
|
||||
qstate->ext_state[id] = module_wait_subquery;
|
||||
return 0;
|
||||
}
|
||||
query_count++;
|
||||
}
|
||||
|
||||
@@ -1254,6 +1393,120 @@ query_for_targets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by processQueryTargets when it would like extra targets to query
|
||||
* but it seems to be out of options. At last resort some less appealing
|
||||
* options are explored. If there are no more options, the result is SERVFAIL
|
||||
*
|
||||
* @param qstate: query state.
|
||||
* @param iq: iterator query state.
|
||||
* @param ie: iterator shared global environment.
|
||||
* @param id: module id.
|
||||
* @return true if the event requires more request processing immediately,
|
||||
* false if not.
|
||||
*/
|
||||
static int
|
||||
processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
struct iter_env* ie, int id)
|
||||
{
|
||||
struct delegpt_ns* ns;
|
||||
int query_count = 0;
|
||||
verbose(VERB_ALGO, "No more query targets, attempting last resort");
|
||||
log_assert(iq->dp);
|
||||
|
||||
if(!iq->dp->has_parent_side_NS) {
|
||||
if(!iter_lookup_parent_NS_from_cache(qstate->env, iq->dp,
|
||||
qstate->region, &qstate->qinfo)
|
||||
|| !iq->dp->has_parent_side_NS) {
|
||||
/* if: malloc failure in lookup go up to try */
|
||||
/* if: no parent NS in cache - go up one level */
|
||||
verbose(VERB_ALGO, "try to grab parent NS");
|
||||
iq->store_parent_NS = iq->dp;
|
||||
iq->deleg_msg = NULL;
|
||||
iq->refetch_glue = 1;
|
||||
iq->query_restart_count++;
|
||||
return next_state(iq, INIT_REQUEST_STATE);
|
||||
}
|
||||
}
|
||||
/* see if that makes new names available */
|
||||
if(!cache_fill_missing(qstate->env, iq->qchase.qclass,
|
||||
qstate->region, iq->dp))
|
||||
log_err("out of memory in cache_fill_missing");
|
||||
if(iq->dp->usable_list) {
|
||||
verbose(VERB_ALGO, "try parent-side-name, w. glue from cache");
|
||||
return next_state(iq, QUERYTARGETS_STATE);
|
||||
}
|
||||
/* try to fill out parent glue from cache */
|
||||
if(iter_lookup_parent_glue_from_cache(qstate->env, iq->dp,
|
||||
qstate->region, &qstate->qinfo)) {
|
||||
/* got parent stuff from cache, see if we can continue */
|
||||
verbose(VERB_ALGO, "try parent-side glue from cache");
|
||||
return next_state(iq, QUERYTARGETS_STATE);
|
||||
}
|
||||
/* query for an extra name added by the parent-NS record */
|
||||
if(delegpt_count_missing_targets(iq->dp) > 0) {
|
||||
int qs = 0;
|
||||
verbose(VERB_ALGO, "try parent-side target name");
|
||||
if(!query_for_targets(qstate, iq, ie, id, 1, &qs)) {
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
iq->num_target_queries += qs;
|
||||
if(qs != 0) {
|
||||
qstate->ext_state[id] = module_wait_subquery;
|
||||
return 0; /* and wait for them */
|
||||
}
|
||||
}
|
||||
if(iq->depth == ie->max_dependency_depth) {
|
||||
verbose(VERB_QUERY, "maxdepth and need more nameservers, fail");
|
||||
return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
/* mark cycle targets for parent-side lookups */
|
||||
iter_mark_pside_cycle_targets(qstate, iq->dp);
|
||||
/* see if we can issue queries to get nameserver addresses */
|
||||
/* this lookup is not randomized, but sequential. */
|
||||
for(ns = iq->dp->nslist; ns; ns = ns->next) {
|
||||
/* query for parent-side A and AAAA for nameservers */
|
||||
if(ie->supports_ipv6 && !ns->done_pside6) {
|
||||
/* Send the AAAA request. */
|
||||
if(!generate_parentside_target_query(qstate, iq, id,
|
||||
ns->name, ns->namelen,
|
||||
LDNS_RR_TYPE_AAAA, iq->qchase.qclass))
|
||||
return error_response(qstate, id,
|
||||
LDNS_RCODE_SERVFAIL);
|
||||
ns->done_pside6 = 1;
|
||||
query_count++;
|
||||
}
|
||||
if(ie->supports_ipv4 && !ns->done_pside4) {
|
||||
/* Send the A request. */
|
||||
if(!generate_parentside_target_query(qstate, iq, id,
|
||||
ns->name, ns->namelen,
|
||||
LDNS_RR_TYPE_A, iq->qchase.qclass))
|
||||
return error_response(qstate, id,
|
||||
LDNS_RCODE_SERVFAIL);
|
||||
ns->done_pside4 = 1;
|
||||
query_count++;
|
||||
}
|
||||
if(query_count != 0) { /* suspend to await results */
|
||||
verbose(VERB_ALGO, "try parent-side glue lookup");
|
||||
iq->num_target_queries += query_count;
|
||||
qstate->ext_state[id] = module_wait_subquery;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* if this was a parent-side glue query itself, then store that
|
||||
* failure in cache. */
|
||||
if(iq->query_for_pside_glue && !iq->pside_glue)
|
||||
iter_store_parentside_neg(qstate->env, &qstate->qinfo,
|
||||
iq->deleg_msg?iq->deleg_msg->rep:
|
||||
(iq->response?iq->response->rep:NULL));
|
||||
|
||||
verbose(VERB_QUERY, "out of query targets -- returning SERVFAIL");
|
||||
/* fail -- no more targets, no more hope of targets, no hope
|
||||
* of a response. */
|
||||
return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the request event state where the request will be sent to one of
|
||||
* its current query targets. This state also handles issuing target lookup
|
||||
@@ -1286,7 +1539,6 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
verbose(VERB_ALGO, "processQueryTargets: targetqueries %d, "
|
||||
"currentqueries %d", iq->num_target_queries,
|
||||
iq->num_current_queries);
|
||||
qstate->ext_state[id] = module_wait_reply;
|
||||
|
||||
/* Make sure that we haven't run away */
|
||||
/* FIXME: is this check even necessary? */
|
||||
@@ -1302,6 +1554,10 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
verbose(VERB_QUERY, "Failed to get a delegation, giving up");
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
if(!ie->supports_ipv6)
|
||||
delegpt_no_ipv6(iq->dp);
|
||||
if(!ie->supports_ipv4)
|
||||
delegpt_no_ipv4(iq->dp);
|
||||
delegpt_log(VERB_ALGO, iq->dp);
|
||||
|
||||
if(iq->num_current_queries>0) {
|
||||
@@ -1309,6 +1565,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
* more delegpt addrs became available, wait for existing
|
||||
* query. */
|
||||
verbose(VERB_ALGO, "woke up, but wait for outstanding query");
|
||||
qstate->ext_state[id] = module_wait_reply;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1331,6 +1588,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
if(iq->num_target_queries > 0) {
|
||||
/* wait to get all targets, we want to try em */
|
||||
verbose(VERB_ALGO, "wait for all targets for fallback");
|
||||
qstate->ext_state[id] = module_wait_reply;
|
||||
return 0;
|
||||
}
|
||||
/* did we do enough fallback queries already? */
|
||||
@@ -1344,6 +1602,9 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
"match for %d wanted, done.",
|
||||
(int)iq->caps_server+1, (int)naddr*3);
|
||||
iq->caps_fallback = 0;
|
||||
iter_dec_attempts(iq->dp, 3); /* space for fallback */
|
||||
iq->num_current_queries++; /* RespState decrements it*/
|
||||
iq->referral_count++; /* make sure we don't loop */
|
||||
iq->state = QUERY_RESP_STATE;
|
||||
return 1;
|
||||
}
|
||||
@@ -1370,8 +1631,8 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
/* Select the next usable target, filtering out unsuitable targets. */
|
||||
target = iter_server_selection(ie, qstate->env, iq->dp,
|
||||
iq->dp->name, iq->dp->namelen, iq->qchase.qtype,
|
||||
&iq->dnssec_expected, &iq->chase_to_rd, iq->num_target_queries,
|
||||
qstate->blacklist);
|
||||
&iq->dnssec_lame_query, &iq->chase_to_rd,
|
||||
iq->num_target_queries, qstate->blacklist);
|
||||
|
||||
/* If no usable target was selected... */
|
||||
if(!target) {
|
||||
@@ -1397,59 +1658,61 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
return error_response(qstate, id,
|
||||
LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
if(qs == 0 &&
|
||||
delegpt_count_missing_targets(iq->dp) == 0){
|
||||
/* it looked like there were missing
|
||||
* targets, but they did not turn up.
|
||||
* Try the bad choices again (if any),
|
||||
* when we get back here missing==0,
|
||||
* so this is not a loop. */
|
||||
return 1;
|
||||
}
|
||||
iq->num_target_queries += qs;
|
||||
}
|
||||
/* Since a target query might have been made, we
|
||||
* need to check again. */
|
||||
if(iq->num_target_queries == 0) {
|
||||
/* is it glue and we suspect that it exists?*/
|
||||
if(iter_suspect_exists(&iq->qchase, iq->dp,
|
||||
qstate->env)) {
|
||||
/* try at parent */
|
||||
iq->deleg_msg = NULL;
|
||||
iq->refetch_glue = 1;
|
||||
iq->query_restart_count++;
|
||||
return next_state(iq,
|
||||
INIT_REQUEST_STATE);
|
||||
}
|
||||
|
||||
verbose(VERB_QUERY, "out of query targets -- "
|
||||
"returning SERVFAIL");
|
||||
/* fail -- no more targets, no more hope
|
||||
* of targets, no hope of a response. */
|
||||
return error_response_cache(qstate, id,
|
||||
LDNS_RCODE_SERVFAIL);
|
||||
return processLastResort(qstate, iq, ie, id);
|
||||
}
|
||||
}
|
||||
|
||||
/* otherwise, we have no current targets, so submerge
|
||||
* until one of the target or direct queries return. */
|
||||
if(iq->num_target_queries>0 && iq->num_current_queries>0)
|
||||
if(iq->num_target_queries>0 && iq->num_current_queries>0) {
|
||||
verbose(VERB_ALGO, "no current targets -- waiting "
|
||||
"for %d targets to resolve or %d outstanding"
|
||||
" queries to respond", iq->num_target_queries,
|
||||
iq->num_current_queries);
|
||||
else if(iq->num_target_queries>0)
|
||||
qstate->ext_state[id] = module_wait_reply;
|
||||
} else if(iq->num_target_queries>0) {
|
||||
verbose(VERB_ALGO, "no current targets -- waiting "
|
||||
"for %d targets to resolve.",
|
||||
iq->num_target_queries);
|
||||
else verbose(VERB_ALGO, "no current targets -- waiting "
|
||||
qstate->ext_state[id] = module_wait_subquery;
|
||||
} else {
|
||||
verbose(VERB_ALGO, "no current targets -- waiting "
|
||||
"for %d outstanding queries to respond.",
|
||||
iq->num_current_queries);
|
||||
qstate->ext_state[id] = module_wait_reply;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We have a valid target. */
|
||||
if(iq->dnssec_expected) verbose(VERB_ALGO, "dnssec is expected");
|
||||
log_query_info(VERB_QUERY, "sending query:", &iq->qchase);
|
||||
log_name_addr(VERB_QUERY, "sending to target:", iq->dp->name,
|
||||
&target->addr, target->addrlen);
|
||||
if(verbosity >= VERB_QUERY) {
|
||||
log_query_info(VERB_QUERY, "sending query:", &iq->qchase);
|
||||
log_name_addr(VERB_QUERY, "sending to target:", iq->dp->name,
|
||||
&target->addr, target->addrlen);
|
||||
verbose(VERB_ALGO, "dnssec status: %s%s",
|
||||
iq->dnssec_expected?"expected": "not expected",
|
||||
iq->dnssec_lame_query?" but lame_query anyway": "");
|
||||
}
|
||||
fptr_ok(fptr_whitelist_modenv_send_query(qstate->env->send_query));
|
||||
outq = (*qstate->env->send_query)(
|
||||
iq->qchase.qname, iq->qchase.qname_len,
|
||||
iq->qchase.qtype, iq->qchase.qclass,
|
||||
iq->chase_flags | (iq->chase_to_rd?BIT_RD:0), EDNS_DO|BIT_CD,
|
||||
&target->addr, target->addrlen, qstate);
|
||||
iq->dnssec_expected, &target->addr, target->addrlen, qstate);
|
||||
if(!outq) {
|
||||
log_addr(VERB_DETAIL, "error sending query to auth server",
|
||||
&target->addr, target->addrlen);
|
||||
@@ -1497,6 +1760,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
iq->num_current_queries--;
|
||||
if(iq->response == NULL) {
|
||||
iq->chase_to_rd = 0;
|
||||
iq->dnssec_lame_query = 0;
|
||||
verbose(VERB_ALGO, "query response was timeout");
|
||||
return next_state(iq, QUERYTARGETS_STATE);
|
||||
}
|
||||
@@ -1509,7 +1773,8 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
* differently. No queries should be sent elsewhere */
|
||||
type = RESPONSE_TYPE_ANSWER;
|
||||
}
|
||||
if(iq->dnssec_expected && !(iq->chase_flags&BIT_RD)
|
||||
if(iq->dnssec_expected && !iq->dnssec_lame_query &&
|
||||
!(iq->chase_flags&BIT_RD)
|
||||
&& type != RESPONSE_TYPE_LAME
|
||||
&& type != RESPONSE_TYPE_REC_LAME
|
||||
&& type != RESPONSE_TYPE_THROWAWAY
|
||||
@@ -1525,7 +1790,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
type = RESPONSE_TYPE_LAME;
|
||||
dnsseclame = 1;
|
||||
}
|
||||
}
|
||||
} else iq->dnssec_lame_query = 0;
|
||||
/* see if referral brings us close to the target */
|
||||
if(type == RESPONSE_TYPE_REFERRAL) {
|
||||
struct ub_packed_rrset_key* ns = find_NS(
|
||||
@@ -1538,16 +1803,23 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
|| !dname_subdomain_c(iq->qchase.qname, ns->rk.dname)){
|
||||
verbose(VERB_ALGO, "bad referral, throwaway");
|
||||
type = RESPONSE_TYPE_THROWAWAY;
|
||||
}
|
||||
}
|
||||
} else
|
||||
iter_scrub_ds(iq->response, ns, iq->dp->name);
|
||||
} else iter_scrub_ds(iq->response, NULL, NULL);
|
||||
|
||||
/* handle each of the type cases */
|
||||
if(type == RESPONSE_TYPE_ANSWER) {
|
||||
/* ANSWER type responses terminate the query algorithm,
|
||||
* so they sent on their */
|
||||
verbose(VERB_DETAIL, "query response was ANSWER");
|
||||
if(verbosity >= VERB_DETAIL) {
|
||||
verbose(VERB_DETAIL, "query response was %s",
|
||||
FLAGS_GET_RCODE(iq->response->rep->flags)
|
||||
==LDNS_RCODE_NXDOMAIN?"NXDOMAIN ANSWER":
|
||||
(iq->response->rep->an_numrrsets?"ANSWER":
|
||||
"nodata ANSWER"));
|
||||
}
|
||||
if(!iter_dns_store(qstate->env, &iq->response->qinfo,
|
||||
iq->response->rep, 0))
|
||||
iq->response->rep, 0, qstate->prefetch_leeway))
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
/* close down outstanding requests to be discarded */
|
||||
outbound_list_clear(&iq->outlist);
|
||||
@@ -1576,27 +1848,37 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
* see if that equals the query name... */
|
||||
&& ( /* auth section, but sometimes in answer section*/
|
||||
reply_find_rrset_section_ns(iq->response->rep,
|
||||
qstate->qinfo.qname, qstate->qinfo.qname_len,
|
||||
LDNS_RR_TYPE_NS, qstate->qinfo.qclass)
|
||||
iq->qchase.qname, iq->qchase.qname_len,
|
||||
LDNS_RR_TYPE_NS, iq->qchase.qclass)
|
||||
|| reply_find_rrset_section_an(iq->response->rep,
|
||||
qstate->qinfo.qname, qstate->qinfo.qname_len,
|
||||
LDNS_RR_TYPE_NS, qstate->qinfo.qclass)
|
||||
iq->qchase.qname, iq->qchase.qname_len,
|
||||
LDNS_RR_TYPE_NS, iq->qchase.qclass)
|
||||
)
|
||||
)) {
|
||||
/* Store the referral under the current query */
|
||||
/* no prefetch-leeway, since its not the answer */
|
||||
if(!iter_dns_store(qstate->env, &iq->response->qinfo,
|
||||
iq->response->rep, 1))
|
||||
iq->response->rep, 1, 0))
|
||||
return error_response(qstate, id,
|
||||
LDNS_RCODE_SERVFAIL);
|
||||
if(iq->store_parent_NS)
|
||||
iter_store_parentside_NS(qstate->env,
|
||||
iq->response->rep);
|
||||
if(qstate->env->neg_cache)
|
||||
val_neg_addreferral(qstate->env->neg_cache,
|
||||
iq->response->rep, iq->dp->name);
|
||||
}
|
||||
/* store parent-side-in-zone-glue, if directly queried for */
|
||||
if((qstate->qinfo.qtype == LDNS_RR_TYPE_A
|
||||
|| qstate->qinfo.qtype == LDNS_RR_TYPE_AAAA)) {
|
||||
iter_store_inzone_glue(qstate->env,
|
||||
&iq->response->qinfo, iq->response->rep);
|
||||
if(iq->query_for_pside_glue && !iq->pside_glue) {
|
||||
iq->pside_glue = reply_find_rrset(iq->response->rep,
|
||||
iq->qchase.qname, iq->qchase.qname_len,
|
||||
iq->qchase.qtype, iq->qchase.qclass);
|
||||
if(iq->pside_glue) {
|
||||
log_rrset_key(VERB_ALGO, "found parent-side "
|
||||
"glue", iq->pside_glue);
|
||||
iter_store_parentside_rrset(qstate->env,
|
||||
iq->pside_glue);
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset the event state, setting the current delegation
|
||||
@@ -1608,6 +1890,9 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
if(!cache_fill_missing(qstate->env, iq->qchase.qclass,
|
||||
qstate->region, iq->dp))
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
if(iq->store_parent_NS && query_dname_compare(iq->dp->name,
|
||||
iq->store_parent_NS->name) == 0)
|
||||
iter_merge_retry_counts(iq->dp, iq->store_parent_NS);
|
||||
delegpt_log(VERB_ALGO, iq->dp);
|
||||
/* Count this as a referral. */
|
||||
iq->referral_count++;
|
||||
@@ -1615,6 +1900,10 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
* along, indicating dnssec is expected for next zone */
|
||||
iq->dnssec_expected = iter_indicates_dnssec(qstate->env,
|
||||
iq->dp, iq->response, iq->qchase.qclass);
|
||||
/* if dnssec, validating then also fetch the key for the DS */
|
||||
if(iq->dnssec_expected && qstate->env->cfg->prefetch_key &&
|
||||
!(qstate->query_flags&BIT_CD))
|
||||
generate_dnskey_prefetch(qstate, iq, id);
|
||||
|
||||
/* spawn off NS and addr to auth servers for the NS we just
|
||||
* got in the referral. This gets authoritative answer
|
||||
@@ -1652,8 +1941,9 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
/* cache the CNAME response under the current query */
|
||||
/* NOTE : set referral=1, so that rrsets get stored but not
|
||||
* the partial query answer (CNAME only). */
|
||||
/* prefetchleeway applied because this updates answer parts */
|
||||
if(!iter_dns_store(qstate->env, &iq->response->qinfo,
|
||||
iq->response->rep, 1))
|
||||
iq->response->rep, 1, qstate->prefetch_leeway))
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
/* set the current request's qname to the new value. */
|
||||
iq->qchase.qname = sname;
|
||||
@@ -1661,7 +1951,6 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
/* Clear the query state, since this is a query restart. */
|
||||
iq->deleg_msg = NULL;
|
||||
iq->dp = NULL;
|
||||
iq->dnssec_expected = 0;
|
||||
/* Note the query restart. */
|
||||
iq->query_restart_count++;
|
||||
|
||||
@@ -1800,8 +2089,11 @@ static int
|
||||
processPrimeResponse(struct module_qstate* qstate, int id)
|
||||
{
|
||||
struct iter_qstate* iq = (struct iter_qstate*)qstate->minfo[id];
|
||||
enum response_type type = response_type_from_server(0, iq->response,
|
||||
&iq->qchase, iq->dp);
|
||||
enum response_type type;
|
||||
iq->response->rep->flags &= ~(BIT_RD|BIT_RA); /* ignore rec-lame */
|
||||
type = response_type_from_server(
|
||||
(int)((iq->chase_flags&BIT_RD) || iq->chase_to_rd),
|
||||
iq->response, &iq->qchase, iq->dp);
|
||||
if(type == RESPONSE_TYPE_ANSWER) {
|
||||
qstate->return_rcode = LDNS_RCODE_NOERROR;
|
||||
qstate->return_msg = iq->response;
|
||||
@@ -1879,10 +2171,17 @@ processTargetResponse(struct module_qstate* qstate, int id,
|
||||
* (regardless if it succeeded or not). */
|
||||
foriq->num_target_queries--;
|
||||
|
||||
/* perhaps we picked up interested cached addressed, like lame ones */
|
||||
if(!iter_lookup_inzone_glue(forq->env, foriq->dp, forq->region,
|
||||
&iq->qchase))
|
||||
log_err("out of memory adding lame glue");
|
||||
/* if iq->query_for_pside_glue then add the pside_glue (marked lame) */
|
||||
if(iq->pside_glue) {
|
||||
/* if the pside_glue is NULL, then it could not be found,
|
||||
* the done_pside is already set when created and a cache
|
||||
* entry created in processFinished so nothing to do here */
|
||||
log_rrset_key(VERB_ALGO, "add parentside glue to dp",
|
||||
iq->pside_glue);
|
||||
if(!delegpt_add_rrset(foriq->dp, forq->region,
|
||||
iq->pside_glue, 1))
|
||||
log_err("out of memory adding pside glue");
|
||||
}
|
||||
|
||||
/* This response is relevant to the current query, so we
|
||||
* add (attempt to add, anyway) this target(s) and reactivate
|
||||
@@ -1895,11 +2194,14 @@ processTargetResponse(struct module_qstate* qstate, int id,
|
||||
/* BTW. RFC 1918 says NS should not have got CNAMEs. Robust. */
|
||||
if(!delegpt_find_ns(foriq->dp, rrset->rk.dname,
|
||||
rrset->rk.dname_len)) {
|
||||
/* if dpns->lame then set newcname ns lame too */
|
||||
if(!delegpt_add_ns(foriq->dp, forq->region,
|
||||
rrset->rk.dname))
|
||||
rrset->rk.dname, (int)dpns->lame))
|
||||
log_err("out of memory adding cnamed-ns");
|
||||
}
|
||||
if(!delegpt_add_rrset(foriq->dp, forq->region, rrset))
|
||||
/* if dpns->lame then set the address(es) lame too */
|
||||
if(!delegpt_add_rrset(foriq->dp, forq->region, rrset,
|
||||
(int)dpns->lame))
|
||||
log_err("out of memory adding targets");
|
||||
verbose(VERB_ALGO, "added target response");
|
||||
delegpt_log(VERB_ALGO, foriq->dp);
|
||||
@@ -1996,6 +2298,8 @@ processClassResponse(struct module_qstate* qstate, int id,
|
||||
to->rep->qdcount = from->rep->qdcount;
|
||||
if(from->rep->ttl < to->rep->ttl) /* use smallest TTL */
|
||||
to->rep->ttl = from->rep->ttl;
|
||||
if(from->rep->prefetch_ttl < to->rep->prefetch_ttl)
|
||||
to->rep->prefetch_ttl = from->rep->prefetch_ttl;
|
||||
}
|
||||
/* are we done? */
|
||||
foriq->num_current_queries --;
|
||||
@@ -2072,6 +2376,11 @@ processFinished(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
log_query_info(VERB_QUERY, "finishing processing for",
|
||||
&qstate->qinfo);
|
||||
|
||||
/* store negative cache element for parent side glue. */
|
||||
if(iq->query_for_pside_glue && !iq->pside_glue)
|
||||
iter_store_parentside_neg(qstate->env, &qstate->qinfo,
|
||||
iq->deleg_msg?iq->deleg_msg->rep:
|
||||
(iq->response?iq->response->rep:NULL));
|
||||
if(!iq->response) {
|
||||
verbose(VERB_ALGO, "No response is set, servfail");
|
||||
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
|
||||
@@ -2102,12 +2411,14 @@ processFinished(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
}
|
||||
/* reset the query name back */
|
||||
iq->response->qinfo = qstate->qinfo;
|
||||
/* the security state depends on the combination */
|
||||
iq->response->rep->security = sec_status_unchecked;
|
||||
/* store message with the finished prepended items,
|
||||
* but only if we did recursion. The nonrecursion referral
|
||||
* from cache does not need to be stored in the msg cache. */
|
||||
if(qstate->query_flags&BIT_RD) {
|
||||
if(!iter_dns_store(qstate->env, &qstate->qinfo,
|
||||
iq->response->rep, 0))
|
||||
iq->response->rep, 0, qstate->prefetch_leeway))
|
||||
return error_response(qstate, id,
|
||||
LDNS_RCODE_SERVFAIL);
|
||||
}
|
||||
@@ -2131,7 +2442,7 @@ void
|
||||
iter_inform_super(struct module_qstate* qstate, int id,
|
||||
struct module_qstate* super)
|
||||
{
|
||||
if(super->qinfo.qclass == LDNS_RR_CLASS_ANY)
|
||||
if(!qstate->is_priming && super->qinfo.qclass == LDNS_RR_CLASS_ANY)
|
||||
processClassResponse(qstate, id, super);
|
||||
else if(qstate->return_rcode != LDNS_RCODE_NOERROR)
|
||||
error_supers(qstate, id, super);
|
||||
@@ -2168,7 +2479,7 @@ iter_handle(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
cont = processInitRequest2(qstate, iq, ie, id);
|
||||
break;
|
||||
case INIT_REQUEST_3_STATE:
|
||||
cont = processInitRequest3(qstate, iq);
|
||||
cont = processInitRequest3(qstate, iq, id);
|
||||
break;
|
||||
case QUERYTARGETS_STATE:
|
||||
cont = processQueryTargets(qstate, iq, ie, id);
|
||||
@@ -2288,7 +2599,8 @@ process_response(struct module_qstate* qstate, struct iter_qstate* iq,
|
||||
goto handle_it;
|
||||
} else {
|
||||
/* check if reply is the same, otherwise, fail */
|
||||
if(!reply_equal(iq->response->rep, iq->caps_reply)) {
|
||||
if(!reply_equal(iq->response->rep, iq->caps_reply,
|
||||
qstate->env->scratch_buffer)) {
|
||||
verbose(VERB_DETAIL, "Capsforid fallback: "
|
||||
"getting different replies, failed");
|
||||
outbound_list_remove(&iq->outlist, outbound);
|
||||
@@ -2376,7 +2688,8 @@ iter_get_mem(struct module_env* env, int id)
|
||||
if(!ie)
|
||||
return 0;
|
||||
return sizeof(*ie) + sizeof(int)*((size_t)ie->max_dependency_depth+1)
|
||||
+ hints_get_mem(ie->hints) + donotq_get_mem(ie->donotq);
|
||||
+ hints_get_mem(ie->hints) + donotq_get_mem(ie->donotq)
|
||||
+ priv_get_mem(ie->priv);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2389,7 +2702,7 @@ static struct module_func_block iter_block = {
|
||||
};
|
||||
|
||||
struct module_func_block*
|
||||
iter_get_funcblock()
|
||||
iter_get_funcblock(void)
|
||||
{
|
||||
return &iter_block;
|
||||
}
|
||||
|
||||
+33
-2
@@ -55,7 +55,7 @@ struct iter_priv;
|
||||
/** max number of query restarts. Determines max number of CNAME chain. */
|
||||
#define MAX_RESTART_COUNT 8
|
||||
/** max number of referrals. Makes sure resolver does not run away */
|
||||
#define MAX_REFERRAL_COUNT 30
|
||||
#define MAX_REFERRAL_COUNT 130
|
||||
/** how nice is a server without further information, in msec
|
||||
* Equals rtt initial timeout value.
|
||||
*/
|
||||
@@ -75,6 +75,8 @@ struct iter_priv;
|
||||
* Chosen so that the UNKNOWN_SERVER_NICENESS falls within the band of a
|
||||
* fast server, this causes server exploration as a side benefit. msec. */
|
||||
#define RTT_BAND 400
|
||||
/** Start value for blacklisting a host, 2*USEFUL_SERVER_TOP_TIMEOUT in sec */
|
||||
#define INFRA_BACKOFF_INITIAL 240
|
||||
|
||||
/**
|
||||
* Global state for the iterator.
|
||||
@@ -91,6 +93,9 @@ struct iter_env {
|
||||
/** A flag to indicate whether or not we have an IPv6 route */
|
||||
int supports_ipv6;
|
||||
|
||||
/** A flag to indicate whether or not we have an IPv4 route */
|
||||
int supports_ipv4;
|
||||
|
||||
/** A set of inetaddrs that should never be queried. */
|
||||
struct iter_donotq* donotq;
|
||||
|
||||
@@ -247,6 +252,26 @@ struct iter_qstate {
|
||||
/** the number of times this query as followed a referral. */
|
||||
int referral_count;
|
||||
|
||||
/**
|
||||
* The query must store NS records from referrals as parentside RRs
|
||||
* Enabled once it hits resolution problems, to throttle retries.
|
||||
* If enabled it is the pointer to the old delegation point with
|
||||
* the old retry counts for bad-nameserver-addresses.
|
||||
*/
|
||||
struct delegpt* store_parent_NS;
|
||||
|
||||
/**
|
||||
* The query is for parent-side glue(A or AAAA) for a nameserver.
|
||||
* If the item is seen as glue in a referral, and pside_glue is NULL,
|
||||
* then it is stored in pside_glue for later.
|
||||
* If it was never seen, at the end, then a negative caching element
|
||||
* must be created.
|
||||
* The (data or negative) RR cache element then throttles retries.
|
||||
*/
|
||||
int query_for_pside_glue;
|
||||
/** the parent-side-glue element (NULL if none, its first match) */
|
||||
struct ub_packed_rrset_key* pside_glue;
|
||||
|
||||
/**
|
||||
* expected dnssec information for this iteration step.
|
||||
* If dnssec rrsigs are expected and not given, the server is marked
|
||||
@@ -254,6 +279,12 @@ struct iter_qstate {
|
||||
*/
|
||||
int dnssec_expected;
|
||||
|
||||
/**
|
||||
* We are expecting dnssec information, but we also know the server
|
||||
* is DNSSEC lame. The response need not be marked dnssec-lame again.
|
||||
*/
|
||||
int dnssec_lame_query;
|
||||
|
||||
/**
|
||||
* This is flag that, if true, means that this event is
|
||||
* waiting for a stub priming query.
|
||||
@@ -288,7 +319,7 @@ struct iter_prep_list {
|
||||
* Get the iterator function block.
|
||||
* @return: function block with function pointers to iterator methods.
|
||||
*/
|
||||
struct module_func_block* iter_get_funcblock();
|
||||
struct module_func_block* iter_get_funcblock(void);
|
||||
|
||||
/**
|
||||
* Get iterator state as a string
|
||||
|
||||
Binary file not shown.
+15
-1
@@ -44,6 +44,7 @@
|
||||
/* include the public api first, it should be able to stand alone */
|
||||
#include "libunbound/unbound.h"
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
#include "libunbound/context.h"
|
||||
#include "libunbound/libworker.h"
|
||||
#include "util/locks.h"
|
||||
@@ -66,7 +67,7 @@
|
||||
#endif /* UB_ON_WINDOWS */
|
||||
|
||||
struct ub_ctx*
|
||||
ub_ctx_create()
|
||||
ub_ctx_create(void)
|
||||
{
|
||||
struct ub_ctx* ctx;
|
||||
unsigned int seed;
|
||||
@@ -243,6 +244,19 @@ ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val)
|
||||
return UB_NOERROR;
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** str)
|
||||
{
|
||||
int r;
|
||||
lock_basic_lock(&ctx->cfglock);
|
||||
r = config_get_option_collate(ctx->env->cfg, opt, str);
|
||||
lock_basic_unlock(&ctx->cfglock);
|
||||
if(r == 0) r = UB_NOERROR;
|
||||
else if(r == 1) r = UB_SYNTAX;
|
||||
else if(r == 2) r = UB_NOMEM;
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
ub_ctx_config(struct ub_ctx* ctx, char* fname)
|
||||
{
|
||||
|
||||
+19
-25
@@ -42,6 +42,8 @@
|
||||
* returns from the procedure when done.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <ldns/dname.h>
|
||||
#include <ldns/wire2host.h>
|
||||
#include "libunbound/libworker.h"
|
||||
#include "libunbound/context.h"
|
||||
#include "libunbound/unbound.h"
|
||||
@@ -183,7 +185,6 @@ libworker_setup(struct ub_ctx* ctx, int is_bg)
|
||||
libworker_delete(w);
|
||||
return NULL;
|
||||
}
|
||||
w->env->send_packet = &libworker_send_packet;
|
||||
w->env->send_query = &libworker_send_query;
|
||||
w->env->detach_subs = &mesh_detach_subs;
|
||||
w->env->attach_sub = &mesh_attach_sub;
|
||||
@@ -484,8 +485,15 @@ setup_qinfo_edns(struct libworker* w, struct ctx_query* q,
|
||||
if(!rdf) {
|
||||
return 0;
|
||||
}
|
||||
#ifdef UNBOUND_ALLOC_LITE
|
||||
qinfo->qname = memdup(ldns_rdf_data(rdf), ldns_rdf_size(rdf));
|
||||
qinfo->qname_len = ldns_rdf_size(rdf);
|
||||
ldns_rdf_deep_free(rdf);
|
||||
rdf = 0;
|
||||
#else
|
||||
qinfo->qname = ldns_rdf_data(rdf);
|
||||
qinfo->qname_len = ldns_rdf_size(rdf);
|
||||
#endif
|
||||
edns->edns_present = 1;
|
||||
edns->ext_rcode = 0;
|
||||
edns->edns_version = 0;
|
||||
@@ -662,18 +670,6 @@ void libworker_alloc_cleanup(void* arg)
|
||||
slabhash_clear(w->env->msg_cache);
|
||||
}
|
||||
|
||||
int libworker_send_packet(ldns_buffer* pkt, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int timeout, struct module_qstate* q, int use_tcp)
|
||||
{
|
||||
struct libworker* w = (struct libworker*)q->env->worker;
|
||||
if(use_tcp) {
|
||||
return pending_tcp_query(w->back, pkt, addr, addrlen,
|
||||
timeout, libworker_handle_reply, q) != 0;
|
||||
}
|
||||
return pending_udp_query(w->back, pkt, addr, addrlen,
|
||||
timeout*1000, libworker_handle_reply, q) != 0;
|
||||
}
|
||||
|
||||
/** compare outbound entry qstates */
|
||||
static int
|
||||
outbound_entry_compare(void* a, void* b)
|
||||
@@ -687,7 +683,7 @@ outbound_entry_compare(void* a, void* b)
|
||||
|
||||
struct outbound_entry* libworker_send_query(uint8_t* qname, size_t qnamelen,
|
||||
uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
int want_dnssec, struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
struct module_qstate* q)
|
||||
{
|
||||
struct libworker* w = (struct libworker*)q->env->worker;
|
||||
@@ -697,7 +693,8 @@ struct outbound_entry* libworker_send_query(uint8_t* qname, size_t qnamelen,
|
||||
return NULL;
|
||||
e->qstate = q;
|
||||
e->qsent = outnet_serviced_query(w->back, qname,
|
||||
qnamelen, qtype, qclass, flags, dnssec, addr, addrlen,
|
||||
qnamelen, qtype, qclass, flags, dnssec, want_dnssec,
|
||||
q->env->cfg->tcp_upstream, addr, addrlen,
|
||||
libworker_handle_service_reply, e, w->back->udp_buff,
|
||||
&outbound_entry_compare);
|
||||
if(!e->qsent) {
|
||||
@@ -814,19 +811,11 @@ void worker_sighandler(int ATTR_UNUSED(sig), void* ATTR_UNUSED(arg))
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
int worker_send_packet(ldns_buffer* ATTR_UNUSED(pkt),
|
||||
struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
socklen_t ATTR_UNUSED(addrlen), int ATTR_UNUSED(timeout),
|
||||
struct module_qstate* ATTR_UNUSED(q), int ATTR_UNUSED(use_tcp))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct outbound_entry* worker_send_query(uint8_t* ATTR_UNUSED(qname),
|
||||
size_t ATTR_UNUSED(qnamelen), uint16_t ATTR_UNUSED(qtype),
|
||||
uint16_t ATTR_UNUSED(qclass), uint16_t ATTR_UNUSED(flags),
|
||||
int ATTR_UNUSED(dnssec), struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
int ATTR_UNUSED(dnssec), int ATTR_UNUSED(want_dnssec),
|
||||
struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
socklen_t ATTR_UNUSED(addrlen), struct module_qstate* ATTR_UNUSED(q))
|
||||
{
|
||||
log_assert(0);
|
||||
@@ -868,6 +857,11 @@ int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
|
||||
return 0;
|
||||
}
|
||||
|
||||
void remote_get_opt_ssl(char* ATTR_UNUSED(str), void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
#ifdef UB_ON_WINDOWS
|
||||
void
|
||||
worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev), void*
|
||||
|
||||
+2
-15
@@ -107,20 +107,6 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q);
|
||||
/** cleanup the cache to remove all rrset IDs from it, arg is libworker */
|
||||
void libworker_alloc_cleanup(void* arg);
|
||||
|
||||
/**
|
||||
* Worker service routine to send udp messages for modules.
|
||||
* @param pkt: packet to send.
|
||||
* @param addr: where to.
|
||||
* @param addrlen: length of addr.
|
||||
* @param timeout: seconds to wait until timeout.
|
||||
* @param q: wich query state to reactivate upon return.
|
||||
* @param use_tcp: true to use TCP, false for UDP.
|
||||
* @return: false on failure (memory or socket related). no query was
|
||||
* sent.
|
||||
*/
|
||||
int libworker_send_packet(ldns_buffer* pkt, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, int timeout, struct module_qstate* q, int use_tcp);
|
||||
|
||||
/**
|
||||
* Worker service routine to send serviced queries to authoritative servers.
|
||||
* @param qname: query name. (host order)
|
||||
@@ -129,6 +115,7 @@ int libworker_send_packet(ldns_buffer* pkt, struct sockaddr_storage* addr,
|
||||
* @param qclass: query class. (host order)
|
||||
* @param flags: host order flags word, with opcode and CD bit.
|
||||
* @param dnssec: if set, EDNS record will have DO bit set.
|
||||
* @param want_dnssec: signatures needed.
|
||||
* @param addr: where to.
|
||||
* @param addrlen: length of addr.
|
||||
* @param q: wich query state to reactivate upon return.
|
||||
@@ -137,7 +124,7 @@ int libworker_send_packet(ldns_buffer* pkt, struct sockaddr_storage* addr,
|
||||
*/
|
||||
struct outbound_entry* libworker_send_query(uint8_t* qname, size_t qnamelen,
|
||||
uint16_t qtype, uint16_t qclass, uint16_t flags, int dnssec,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
int want_dnssec, struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
struct module_qstate* q);
|
||||
|
||||
/** process incoming replies from the network */
|
||||
|
||||
@@ -56,9 +56,9 @@ clean:
|
||||
rm -f _unbound.so libunbound_wrap.o
|
||||
$(MAKE) -C ../.. clean
|
||||
|
||||
testenv: ../../.libs/libunbound.so.1 ../../ldns-src/lib/libldns.so ../../.libs/_unbound.so
|
||||
testenv: ../../.libs/libunbound.so.2 ../../ldns-src/lib/libldns.so ../../.libs/_unbound.so
|
||||
rm -rdf examples/unbound
|
||||
cd examples && mkdir unbound && ln -s ../../unbound.py unbound/__init__.py && ln -s ../../_unbound.so unbound/_unbound.so && ln -s ../../../../.libs/libunbound.so.1 unbound/libunbound.so.1 && ln -s ../../../../ldns-src/lib/libldns.so.1 unbound/libldns.so.1 && ls -la
|
||||
cd examples && mkdir unbound && ln -s ../../unbound.py unbound/__init__.py && ln -s ../../_unbound.so unbound/_unbound.so && ln -s ../../../../.libs/libunbound.so.2 unbound/libunbound.so.2 && ln -s ../../../../ldns-src/lib/libldns.so.1 unbound/libldns.so.1 && ls -la
|
||||
cd examples && if test -f ../../../.libs/_unbound.so; then cp ../../../.libs/_unbound.so . ; fi
|
||||
@echo "Run a script by typing ./script_name.py"
|
||||
cd examples && LD_LIBRARY_PATH=unbound bash
|
||||
|
||||
@@ -5,22 +5,18 @@ Installation
|
||||
|
||||
Python 2.4 or higher, SWIG 1.3 or higher, GNU make
|
||||
|
||||
**Download**
|
||||
|
||||
You can download the source codes `here`_.
|
||||
The latest release is 1.1.1, Jan 15, 2009.
|
||||
|
||||
.. _here: unbound-1.1.1-py.tar.gz
|
||||
|
||||
**Compiling**
|
||||
|
||||
After downloading, you can compile the pyUnbound library by doing::
|
||||
|
||||
> tar -xzf unbound-1.1.1-py.tar.gz
|
||||
> cd unbound-1.1.1
|
||||
> tar -xzf unbound-x.x.x-py.tar.gz
|
||||
> cd unbound-x.x.x
|
||||
> ./configure --with-pyunbound
|
||||
> make
|
||||
|
||||
You may want to --with-pythonmodule as well if you want to use python as
|
||||
a module in the resolver.
|
||||
|
||||
You need GNU make to compile sources; SWIG and Python devel libraries to compile extension module.
|
||||
|
||||
|
||||
@@ -32,4 +28,4 @@ If the compilation is successfull, you can test the python LDNS extension module
|
||||
> make testenv
|
||||
> ./dns-lookup.py
|
||||
|
||||
In contrib/examples you can find simple applications written in Python using the Unbound extension.
|
||||
You may want to make install in the main directory since make testenv is for debugging. In contrib/examples you can find simple applications written in Python using the Unbound extension.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
ub_ctx_create
|
||||
ub_ctx_delete
|
||||
ub_ctx_get_option
|
||||
ub_ctx_set_option
|
||||
ub_ctx_config
|
||||
ub_ctx_set_fwd
|
||||
|
||||
+25
-1
@@ -93,6 +93,10 @@
|
||||
#ifndef _UB_UNBOUND_H
|
||||
#define _UB_UNBOUND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The validation context is created to hold the resolver status,
|
||||
* validation keys and a small cache (containing messages, rrsets,
|
||||
@@ -227,7 +231,7 @@ void ub_ctx_delete(struct ub_ctx* ctx);
|
||||
* @param ctx: context.
|
||||
* @param opt: option name from the unbound.conf config file format.
|
||||
* (not all settings applicable). The name includes the trailing ':'
|
||||
* for example ub_ctx_set_option("logfile:", "mylog.txt");
|
||||
* for example ub_ctx_set_option(ctx, "logfile:", "mylog.txt");
|
||||
* This is a power-users interface that lets you specify all sorts
|
||||
* of options.
|
||||
* For some specific options, such as adding trust anchors, special
|
||||
@@ -237,6 +241,22 @@ void ub_ctx_delete(struct ub_ctx* ctx);
|
||||
*/
|
||||
int ub_ctx_set_option(struct ub_ctx* ctx, char* opt, char* val);
|
||||
|
||||
/**
|
||||
* Get an option from the context.
|
||||
* @param ctx: context.
|
||||
* @param opt: option name from the unbound.conf config file format.
|
||||
* (not all settings applicable). The name excludes the trailing ':'
|
||||
* for example ub_ctx_get_option(ctx, "logfile", &result);
|
||||
* This is a power-users interface that lets you specify all sorts
|
||||
* of options.
|
||||
* @param str: the string is malloced and returned here. NULL on error.
|
||||
* The caller must free() the string. In cases with multiple
|
||||
* entries (auto-trust-anchor-file), a newline delimited list is
|
||||
* returned in the string.
|
||||
* @return 0 if OK else an error code (malloc failure, syntax error).
|
||||
*/
|
||||
int ub_ctx_get_option(struct ub_ctx* ctx, char* opt, char** str);
|
||||
|
||||
/**
|
||||
* setup configuration for the given context.
|
||||
* @param ctx: context.
|
||||
@@ -523,4 +543,8 @@ int ub_ctx_data_add(struct ub_ctx* ctx, char *data);
|
||||
*/
|
||||
int ub_ctx_data_remove(struct ub_ctx* ctx, char *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _UB_UNBOUND_H */
|
||||
|
||||
+88
-8
@@ -54,6 +54,9 @@ Generate a distribution tar file for unbound.
|
||||
-d SVN_root Retrieve the unbound source from the specified repository.
|
||||
Detected from svn working copy if not specified.
|
||||
-l ldnsdir Directory where ldns resides. Detected from Makefile.
|
||||
-wssl openssl.xx.tar.gz Also build openssl from tarball for windows dist.
|
||||
-wxp expat.xx.tar.gz Also build expat from tarball for windows dist.
|
||||
-wldns ldns.xx.tar.gz Also build libldns from tarball for windows dist.
|
||||
-w ... Build windows binary dist. last args passed to configure.
|
||||
EOF
|
||||
exit 1
|
||||
@@ -133,6 +136,9 @@ SNAPSHOT="no"
|
||||
RC="no"
|
||||
LDNSDIR=""
|
||||
DOWIN="no"
|
||||
WINSSL=""
|
||||
WINEXPAT=""
|
||||
WINLDNS=""
|
||||
|
||||
# Parse the command line arguments.
|
||||
while [ "$1" ]; do
|
||||
@@ -147,6 +153,18 @@ while [ "$1" ]; do
|
||||
"-s")
|
||||
SNAPSHOT="yes"
|
||||
;;
|
||||
"-wldns")
|
||||
WINLDNS="$2"
|
||||
shift
|
||||
;;
|
||||
"-wssl")
|
||||
WINSSL="$2"
|
||||
shift
|
||||
;;
|
||||
"-wxp")
|
||||
WINEXPAT="$2"
|
||||
shift
|
||||
;;
|
||||
"-w")
|
||||
DOWIN="yes"
|
||||
shift
|
||||
@@ -168,16 +186,71 @@ while [ "$1" ]; do
|
||||
done
|
||||
|
||||
if [ "$DOWIN" = "yes" ]; then
|
||||
# detect crosscompile, from Fedora11 at this point.
|
||||
# detect crosscompile, from Fedora13 at this point.
|
||||
if test "`uname`" = "Linux"; then
|
||||
info "Crosscompile windows dist"
|
||||
cross="yes"
|
||||
configure="mingw32-configure"
|
||||
strip="i686-pc-mingw32-strip"
|
||||
makensis="makensis" # from mingw32-nsis package
|
||||
# flags for crosscompiled dependency libraries
|
||||
cross_flag=""
|
||||
|
||||
check_svn_root
|
||||
create_temp_dir
|
||||
|
||||
# crosscompile openssl for windows.
|
||||
if test -n "$WINSSL"; then
|
||||
info "Cross compile $WINSSL"
|
||||
info "winssl tar unpack"
|
||||
(cd ..; gzip -cd $WINSSL) | tar xf - || error_cleanup "tar unpack of $WINSSL failed"
|
||||
sslinstall="`pwd`/sslinstall"
|
||||
cd openssl-* || error_cleanup "no openssl-X dir in tarball"
|
||||
# configure for crosscompile, without CAPI because it fails
|
||||
# cross-compilation and it is not used anyway
|
||||
sslflags="no-asm --cross-compile-prefix=i686-pc-mingw32- -DOPENSSL_NO_CAPIENG mingw"
|
||||
info "winssl: Configure $sslflags"
|
||||
./Configure --prefix="$sslinstall" $sslflags || error_cleanup "OpenSSL Configure failed"
|
||||
info "winssl: make"
|
||||
make || error_cleanup "OpenSSL crosscompile failed"
|
||||
# only install sw not docs, which take a long time.
|
||||
info "winssl: make install_sw"
|
||||
make install_sw || error_cleanup "OpenSSL install failed"
|
||||
cross_flag="$cross_flag --with-ssl=$sslinstall"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
if test -n "$WINLDNS"; then
|
||||
info "Cross compile $WINLDNS"
|
||||
info "ldns tar unpack"
|
||||
(cd ..; gzip -cd $WINLDNS) | tar xf - || error_cleanup "tar unpack of $WINLDNS failed"
|
||||
cd ldns-* || error_cleanup "no ldns-X dir in tarball"
|
||||
# we can use the cross_flag with openssl in it
|
||||
info "ldns: Configure $cross_flag"
|
||||
mingw32-configure $cross_flag || error_cleanup "ldns configure failed"
|
||||
info "ldns: make"
|
||||
make || error_cleanup "ldns crosscompile failed"
|
||||
# use from the build directory.
|
||||
cross_flag="$cross_flag --with-ldns=`pwd`"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
if test -n "$WINEXPAT"; then
|
||||
info "Cross compile $WINEXPAT"
|
||||
info "wxp: tar unpack"
|
||||
(cd ..; gzip -cd $WINEXPAT) | tar xf - || error_cleanup "tar unpack of $WINEXPAT failed"
|
||||
wxpinstall="`pwd`/wxpinstall"
|
||||
cd expat-* || error_cleanup "no expat-X dir in tarball"
|
||||
info "wxp: configure"
|
||||
mingw32-configure --prefix="$wxpinstall" --exec-prefix="$wxpinstall" --bindir="$wxpinstall/bin" --includedir="$wxpinstall/include" --mandir="$wxpinstall/man" --libdir="$wxpinstall/lib" || error_cleanup "libexpat configure failed"
|
||||
#info "wxp: make"
|
||||
#make || error_cleanup "libexpat crosscompile failed"
|
||||
info "wxp: make installlib"
|
||||
make installlib || error_cleanup "libexpat install failed"
|
||||
cross_flag="$cross_flag --with-libexpat=$wxpinstall"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
info "Exporting source from SVN."
|
||||
svn export "$SVNROOT" unbound || error_cleanup "SVN command failed"
|
||||
cd unbound || error_cleanup "Unbound not exported correctly from SVN"
|
||||
@@ -186,6 +259,7 @@ if [ "$DOWIN" = "yes" ]; then
|
||||
if test -f mingw32-config.cache; then rm mingw32-config.cache; fi
|
||||
else
|
||||
cross="no" # mingw and msys
|
||||
cross_flag=""
|
||||
configure="./configure"
|
||||
strip="strip"
|
||||
makensis="c:/Program Files/NSIS/makensis.exe" # http://nsis.sf.net
|
||||
@@ -206,15 +280,16 @@ if [ "$DOWIN" = "yes" ]; then
|
||||
replace_text "configure.ac" "AC_INIT(unbound, $version" "AC_INIT(unbound, $version2"
|
||||
version="$version2"
|
||||
info "Rebuilding configure script (autoconf) snapshot."
|
||||
autoconf || autoheader || error_cleanup "Autoconf failed."
|
||||
autoconf || error_cleanup "Autoconf failed."
|
||||
autoheader || error_cleanup "Autoheader failed."
|
||||
rm -r autom4te* || echo "ignored"
|
||||
fi
|
||||
|
||||
# procedure for making unbound installer on mingw.
|
||||
info "Creating windows dist unbound $version"
|
||||
info "Calling configure"
|
||||
echo "$configure"' --enable-debug --enable-static-exe '"$*"
|
||||
$configure --enable-debug --enable-static-exe $* \
|
||||
echo "$configure"' --enable-debug --enable-static-exe '"$* $cross_flag"
|
||||
$configure --enable-debug --enable-static-exe $* $cross_flag \
|
||||
|| error_cleanup "Could not configure"
|
||||
info "Calling make"
|
||||
make || error_cleanup "Could not make"
|
||||
@@ -229,14 +304,15 @@ if [ "$DOWIN" = "yes" ]; then
|
||||
$strip anchor-update.exe
|
||||
$strip unbound-control.exe
|
||||
$strip unbound-host.exe
|
||||
$strip unbound-anchor.exe
|
||||
$strip unbound-checkconf.exe
|
||||
$strip unbound-service-install.exe
|
||||
$strip unbound-service-remove.exe
|
||||
cd tmp.$$
|
||||
cp ../doc/example.conf example.conf
|
||||
cp ../unbound.exe ../unbound-host.exe ../unbound-control.exe ../unbound-checkconf.exe ../unbound-service-install.exe ../unbound-service-remove.exe ../LICENSE ../winrc/unbound-website.url ../winrc/service.conf ../winrc/README.txt .
|
||||
cp ../unbound.exe ../unbound-anchor.exe ../unbound-host.exe ../unbound-control.exe ../unbound-checkconf.exe ../unbound-service-install.exe ../unbound-service-remove.exe ../LICENSE ../winrc/unbound-website.url ../winrc/service.conf ../winrc/README.txt .
|
||||
# zipfile
|
||||
zip ../$file LICENSE README.txt unbound.exe unbound-host.exe unbound-control.exe unbound-checkconf.exe unbound-service-install.exe unbound-service-remove.exe example.conf service.conf unbound-website.url
|
||||
zip ../$file LICENSE README.txt unbound.exe unbound-anchor.exe unbound-host.exe unbound-control.exe unbound-checkconf.exe unbound-service-install.exe unbound-service-remove.exe example.conf service.conf unbound-website.url
|
||||
info "Testing $file"
|
||||
(cd .. ; zip -T $file )
|
||||
# installer
|
||||
@@ -293,9 +369,11 @@ autoreconf || error_cleanup "Autoconf failed."
|
||||
rm -r autom4te* || error_cleanup "Failed to remove autoconf cache directory."
|
||||
|
||||
info "Building lexer and parser."
|
||||
echo "#include \"util/configyyrename.h\"" > util/configlexer.c || error_cleanup "Failed to create configlexer"
|
||||
echo "#include \"config.h\"" > util/configlexer.c || error_cleanup "Failed to create configlexer"
|
||||
echo "#include \"util/configyyrename.h\"" >> util/configlexer.c || error_cleanup "Failed to create configlexer"
|
||||
flex -i -t util/configlexer.lex >> util/configlexer.c || error_cleanup "Failed to create configlexer"
|
||||
bison -y -d -o util/configparser.c util/configparser.y || error_cleanup "Failed to create configparser"
|
||||
if test -x `which bison` 2>&1; then YACC=bison; else YACC=yacc; fi
|
||||
$YACC -y -d -o util/configparser.c util/configparser.y || error_cleanup "Failed to create configparser"
|
||||
|
||||
# check shared code, ldns-testpkts from ldns examples, if possible.
|
||||
cd ../..
|
||||
@@ -352,7 +430,9 @@ replace_all doc/unbound.8.in
|
||||
replace_all doc/unbound.conf.5.in
|
||||
replace_all doc/unbound-checkconf.8.in
|
||||
replace_all doc/unbound-control.8.in
|
||||
replace_all doc/unbound-anchor.8.in
|
||||
replace_all doc/unbound-host.1
|
||||
replace_all doc/example.conf.in
|
||||
replace_all doc/libunbound.3.in
|
||||
|
||||
info "Renaming Unbound directory to unbound-$version."
|
||||
|
||||
@@ -345,6 +345,7 @@ struct reply_info {
|
||||
uint16_t flags;
|
||||
uint16_t qdcount;
|
||||
uint32_t ttl;
|
||||
uint32_t prefetch_ttl;
|
||||
|
||||
uint16_t authoritative;
|
||||
enum sec_status security;
|
||||
@@ -867,6 +868,15 @@ void log_dns_msg(const char* str, struct query_info* qinfo, struct reply_info* r
|
||||
void log_query_info(enum verbosity_value v, const char* str, struct query_info* qinf);
|
||||
void regional_log_stats(struct regional *r);
|
||||
|
||||
// Free allocated memory from marked sources returning corresponding types
|
||||
%typemap(newfree, noblock = 1) char * {
|
||||
free($1);
|
||||
}
|
||||
|
||||
// Mark as source returning newly allocated memory
|
||||
%newobject ldns_rr_type2str;
|
||||
%newobject ldns_rr_class2str;
|
||||
|
||||
// LDNS functions
|
||||
char *ldns_rr_type2str(const uint16_t atype);
|
||||
char *ldns_rr_class2str(const uint16_t aclass);
|
||||
|
||||
+29
-19
@@ -44,6 +44,7 @@
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "ldns/ldns.h"
|
||||
|
||||
#undef _POSIX_C_SOURCE
|
||||
#undef _XOPEN_SOURCE
|
||||
@@ -56,6 +57,8 @@
|
||||
|
||||
#ifdef S_SPLINT_S
|
||||
typedef struct PyObject PyObject;
|
||||
typedef struct PyThreadState PyThreadState;
|
||||
typedef void* PyGILState_STATE;
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -66,6 +69,8 @@ struct pythonmod_env {
|
||||
/** Python script filename. */
|
||||
const char* fname;
|
||||
|
||||
/** Python main thread */
|
||||
PyThreadState* mainthr;
|
||||
/** Python module. */
|
||||
PyObject* module;
|
||||
|
||||
@@ -107,6 +112,7 @@ int pythonmod_init(struct module_env* env, int id)
|
||||
/* Initialize module */
|
||||
FILE* script_py = NULL;
|
||||
PyObject* py_cfg, *res;
|
||||
PyGILState_STATE gil;
|
||||
struct pythonmod_env* pe = (struct pythonmod_env*)calloc(1, sizeof(struct pythonmod_env));
|
||||
if (!pe)
|
||||
{
|
||||
@@ -130,11 +136,11 @@ int pythonmod_init(struct module_env* env, int id)
|
||||
Py_NoSiteFlag = 1;
|
||||
Py_Initialize();
|
||||
PyEval_InitThreads();
|
||||
PyEval_ReleaseLock();
|
||||
SWIG_init();
|
||||
pe->mainthr = PyEval_SaveThread();
|
||||
}
|
||||
|
||||
PyEval_AcquireLock();
|
||||
gil = PyGILState_Ensure();
|
||||
|
||||
/* Initialize Python */
|
||||
PyRun_SimpleString("import sys \n");
|
||||
@@ -147,10 +153,12 @@ int pythonmod_init(struct module_env* env, int id)
|
||||
}
|
||||
PyRun_SimpleString("sys.path.append('"RUN_DIR"') \n");
|
||||
PyRun_SimpleString("sys.path.append('"SHARE_DIR"') \n");
|
||||
PyRun_SimpleString("import distutils.sysconfig \n");
|
||||
PyRun_SimpleString("sys.path.append(distutils.sysconfig.get_python_lib(1,0)) \n");
|
||||
if (PyRun_SimpleString("from unboundmodule import *\n") < 0)
|
||||
{
|
||||
log_err("pythonmod: cannot initialize core module: unboundmodule.py");
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -158,7 +166,7 @@ int pythonmod_init(struct module_env* env, int id)
|
||||
if ((script_py = fopen(pe->fname, "r")) == NULL)
|
||||
{
|
||||
log_err("pythonmod: can't open file %s for reading", pe->fname);
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -174,7 +182,7 @@ int pythonmod_init(struct module_env* env, int id)
|
||||
if (PyRun_SimpleFile(script_py, pe->fname) < 0)
|
||||
{
|
||||
log_err("pythonmod: can't parse Python script %s", pe->fname);
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -183,25 +191,25 @@ int pythonmod_init(struct module_env* env, int id)
|
||||
if ((pe->func_init = PyDict_GetItemString(pe->dict, "init")) == NULL)
|
||||
{
|
||||
log_err("pythonmod: function init is missing in %s", pe->fname);
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
return 0;
|
||||
}
|
||||
if ((pe->func_deinit = PyDict_GetItemString(pe->dict, "deinit")) == NULL)
|
||||
{
|
||||
log_err("pythonmod: function deinit is missing in %s", pe->fname);
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
return 0;
|
||||
}
|
||||
if ((pe->func_operate = PyDict_GetItemString(pe->dict, "operate")) == NULL)
|
||||
{
|
||||
log_err("pythonmod: function operate is missing in %s", pe->fname);
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
return 0;
|
||||
}
|
||||
if ((pe->func_inform = PyDict_GetItemString(pe->dict, "inform_super")) == NULL)
|
||||
{
|
||||
log_err("pythonmod: function inform_super is missing in %s", pe->fname);
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -215,7 +223,7 @@ int pythonmod_init(struct module_env* env, int id)
|
||||
|
||||
Py_XDECREF(res);
|
||||
Py_XDECREF(py_cfg);
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -230,9 +238,9 @@ void pythonmod_deinit(struct module_env* env, int id)
|
||||
if(pe->module != NULL)
|
||||
{
|
||||
PyObject* res;
|
||||
PyGILState_STATE gil = PyGILState_Ensure();
|
||||
|
||||
/* Deinit module */
|
||||
PyEval_AcquireLock();
|
||||
res = PyObject_CallFunction(pe->func_deinit, "i", id);
|
||||
if (PyErr_Occurred()) {
|
||||
log_err("pythonmod: Exception occurred in function deinit");
|
||||
@@ -242,8 +250,11 @@ void pythonmod_deinit(struct module_env* env, int id)
|
||||
Py_XDECREF(res);
|
||||
/* Free shared data if any */
|
||||
Py_XDECREF(pe->data);
|
||||
PyGILState_Release(gil);
|
||||
|
||||
PyEval_RestoreThread(pe->mainthr);
|
||||
Py_Finalize();
|
||||
pe->mainthr = NULL;
|
||||
}
|
||||
pe->fname = NULL;
|
||||
free(pe);
|
||||
@@ -257,6 +268,7 @@ void pythonmod_inform_super(struct module_qstate* qstate, int id, struct module_
|
||||
struct pythonmod_env* pe = (struct pythonmod_env*)qstate->env->modinfo[id];
|
||||
struct pythonmod_qstate* pq = (struct pythonmod_qstate*)qstate->minfo[id];
|
||||
PyObject* py_qstate, *py_sqstate, *res;
|
||||
PyGILState_STATE gil = PyGILState_Ensure();
|
||||
|
||||
log_query_info(VERB_ALGO, "pythonmod: inform_super, sub is", &qstate->qinfo);
|
||||
log_query_info(VERB_ALGO, "super is", &super->qinfo);
|
||||
@@ -264,7 +276,6 @@ void pythonmod_inform_super(struct module_qstate* qstate, int id, struct module_
|
||||
py_qstate = SWIG_NewPointerObj((void*) qstate, SWIGTYPE_p_module_qstate, 0);
|
||||
py_sqstate = SWIG_NewPointerObj((void*) super, SWIGTYPE_p_module_qstate, 0);
|
||||
|
||||
PyEval_AcquireLock();
|
||||
res = PyObject_CallFunction(pe->func_inform, "iOOO", id, py_qstate,
|
||||
py_sqstate, pq->data);
|
||||
|
||||
@@ -284,7 +295,7 @@ void pythonmod_inform_super(struct module_qstate* qstate, int id, struct module_
|
||||
Py_XDECREF(py_sqstate);
|
||||
Py_XDECREF(py_qstate);
|
||||
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
}
|
||||
|
||||
void pythonmod_operate(struct module_qstate* qstate, enum module_ev event,
|
||||
@@ -293,6 +304,7 @@ void pythonmod_operate(struct module_qstate* qstate, enum module_ev event,
|
||||
struct pythonmod_env* pe = (struct pythonmod_env*)qstate->env->modinfo[id];
|
||||
struct pythonmod_qstate* pq = (struct pythonmod_qstate*)qstate->minfo[id];
|
||||
PyObject* py_qstate, *res;
|
||||
PyGILState_STATE gil = PyGILState_Ensure();
|
||||
|
||||
if ( pq == NULL)
|
||||
{
|
||||
@@ -304,9 +316,6 @@ void pythonmod_operate(struct module_qstate* qstate, enum module_ev event,
|
||||
Py_INCREF(pq->data);
|
||||
}
|
||||
|
||||
/* Lock Python */
|
||||
PyEval_AcquireLock();
|
||||
|
||||
/* Call operate */
|
||||
py_qstate = SWIG_NewPointerObj((void*) qstate, SWIGTYPE_p_module_qstate, 0);
|
||||
res = PyObject_CallFunction(pe->func_operate, "iiOO", id, (int) event,
|
||||
@@ -325,8 +334,7 @@ void pythonmod_operate(struct module_qstate* qstate, enum module_ev event,
|
||||
Py_XDECREF(res);
|
||||
Py_XDECREF(py_qstate);
|
||||
|
||||
/* Unlock Python */
|
||||
PyEval_ReleaseLock();
|
||||
PyGILState_Release(gil);
|
||||
}
|
||||
|
||||
void pythonmod_clear(struct module_qstate* qstate, int id)
|
||||
@@ -340,7 +348,9 @@ void pythonmod_clear(struct module_qstate* qstate, int id)
|
||||
(unsigned long int)pq);
|
||||
if(pq != NULL)
|
||||
{
|
||||
PyGILState_STATE gil = PyGILState_Ensure();
|
||||
Py_DECREF(pq->data);
|
||||
PyGILState_Release(gil);
|
||||
/* Free qstate */
|
||||
free(pq);
|
||||
}
|
||||
@@ -367,7 +377,7 @@ static struct module_func_block pythonmod_block = {
|
||||
&pythonmod_clear, &pythonmod_get_mem
|
||||
};
|
||||
|
||||
struct module_func_block* pythonmod_get_funcblock()
|
||||
struct module_func_block* pythonmod_get_funcblock(void)
|
||||
{
|
||||
return &pythonmod_block;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
* Get the module function block.
|
||||
* @return: function block with function pointers to module methods.
|
||||
*/
|
||||
struct module_func_block* pythonmod_get_funcblock();
|
||||
struct module_func_block* pythonmod_get_funcblock(void);
|
||||
|
||||
/** python module init */
|
||||
int pythonmod_init(struct module_env* env, int id);
|
||||
|
||||
@@ -65,7 +65,8 @@ int storeQueryInCache(struct module_qstate* qstate, struct query_info* qinfo, st
|
||||
return 0;
|
||||
}
|
||||
|
||||
return dns_cache_store(qstate->env, qinfo, msgrep, is_referral);
|
||||
return dns_cache_store(qstate->env, qinfo, msgrep, is_referral,
|
||||
qstate->prefetch_leeway);
|
||||
}
|
||||
|
||||
/* Invalidate the message associated with query_info stored in message cache */
|
||||
|
||||
@@ -74,6 +74,7 @@ void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qin
|
||||
*
|
||||
* @param qstate: module environment
|
||||
* @param pkt: a ldns_buffer which contains ldns_packet data
|
||||
* @return 0 on failure, out of memory or parse error.
|
||||
*/
|
||||
int createResponse(struct module_qstate* qstate, ldns_buffer* pkt);
|
||||
|
||||
|
||||
Vendored
+56
-60
@@ -49,6 +49,7 @@
|
||||
#include "util/module.h"
|
||||
#include "util/net_help.h"
|
||||
#include "util/regional.h"
|
||||
#include "util/config_file.h"
|
||||
|
||||
/** store rrsets in the rrset cache.
|
||||
* @param env: module environment with caches.
|
||||
@@ -71,7 +72,7 @@ store_rrsets(struct module_env* env, struct reply_info* rep, uint32_t now)
|
||||
|
||||
void
|
||||
dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
||||
hashvalue_t hash, struct reply_info* rep)
|
||||
hashvalue_t hash, struct reply_info* rep, uint32_t leeway)
|
||||
{
|
||||
struct msgreply_entry* e;
|
||||
uint32_t ttl = rep->ttl;
|
||||
@@ -84,7 +85,7 @@ dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
||||
}
|
||||
reply_info_sortref(rep);
|
||||
reply_info_set_ttls(rep, *env->now);
|
||||
store_rrsets(env, rep, *env->now);
|
||||
store_rrsets(env, rep, *env->now+leeway);
|
||||
if(ttl == 0) {
|
||||
/* we do not store the message, but we did store the RRs,
|
||||
* which could be useful for delegation information */
|
||||
@@ -180,7 +181,7 @@ find_add_addrs(struct module_env* env, uint16_t qclass,
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_A, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 0, 0)) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 0)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -198,7 +199,7 @@ find_add_addrs(struct module_env* env, uint16_t qclass,
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_AAAA, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 0, 0)) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 0)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -213,27 +214,6 @@ find_add_addrs(struct module_env* env, uint16_t qclass,
|
||||
lock_rw_unlock(&neg->entry.lock);
|
||||
}
|
||||
}
|
||||
/* see if we have parent-side-glue (dispreferred) */
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_A, qclass,
|
||||
PACKED_RRSET_PARENT_SIDE, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 1, 1)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_AAAA, qclass,
|
||||
PACKED_RRSET_PARENT_SIDE, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 1, 1)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -248,12 +228,10 @@ cache_fill_missing(struct module_env* env, uint16_t qclass,
|
||||
struct ub_packed_rrset_key* akey;
|
||||
uint32_t now = *env->now;
|
||||
for(ns = dp->nslist; ns; ns = ns->next) {
|
||||
if(ns->resolved)
|
||||
continue;
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_A, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 0, 1)) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, (int)ns->lame)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -271,7 +249,7 @@ cache_fill_missing(struct module_env* env, uint16_t qclass,
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_AAAA, qclass, 0, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 0, 1)) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, (int)ns->lame)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
@@ -286,27 +264,6 @@ cache_fill_missing(struct module_env* env, uint16_t qclass,
|
||||
lock_rw_unlock(&neg->entry.lock);
|
||||
}
|
||||
}
|
||||
/* see if we have parent-side-glue (dispreferred) */
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_A, qclass,
|
||||
PACKED_RRSET_PARENT_SIDE, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_A(dp, region, akey, 1, 1)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
akey = rrset_cache_lookup(env->rrset_cache, ns->name,
|
||||
ns->namelen, LDNS_RR_TYPE_AAAA, qclass,
|
||||
PACKED_RRSET_PARENT_SIDE, now, 0);
|
||||
if(akey) {
|
||||
if(!delegpt_add_rrset_AAAA(dp, region, akey, 1, 1)) {
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
return 0;
|
||||
}
|
||||
lock_rw_unlock(&akey->entry.lock);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -422,7 +379,7 @@ dns_cache_find_delegation(struct module_env* env, uint8_t* qname,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if(!delegpt_rrset_add_ns(dp, region, nskey))
|
||||
if(!delegpt_rrset_add_ns(dp, region, nskey, 0))
|
||||
log_err("find_delegation: addns out of memory");
|
||||
lock_rw_unlock(&nskey->entry.lock); /* first unlock before next lookup*/
|
||||
/* find and add DS/NSEC (if any) */
|
||||
@@ -461,19 +418,22 @@ gen_dns_msg(struct regional* region, struct query_info* q, size_t num)
|
||||
|
||||
/** generate dns_msg from cached message */
|
||||
static struct dns_msg*
|
||||
tomsg(struct module_env* env, struct msgreply_entry* e, struct reply_info* r,
|
||||
tomsg(struct module_env* env, struct query_info* q, struct reply_info* r,
|
||||
struct regional* region, uint32_t now, struct regional* scratch)
|
||||
{
|
||||
struct dns_msg* msg;
|
||||
size_t i;
|
||||
if(now > r->ttl)
|
||||
return NULL;
|
||||
msg = gen_dns_msg(region, &e->key, r->rrset_count);
|
||||
msg = gen_dns_msg(region, q, r->rrset_count);
|
||||
if(!msg)
|
||||
return NULL;
|
||||
msg->rep->flags = r->flags;
|
||||
msg->rep->qdcount = r->qdcount;
|
||||
msg->rep->ttl = r->ttl - now;
|
||||
if(r->prefetch_ttl > now)
|
||||
msg->rep->prefetch_ttl = r->prefetch_ttl - now;
|
||||
else msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl);
|
||||
msg->rep->security = r->security;
|
||||
msg->rep->an_numrrsets = r->an_numrrsets;
|
||||
msg->rep->ns_numrrsets = r->ns_numrrsets;
|
||||
@@ -524,6 +484,7 @@ rrset_msg(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
msg->rep->authoritative = 0; /* reply stored in cache can't be authoritative */
|
||||
msg->rep->qdcount = 1;
|
||||
msg->rep->ttl = d->ttl - now;
|
||||
msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl);
|
||||
msg->rep->security = sec_status_unchecked;
|
||||
msg->rep->an_numrrsets = 1;
|
||||
msg->rep->ns_numrrsets = 0;
|
||||
@@ -559,6 +520,7 @@ synth_dname_msg(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
msg->rep->authoritative = 0; /* reply stored in cache can't be authoritative */
|
||||
msg->rep->qdcount = 1;
|
||||
msg->rep->ttl = d->ttl - now;
|
||||
msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl);
|
||||
msg->rep->security = sec_status_unchecked;
|
||||
msg->rep->an_numrrsets = 1;
|
||||
msg->rep->ns_numrrsets = 0;
|
||||
@@ -616,6 +578,7 @@ synth_dname_msg(struct ub_packed_rrset_key* rrset, struct regional* region,
|
||||
packed_rrset_ptr_fixup(newd);
|
||||
newd->rr_ttl[0] = newd->ttl;
|
||||
msg->rep->ttl = newd->ttl;
|
||||
msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(newd->ttl);
|
||||
ldns_write_uint16(newd->rr_data[0], newlen);
|
||||
memmove(newd->rr_data[0] + sizeof(uint16_t), newname, newlen);
|
||||
msg->rep->an_numrrsets ++;
|
||||
@@ -644,7 +607,7 @@ dns_cache_lookup(struct module_env* env,
|
||||
if(e) {
|
||||
struct msgreply_entry* key = (struct msgreply_entry*)e->key;
|
||||
struct reply_info* data = (struct reply_info*)e->data;
|
||||
struct dns_msg* msg = tomsg(env, key, data, region, now,
|
||||
struct dns_msg* msg = tomsg(env, &key->key, data, region, now,
|
||||
scratch);
|
||||
if(msg) {
|
||||
lock_rw_unlock(&e->lock);
|
||||
@@ -668,8 +631,10 @@ dns_cache_lookup(struct module_env* env,
|
||||
lock_rw_unlock(&rrset->entry.lock);
|
||||
}
|
||||
|
||||
/* see if we have CNAME for this domain */
|
||||
if( (rrset=rrset_cache_lookup(env->rrset_cache, qname, qnamelen,
|
||||
/* see if we have CNAME for this domain,
|
||||
* but not for DS records (which are part of the parent) */
|
||||
if( qtype != LDNS_RR_TYPE_DS &&
|
||||
(rrset=rrset_cache_lookup(env->rrset_cache, qname, qnamelen,
|
||||
LDNS_RR_TYPE_CNAME, qclass, 0, now, 0))) {
|
||||
struct dns_msg* msg = rrset_msg(rrset, region, now, &k);
|
||||
if(msg) {
|
||||
@@ -694,7 +659,10 @@ dns_cache_lookup(struct module_env* env,
|
||||
struct packed_rrset_data *d = (struct packed_rrset_data*)
|
||||
rrset->entry.data;
|
||||
if(d->trust != rrset_trust_add_noAA &&
|
||||
d->trust != rrset_trust_add_AA) {
|
||||
d->trust != rrset_trust_add_AA &&
|
||||
(qtype == LDNS_RR_TYPE_DS ||
|
||||
(d->trust != rrset_trust_auth_noAA
|
||||
&& d->trust != rrset_trust_auth_AA) )) {
|
||||
struct dns_msg* msg = rrset_msg(rrset, region, now, &k);
|
||||
if(msg) {
|
||||
lock_rw_unlock(&rrset->entry.lock);
|
||||
@@ -703,12 +671,39 @@ dns_cache_lookup(struct module_env* env,
|
||||
}
|
||||
lock_rw_unlock(&rrset->entry.lock);
|
||||
}
|
||||
|
||||
/* stop downwards cache search on NXDOMAIN.
|
||||
* Empty nonterminals are NOERROR, so an NXDOMAIN for foo
|
||||
* means bla.foo also does not exist. The DNSSEC proofs are
|
||||
* the same. We search upwards for NXDOMAINs. */
|
||||
if(env->cfg->harden_below_nxdomain)
|
||||
while(!dname_is_root(k.qname)) {
|
||||
dname_remove_label(&k.qname, &k.qname_len);
|
||||
h = query_info_hash(&k);
|
||||
e = slabhash_lookup(env->msg_cache, h, &k, 0);
|
||||
if(e) {
|
||||
struct reply_info* data = (struct reply_info*)e->data;
|
||||
struct dns_msg* msg;
|
||||
if(FLAGS_GET_RCODE(data->flags) == LDNS_RCODE_NXDOMAIN
|
||||
&& data->security == sec_status_secure
|
||||
&& (msg=tomsg(env, &k, data, region, now, scratch))){
|
||||
lock_rw_unlock(&e->lock);
|
||||
msg->qinfo.qname=qname;
|
||||
msg->qinfo.qname_len=qnamelen;
|
||||
/* check that DNSSEC really works out */
|
||||
msg->rep->security = sec_status_unchecked;
|
||||
return msg;
|
||||
}
|
||||
lock_rw_unlock(&e->lock);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
dns_cache_store(struct module_env* env, struct query_info* msgqinf,
|
||||
struct reply_info* msgrep, int is_referral)
|
||||
struct reply_info* msgrep, int is_referral, uint32_t leeway)
|
||||
{
|
||||
struct reply_info* rep = NULL;
|
||||
/* alloc, malloc properly (not in region, like msg is) */
|
||||
@@ -717,6 +712,7 @@ dns_cache_store(struct module_env* env, struct query_info* msgqinf,
|
||||
return 0;
|
||||
/* ttl must be relative ;i.e. 0..86400 not time(0)+86400.
|
||||
* the env->now is added to message and RRsets in this routine. */
|
||||
/* the leeway is used to invalidate other rrsets earlier */
|
||||
|
||||
if(is_referral) {
|
||||
/* store rrsets */
|
||||
@@ -729,7 +725,7 @@ dns_cache_store(struct module_env* env, struct query_info* msgqinf,
|
||||
ref.id = rep->rrsets[i]->id;
|
||||
/*ignore ret: it was in the cache, ref updated */
|
||||
(void)rrset_cache_update(env->rrset_cache, &ref,
|
||||
env->alloc, *env->now);
|
||||
env->alloc, *env->now + leeway);
|
||||
}
|
||||
free(rep);
|
||||
return 1;
|
||||
@@ -750,7 +746,7 @@ dns_cache_store(struct module_env* env, struct query_info* msgqinf,
|
||||
rep->flags |= (BIT_RA | BIT_QR);
|
||||
rep->flags &= ~(BIT_AA | BIT_CD);
|
||||
h = query_info_hash(&qinf);
|
||||
dns_cache_store_msg(env, &qinf, h, rep);
|
||||
dns_cache_store_msg(env, &qinf, h, rep, leeway);
|
||||
/* qname is used inside query_info_entrysetup, and set to
|
||||
* NULL. If it has not been used, free it. free(0) is safe. */
|
||||
free(qinf.qname);
|
||||
|
||||
Vendored
+6
-2
@@ -72,10 +72,12 @@ struct dns_msg {
|
||||
* @param is_referral: If true, then the given message to be stored is a
|
||||
* referral. The cache implementation may use this as a hint.
|
||||
* It will store only the RRsets, not the message.
|
||||
* @param leeway: TTL value, if not 0, other rrsets are considered expired
|
||||
* that many seconds before actual TTL expiry.
|
||||
* @return 0 on alloc error (out of memory).
|
||||
*/
|
||||
int dns_cache_store(struct module_env* env, struct query_info* qinf,
|
||||
struct reply_info* rep, int is_referral);
|
||||
struct reply_info* rep, int is_referral, uint32_t leeway);
|
||||
|
||||
/**
|
||||
* Store message in the cache. Stores in message cache and rrset cache.
|
||||
@@ -88,9 +90,11 @@ int dns_cache_store(struct module_env* env, struct query_info* qinf,
|
||||
* @param hash: hash over qinfo.
|
||||
* @param rep: reply info, together with qinfo makes up the message.
|
||||
* Adjusts the reply info TTLs to absolute time.
|
||||
* @param leeway: TTL value, if not 0, other rrsets are considered expired
|
||||
* that many seconds before actual TTL expiry.
|
||||
*/
|
||||
void dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
||||
hashvalue_t hash, struct reply_info* rep);
|
||||
hashvalue_t hash, struct reply_info* rep, uint32_t leeway);
|
||||
|
||||
/**
|
||||
* Find a delegation from the cache.
|
||||
|
||||
Vendored
+108
-24
@@ -39,6 +39,7 @@
|
||||
* This file contains the infrastructure cache.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/rr.h"
|
||||
#include "services/cache/infra.h"
|
||||
#include "util/storage/slabhash.h"
|
||||
#include "util/storage/lookup3.h"
|
||||
@@ -46,6 +47,10 @@
|
||||
#include "util/log.h"
|
||||
#include "util/net_help.h"
|
||||
#include "util/config_file.h"
|
||||
#include "iterator/iterator.h"
|
||||
|
||||
/** Timeout when only a single probe query per IP is allowed. */
|
||||
#define PROBE_MAXRTO 12000 /* in msec */
|
||||
|
||||
size_t
|
||||
infra_host_sizefunc(void* k, void* ATTR_UNUSED(d))
|
||||
@@ -100,6 +105,7 @@ infra_create(struct config_file* cfg)
|
||||
infra->host_ttl = cfg->host_ttl;
|
||||
infra->lame_ttl = cfg->lame_ttl;
|
||||
infra->max_lame_size = cfg->infra_cache_lame_size;
|
||||
infra->jostle = cfg->jostle_time;
|
||||
return infra;
|
||||
}
|
||||
|
||||
@@ -121,6 +127,7 @@ infra_adjust(struct infra_cache* infra, struct config_file* cfg)
|
||||
infra->host_ttl = cfg->host_ttl;
|
||||
infra->lame_ttl = cfg->lame_ttl;
|
||||
infra->max_lame_size = cfg->infra_cache_lame_size;
|
||||
infra->jostle = cfg->jostle_time;
|
||||
maxmem = cfg->infra_cache_numhosts *
|
||||
(sizeof(struct infra_host_key)+sizeof(struct infra_host_data));
|
||||
if(maxmem != slabhash_get_size(infra->hosts) ||
|
||||
@@ -151,6 +158,19 @@ hash_addr(struct sockaddr_storage* addr, socklen_t addrlen)
|
||||
return h;
|
||||
}
|
||||
|
||||
void
|
||||
infra_remove_host(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen)
|
||||
{
|
||||
struct infra_host_key k;
|
||||
k.addrlen = addrlen;
|
||||
memcpy(&k.addr, addr, addrlen);
|
||||
k.entry.hash = hash_addr(addr, addrlen);
|
||||
k.entry.key = (void*)&k;
|
||||
k.entry.data = NULL;
|
||||
slabhash_remove(infra->hosts, k.entry.hash, &k);
|
||||
}
|
||||
|
||||
/** lookup version that does not check host ttl (you check it) */
|
||||
static struct lruhash_entry*
|
||||
infra_lookup_host_nottl(struct infra_cache* infra,
|
||||
@@ -186,6 +206,19 @@ infra_lookup_host(struct infra_cache* infra,
|
||||
return data;
|
||||
}
|
||||
|
||||
/** init the host elements (not lame elems) */
|
||||
static void
|
||||
host_entry_init(struct infra_cache* infra, struct lruhash_entry* e,
|
||||
uint32_t timenow)
|
||||
{
|
||||
struct infra_host_data* data = (struct infra_host_data*)e->data;
|
||||
data->ttl = timenow + infra->host_ttl;
|
||||
rtt_init(&data->rtt);
|
||||
data->edns_version = 0;
|
||||
data->edns_lame_known = 0;
|
||||
data->probedelay = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and init a new entry for a host
|
||||
* @param infra: infra structure with config parameters.
|
||||
@@ -215,12 +248,8 @@ new_host_entry(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
key->entry.data = (void*)data;
|
||||
key->addrlen = addrlen;
|
||||
memcpy(&key->addr, addr, addrlen);
|
||||
data->ttl = tm + infra->host_ttl;
|
||||
data->lameness = NULL;
|
||||
data->edns_version = 0;
|
||||
data->edns_lame_known = 0;
|
||||
data->num_timeouts = 0;
|
||||
rtt_init(&data->rtt);
|
||||
host_entry_init(infra, &key->entry, tm);
|
||||
return &key->entry;
|
||||
}
|
||||
|
||||
@@ -232,19 +261,22 @@ infra_host(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr,
|
||||
addrlen, 0);
|
||||
struct infra_host_data* data;
|
||||
int wr = 0;
|
||||
if(e && ((struct infra_host_data*)e->data)->ttl < timenow) {
|
||||
/* it expired, try to reuse existing entry */
|
||||
int old = ((struct infra_host_data*)e->data)->rtt.rto;
|
||||
lock_rw_unlock(&e->lock);
|
||||
e = infra_lookup_host_nottl(infra, addr, addrlen, 1);
|
||||
if(e) {
|
||||
/* if its still there we have a writelock, init */
|
||||
/* re-initialise */
|
||||
data = (struct infra_host_data*)e->data;
|
||||
data->ttl = timenow + infra->host_ttl;
|
||||
rtt_init(&data->rtt);
|
||||
/* do not touch lameness, it may be valid still */
|
||||
data->edns_version = 0;
|
||||
data->edns_lame_known = 0;
|
||||
host_entry_init(infra, e, timenow);
|
||||
wr = 1;
|
||||
/* TOP_TIMEOUT remains on reuse */
|
||||
if(old >= USEFUL_SERVER_TOP_TIMEOUT)
|
||||
((struct infra_host_data*)e->data)->rtt.rto
|
||||
= USEFUL_SERVER_TOP_TIMEOUT;
|
||||
}
|
||||
}
|
||||
if(!e) {
|
||||
@@ -263,6 +295,22 @@ infra_host(struct infra_cache* infra, struct sockaddr_storage* addr,
|
||||
*to = rtt_timeout(&data->rtt);
|
||||
*edns_vs = data->edns_version;
|
||||
*edns_lame_known = data->edns_lame_known;
|
||||
if(*to >= PROBE_MAXRTO && rtt_notimeout(&data->rtt)*4 <= *to) {
|
||||
/* delay other queries, this is the probe query */
|
||||
if(!wr) {
|
||||
lock_rw_unlock(&e->lock);
|
||||
e = infra_lookup_host_nottl(infra, addr, addrlen, 1);
|
||||
if(!e) { /* flushed from cache real fast, no use to
|
||||
allocate just for the probedelay */
|
||||
return 1;
|
||||
}
|
||||
data = (struct infra_host_data*)e->data;
|
||||
}
|
||||
/* add 999 to round up the timeout value from msec to sec,
|
||||
* then add a whole second so it is certain that this probe
|
||||
* has timed out before the next is allowed */
|
||||
data->probedelay = timenow + ((*to)+1999)/1000;
|
||||
}
|
||||
lock_rw_unlock(&e->lock);
|
||||
return 1;
|
||||
}
|
||||
@@ -450,7 +498,7 @@ infra_update_tcp_works(struct infra_cache* infra,
|
||||
if(data->rtt.rto >= RTT_MAX_TIMEOUT)
|
||||
/* do not disqualify this server altogether, it is better
|
||||
* than nothing */
|
||||
data->rtt.rto = RTT_MAX_TIMEOUT-1;
|
||||
data->rtt.rto = RTT_MAX_TIMEOUT-1000;
|
||||
lock_rw_unlock(&e->lock);
|
||||
}
|
||||
|
||||
@@ -468,17 +516,16 @@ infra_rtt_update(struct infra_cache* infra,
|
||||
if(!(e = new_host_entry(infra, addr, addrlen, timenow)))
|
||||
return 0;
|
||||
needtoinsert = 1;
|
||||
}
|
||||
/* have an entry, update the rtt, and the ttl */
|
||||
} else if(((struct infra_host_data*)e->data)->ttl < timenow) {
|
||||
host_entry_init(infra, e, timenow);
|
||||
}
|
||||
/* have an entry, update the rtt */
|
||||
data = (struct infra_host_data*)e->data;
|
||||
data->ttl = timenow + infra->host_ttl;
|
||||
if(roundtrip == -1) {
|
||||
rtt_lost(&data->rtt, orig_rtt);
|
||||
if(data->num_timeouts<255)
|
||||
data->num_timeouts++;
|
||||
} else {
|
||||
rtt_update(&data->rtt, roundtrip);
|
||||
data->num_timeouts = 0;
|
||||
data->probedelay = 0;
|
||||
}
|
||||
if(data->rtt.rto > 0)
|
||||
rto = data->rtt.rto;
|
||||
@@ -489,6 +536,27 @@ infra_rtt_update(struct infra_cache* infra,
|
||||
return rto;
|
||||
}
|
||||
|
||||
int infra_get_host_rto(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
struct rtt_info* rtt, int* delay, uint32_t timenow)
|
||||
{
|
||||
struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr,
|
||||
addrlen, 0);
|
||||
struct infra_host_data* data;
|
||||
int ttl = -2;
|
||||
if(!e) return -1;
|
||||
data = (struct infra_host_data*)e->data;
|
||||
if(data->ttl >= timenow) {
|
||||
ttl = (int)(data->ttl - timenow);
|
||||
memmove(rtt, &data->rtt, sizeof(*rtt));
|
||||
if(timenow < data->probedelay)
|
||||
*delay = (int)(data->probedelay - timenow);
|
||||
else *delay = 0;
|
||||
}
|
||||
lock_rw_unlock(&e->lock);
|
||||
return ttl;
|
||||
}
|
||||
|
||||
int
|
||||
infra_edns_update(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
@@ -502,12 +570,17 @@ infra_edns_update(struct infra_cache* infra,
|
||||
if(!(e = new_host_entry(infra, addr, addrlen, timenow)))
|
||||
return 0;
|
||||
needtoinsert = 1;
|
||||
}
|
||||
} else if(((struct infra_host_data*)e->data)->ttl < timenow) {
|
||||
host_entry_init(infra, e, timenow);
|
||||
}
|
||||
/* have an entry, update the rtt, and the ttl */
|
||||
data = (struct infra_host_data*)e->data;
|
||||
data->ttl = timenow + infra->host_ttl;
|
||||
data->edns_version = edns_version;
|
||||
data->edns_lame_known = 1;
|
||||
/* do not update if noEDNS and stored is yesEDNS */
|
||||
if(!(edns_version == -1 && (data->edns_version != -1 &&
|
||||
data->edns_lame_known))) {
|
||||
data->edns_version = edns_version;
|
||||
data->edns_lame_known = 1;
|
||||
}
|
||||
|
||||
if(needtoinsert)
|
||||
slabhash_insert(infra->hosts, e->hash, e, e->data, NULL);
|
||||
@@ -519,8 +592,7 @@ int
|
||||
infra_get_lame_rtt(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype,
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, int* lost,
|
||||
uint32_t timenow)
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, uint32_t timenow)
|
||||
{
|
||||
struct infra_host_data* host;
|
||||
struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr,
|
||||
@@ -530,7 +602,10 @@ infra_get_lame_rtt(struct infra_cache* infra,
|
||||
return 0;
|
||||
host = (struct infra_host_data*)e->data;
|
||||
*rtt = rtt_unclamped(&host->rtt);
|
||||
*lost = (int)host->num_timeouts;
|
||||
if(host->rtt.rto >= PROBE_MAXRTO && timenow < host->probedelay
|
||||
&& rtt_notimeout(&host->rtt)*4 <= host->rtt.rto)
|
||||
/* single probe for this domain, and we are not probing */
|
||||
*rtt = USEFUL_SERVER_TOP_TIMEOUT;
|
||||
/* check lameness first, if so, ttl on host does not matter anymore */
|
||||
if(infra_lookup_lame(host, name, namelen, timenow,
|
||||
&dlm, &rlm, &alm, &olm)) {
|
||||
@@ -565,6 +640,15 @@ infra_get_lame_rtt(struct infra_cache* infra,
|
||||
*dnsseclame = 0;
|
||||
*reclame = 0;
|
||||
if(timenow > host->ttl) {
|
||||
/* expired entry */
|
||||
/* see if this can be a re-probe of an unresponsive server */
|
||||
/* minus 1000 because that is outside of the RTTBAND, so
|
||||
* blacklisted servers stay blacklisted if this is chosen */
|
||||
if(host->rtt.rto >= USEFUL_SERVER_TOP_TIMEOUT) {
|
||||
*rtt = USEFUL_SERVER_TOP_TIMEOUT-1000;
|
||||
lock_rw_unlock(&e->lock);
|
||||
return 1;
|
||||
}
|
||||
lock_rw_unlock(&e->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Vendored
+28
-6
@@ -64,6 +64,8 @@ struct infra_host_key {
|
||||
struct infra_host_data {
|
||||
/** TTL value for this entry. absolute time. */
|
||||
uint32_t ttl;
|
||||
/** time in seconds (absolute) when probing re-commences, 0 disabled */
|
||||
uint32_t probedelay;
|
||||
/** round trip times for timeout calculation */
|
||||
struct rtt_info rtt;
|
||||
/** Names of the zones that are lame. NULL=no lame zones. */
|
||||
@@ -74,8 +76,6 @@ struct infra_host_data {
|
||||
* EDNS lame is when EDNS queries or replies are dropped,
|
||||
* and cause a timeout */
|
||||
uint8_t edns_lame_known;
|
||||
/** Number of consequtive timeouts; reset when reply arrives OK. */
|
||||
uint8_t num_timeouts;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -120,6 +120,8 @@ struct infra_cache {
|
||||
int lame_ttl;
|
||||
/** infra lame cache max memory per host, in bytes */
|
||||
size_t max_lame_size;
|
||||
/** jostle timeout in msec */
|
||||
size_t jostle;
|
||||
};
|
||||
|
||||
/** infra host cache default hash lookup size */
|
||||
@@ -140,6 +142,10 @@ struct infra_cache* infra_create(struct config_file* cfg);
|
||||
*/
|
||||
void infra_delete(struct infra_cache* infra);
|
||||
|
||||
/** explicitly delete an infra host element */
|
||||
void infra_remove_host(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen);
|
||||
|
||||
/**
|
||||
* Adjust infra cache to use updated configuration settings.
|
||||
* This may clean the cache. Operates a bit like realloc.
|
||||
@@ -169,6 +175,8 @@ struct infra_host_data* infra_lookup_host(struct infra_cache* infra,
|
||||
* Find host information to send a packet. Creates new entry if not found.
|
||||
* Lameness is empty. EDNS is 0 (try with first), and rtt is returned for
|
||||
* the first message to it.
|
||||
* Use this to send a packet only, because it also locks out others when
|
||||
* probing is restricted.
|
||||
* @param infra: infrastructure cache.
|
||||
* @param addr: host address.
|
||||
* @param addrlen: length of addr.
|
||||
@@ -251,6 +259,7 @@ void infra_update_tcp_works(struct infra_cache* infra,
|
||||
* @param addr: host address.
|
||||
* @param addrlen: length of addr.
|
||||
* @param edns_version: the version that it publishes.
|
||||
* If it is known to support EDNS then no-EDNS is not stored over it.
|
||||
* @param timenow: what time it is now.
|
||||
* @return: 0 on error.
|
||||
*/
|
||||
@@ -260,6 +269,7 @@ int infra_edns_update(struct infra_cache* infra,
|
||||
|
||||
/**
|
||||
* Get Lameness information and average RTT if host is in the cache.
|
||||
* This information is to be used for server selection.
|
||||
* @param infra: infrastructure cache.
|
||||
* @param addr: host address.
|
||||
* @param addrlen: length of addr.
|
||||
@@ -272,16 +282,28 @@ int infra_edns_update(struct infra_cache* infra,
|
||||
* @param reclame: if function returns true, this is if it is recursion lame.
|
||||
* @param rtt: if function returns true, this returns avg rtt of the server.
|
||||
* The rtt value is unclamped and reflects recent timeouts.
|
||||
* @param lost: number of queries lost in a row. Reset to 0 when an answer
|
||||
* gets back. Gives a connectivity number.
|
||||
* @param timenow: what time it is now.
|
||||
* @return if found in cache, or false if not (or TTL bad).
|
||||
*/
|
||||
int infra_get_lame_rtt(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype,
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, int* lost,
|
||||
uint32_t timenow);
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, uint32_t timenow);
|
||||
|
||||
/**
|
||||
* Get additional (debug) info on timing.
|
||||
* @param infra: infra cache.
|
||||
* @param addr: host address.
|
||||
* @param addrlen: length of addr.
|
||||
* @param rtt: the rtt_info is copied into here (caller alloced return struct).
|
||||
* @param delay: probe delay (if any).
|
||||
* @param timenow: what time it is now.
|
||||
* @return TTL the infra host element is valid for. If -1: not found in cache.
|
||||
* TTL -2: found but expired.
|
||||
*/
|
||||
int infra_get_host_rto(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
struct rtt_info* rtt, int* delay, uint32_t timenow);
|
||||
|
||||
/**
|
||||
* Get memory used by the infra cache.
|
||||
|
||||
Vendored
+27
-9
@@ -120,7 +120,7 @@ rrset_cache_touch(struct rrset_cache* r, struct ub_packed_rrset_key* key,
|
||||
|
||||
/** see if rrset needs to be updated in the cache */
|
||||
static int
|
||||
need_to_update_rrset(void* nd, void* cd, uint32_t timenow, int equal)
|
||||
need_to_update_rrset(void* nd, void* cd, uint32_t timenow, int equal, int ns)
|
||||
{
|
||||
struct packed_rrset_data* newd = (struct packed_rrset_data*)nd;
|
||||
struct packed_rrset_data* cached = (struct packed_rrset_data*)cd;
|
||||
@@ -145,10 +145,22 @@ need_to_update_rrset(void* nd, void* cd, uint32_t timenow, int equal)
|
||||
/* o item in cache has expired */
|
||||
if( cached->ttl < timenow )
|
||||
return 1;
|
||||
/* o same trust, but different in data - insert it */
|
||||
if( newd->trust == cached->trust && !equal )
|
||||
return 1;
|
||||
return 0;
|
||||
/* o same trust, but different in data - insert it */
|
||||
if( newd->trust == cached->trust && !equal ) {
|
||||
/* if this is type NS, do not 'stick' to owner that changes
|
||||
* the NS RRset, but use the old TTL for the new data, and
|
||||
* update to fetch the latest data. ttl is not expired, because
|
||||
* that check was before this one. */
|
||||
if(ns) {
|
||||
size_t i;
|
||||
newd->ttl = cached->ttl;
|
||||
for(i=0; i<(newd->count+newd->rrsig_count); i++)
|
||||
if(newd->rr_ttl[i] > newd->ttl)
|
||||
newd->rr_ttl[i] = newd->ttl;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Update RRSet special key ID */
|
||||
@@ -191,7 +203,7 @@ rrset_cache_update(struct rrset_cache* r, struct rrset_ref* ref,
|
||||
equal = rrsetdata_equal((struct packed_rrset_data*)k->entry.
|
||||
data, (struct packed_rrset_data*)e->data);
|
||||
if(!need_to_update_rrset(k->entry.data, e->data, timenow,
|
||||
equal)) {
|
||||
equal, (rrset_type==LDNS_RR_TYPE_NS))) {
|
||||
/* cache is superior, return that value */
|
||||
lock_rw_unlock(&e->lock);
|
||||
ub_packed_rrset_parsedelete(k, alloc);
|
||||
@@ -338,9 +350,15 @@ rrset_update_sec_status(struct rrset_cache* r,
|
||||
if(updata->trust > cachedata->trust)
|
||||
cachedata->trust = updata->trust;
|
||||
cachedata->security = updata->security;
|
||||
cachedata->ttl = updata->ttl + now;
|
||||
for(i=0; i<cachedata->count+cachedata->rrsig_count; i++)
|
||||
cachedata->rr_ttl[i] = updata->rr_ttl[i]+now;
|
||||
/* for NS records only shorter TTLs, other types: update it */
|
||||
if(ntohs(rrset->rk.type) != LDNS_RR_TYPE_NS ||
|
||||
updata->ttl+now < cachedata->ttl ||
|
||||
cachedata->ttl < now ||
|
||||
updata->security == sec_status_bogus) {
|
||||
cachedata->ttl = updata->ttl + now;
|
||||
for(i=0; i<cachedata->count+cachedata->rrsig_count; i++)
|
||||
cachedata->rr_ttl[i] = updata->rr_ttl[i]+now;
|
||||
}
|
||||
}
|
||||
lock_rw_unlock(&e->lock);
|
||||
}
|
||||
|
||||
+113
-61
@@ -39,6 +39,10 @@
|
||||
* This file has functions to get queries from clients.
|
||||
*/
|
||||
#include "config.h"
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include "services/listen_dnsport.h"
|
||||
#include "services/outside_network.h"
|
||||
#include "util/netevent.h"
|
||||
@@ -46,9 +50,6 @@
|
||||
#include "util/config_file.h"
|
||||
#include "util/net_help.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
@@ -89,7 +90,8 @@ verbose_print_addr(struct addrinfo *addr)
|
||||
|
||||
int
|
||||
create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
socklen_t addrlen, int v6only, int* inuse, int* noproto, int rcv)
|
||||
socklen_t addrlen, int v6only, int* inuse, int* noproto,
|
||||
int rcv, int snd)
|
||||
{
|
||||
int s;
|
||||
#if defined(IPV6_USE_MIN_MTU)
|
||||
@@ -101,6 +103,9 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
#if !defined(SO_RCVBUFFORCE) && !defined(SO_RCVBUF)
|
||||
(void)rcv;
|
||||
#endif
|
||||
#if !defined(SO_SNDBUFFORCE) && !defined(SO_SNDBUF)
|
||||
(void)snd;
|
||||
#endif
|
||||
#ifndef IPV6_V6ONLY
|
||||
(void)v6only;
|
||||
#endif
|
||||
@@ -181,6 +186,65 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
}
|
||||
# endif
|
||||
#endif /* SO_RCVBUF */
|
||||
}
|
||||
/* first do RCVBUF as the receive buffer is more important */
|
||||
if(snd) {
|
||||
#ifdef SO_SNDBUF
|
||||
int got;
|
||||
socklen_t slen = (socklen_t)sizeof(got);
|
||||
# ifdef SO_SNDBUFFORCE
|
||||
/* Linux specific: try to use root permission to override
|
||||
* system limits on sndbuf. The limit is stored in
|
||||
* /proc/sys/net/core/wmem_max or sysctl net.core.wmem_max */
|
||||
if(setsockopt(s, SOL_SOCKET, SO_SNDBUFFORCE, (void*)&snd,
|
||||
(socklen_t)sizeof(snd)) < 0) {
|
||||
if(errno != EPERM) {
|
||||
# ifndef USE_WINSOCK
|
||||
log_err("setsockopt(..., SO_SNDBUFFORCE, "
|
||||
"...) failed: %s", strerror(errno));
|
||||
close(s);
|
||||
# else
|
||||
log_err("setsockopt(..., SO_SNDBUFFORCE, "
|
||||
"...) failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
closesocket(s);
|
||||
# endif
|
||||
*noproto = 0;
|
||||
*inuse = 0;
|
||||
return -1;
|
||||
}
|
||||
# endif /* SO_SNDBUFFORCE */
|
||||
if(setsockopt(s, SOL_SOCKET, SO_SNDBUF, (void*)&snd,
|
||||
(socklen_t)sizeof(snd)) < 0) {
|
||||
# ifndef USE_WINSOCK
|
||||
log_err("setsockopt(..., SO_SNDBUF, "
|
||||
"...) failed: %s", strerror(errno));
|
||||
close(s);
|
||||
# else
|
||||
log_err("setsockopt(..., SO_SNDBUF, "
|
||||
"...) failed: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
closesocket(s);
|
||||
# endif
|
||||
*noproto = 0;
|
||||
*inuse = 0;
|
||||
return -1;
|
||||
}
|
||||
/* check if we got the right thing or if system
|
||||
* reduced to some system max. Warn if so */
|
||||
if(getsockopt(s, SOL_SOCKET, SO_SNDBUF, (void*)&got,
|
||||
&slen) >= 0 && got < snd/2) {
|
||||
log_warn("so-sndbuf %u was not granted. "
|
||||
"Got %u. To fix: start with "
|
||||
"root permissions(linux) or sysctl "
|
||||
"bigger net.core.wmem_max(linux) or "
|
||||
"kern.ipc.maxsockbuf(bsd) values.",
|
||||
(unsigned)snd, (unsigned)got);
|
||||
}
|
||||
# ifdef SO_SNDBUFFORCE
|
||||
}
|
||||
# endif
|
||||
#endif /* SO_SNDBUF */
|
||||
}
|
||||
if(family == AF_INET6) {
|
||||
# if defined(IPV6_V6ONLY)
|
||||
@@ -279,15 +343,21 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
/* detect freebsd jail with no ipv6 permission */
|
||||
if(family==AF_INET6 && errno==EINVAL)
|
||||
*noproto = 1;
|
||||
else if(errno != EADDRINUSE)
|
||||
else if(errno != EADDRINUSE) {
|
||||
log_err("can't bind socket: %s", strerror(errno));
|
||||
log_addr(0, "failed address",
|
||||
(struct sockaddr_storage*)addr, addrlen);
|
||||
}
|
||||
#endif /* EADDRINUSE */
|
||||
close(s);
|
||||
#else /* USE_WINSOCK */
|
||||
if(WSAGetLastError() != WSAEADDRINUSE &&
|
||||
WSAGetLastError() != WSAEADDRNOTAVAIL)
|
||||
WSAGetLastError() != WSAEADDRNOTAVAIL) {
|
||||
log_err("can't bind socket: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
log_addr(0, "failed address",
|
||||
(struct sockaddr_storage*)addr, addrlen);
|
||||
}
|
||||
closesocket(s);
|
||||
#endif
|
||||
return -1;
|
||||
@@ -367,10 +437,18 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto)
|
||||
/* detect freebsd jail with no ipv6 permission */
|
||||
if(addr->ai_family==AF_INET6 && errno==EINVAL)
|
||||
*noproto = 1;
|
||||
else log_err("can't bind socket: %s", strerror(errno));
|
||||
else {
|
||||
log_err("can't bind socket: %s", strerror(errno));
|
||||
log_addr(0, "failed address",
|
||||
(struct sockaddr_storage*)addr->ai_addr,
|
||||
addr->ai_addrlen);
|
||||
}
|
||||
#else
|
||||
log_err("can't bind socket: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
log_addr(0, "failed address",
|
||||
(struct sockaddr_storage*)addr->ai_addr,
|
||||
addr->ai_addrlen);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
@@ -393,7 +471,7 @@ create_tcp_accept_sock(struct addrinfo *addr, int v6only, int* noproto)
|
||||
*/
|
||||
static int
|
||||
make_sock(int stype, const char* ifname, const char* port,
|
||||
struct addrinfo *hints, int v6only, int* noip6, size_t rcv)
|
||||
struct addrinfo *hints, int v6only, int* noip6, size_t rcv, size_t snd)
|
||||
{
|
||||
struct addrinfo *res = NULL;
|
||||
int r, s, inuse, noproto;
|
||||
@@ -419,8 +497,8 @@ make_sock(int stype, const char* ifname, const char* port,
|
||||
if(stype == SOCK_DGRAM) {
|
||||
verbose_print_addr(res);
|
||||
s = create_udp_sock(res->ai_family, res->ai_socktype,
|
||||
(struct sockaddr*)res->ai_addr,
|
||||
res->ai_addrlen, v6only, &inuse, &noproto, (int)rcv);
|
||||
(struct sockaddr*)res->ai_addr, res->ai_addrlen,
|
||||
v6only, &inuse, &noproto, (int)rcv, (int)snd);
|
||||
if(s == -1 && inuse) {
|
||||
log_err("bind: address already in use");
|
||||
} else if(s == -1 && noproto && hints->ai_family == AF_INET6){
|
||||
@@ -439,7 +517,7 @@ make_sock(int stype, const char* ifname, const char* port,
|
||||
/** make socket and first see if ifname contains port override info */
|
||||
static int
|
||||
make_sock_port(int stype, const char* ifname, const char* port,
|
||||
struct addrinfo *hints, int v6only, int* noip6, size_t rcv)
|
||||
struct addrinfo *hints, int v6only, int* noip6, size_t rcv, size_t snd)
|
||||
{
|
||||
char* s = strchr(ifname, '@');
|
||||
if(s) {
|
||||
@@ -460,9 +538,10 @@ make_sock_port(int stype, const char* ifname, const char* port,
|
||||
newif[s-ifname] = 0;
|
||||
strncpy(p, s+1, sizeof(p));
|
||||
p[strlen(s+1)]=0;
|
||||
return make_sock(stype, newif, p, hints, v6only, noip6, rcv);
|
||||
return make_sock(stype, newif, p, hints, v6only, noip6,
|
||||
rcv, snd);
|
||||
}
|
||||
return make_sock(stype, ifname, port, hints, v6only, noip6, rcv);
|
||||
return make_sock(stype, ifname, port, hints, v6only, noip6, rcv, snd);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,7 +569,7 @@ port_insert(struct listen_port** list, int s, enum listen_type ftype)
|
||||
static int
|
||||
set_recvpktinfo(int s, int family)
|
||||
{
|
||||
#if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) || defined(IP_RECVDSTADDR) || defined(IP_PKTINFO)
|
||||
#if defined(IPV6_RECVPKTINFO) || defined(IPV6_PKTINFO) || (defined(IP_RECVDSTADDR) && defined(IP_SENDSRCADDR)) || defined(IP_PKTINFO)
|
||||
int on = 1;
|
||||
#else
|
||||
(void)s;
|
||||
@@ -517,22 +596,22 @@ set_recvpktinfo(int s, int family)
|
||||
# endif /* defined IPV6_RECVPKTINFO */
|
||||
|
||||
} else if(family == AF_INET) {
|
||||
# ifdef IP_RECVDSTADDR
|
||||
if(setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR,
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
log_err("setsockopt(..., IP_RECVDSTADDR, ...) failed: %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
# elif defined(IP_PKTINFO)
|
||||
# ifdef IP_PKTINFO
|
||||
if(setsockopt(s, IPPROTO_IP, IP_PKTINFO,
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
log_err("setsockopt(..., IP_PKTINFO, ...) failed: %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
# elif defined(IP_RECVDSTADDR) && defined(IP_SENDSRCADDR)
|
||||
if(setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR,
|
||||
(void*)&on, (socklen_t)sizeof(on)) < 0) {
|
||||
log_err("setsockopt(..., IP_RECVDSTADDR, ...) failed: %s",
|
||||
strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
# else
|
||||
log_err("no IP_RECVDSTADDR or IP_PKTINFO option, please disable "
|
||||
log_err("no IP_SENDSRCADDR or IP_PKTINFO option, please disable "
|
||||
"interface-automatic in config");
|
||||
return 0;
|
||||
# endif /* IP_PKTINFO */
|
||||
@@ -552,19 +631,20 @@ set_recvpktinfo(int s, int family)
|
||||
* @param port: Port number to use (as string).
|
||||
* @param list: list of open ports, appended to, changed to point to list head.
|
||||
* @param rcv: receive buffer size for UDP
|
||||
* @param snd: send buffer size for UDP
|
||||
* @return: returns false on error.
|
||||
*/
|
||||
static int
|
||||
ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp,
|
||||
struct addrinfo *hints, const char* port, struct listen_port** list,
|
||||
size_t rcv)
|
||||
size_t rcv, size_t snd)
|
||||
{
|
||||
int s, noip6=0;
|
||||
if(!do_udp && !do_tcp)
|
||||
return 0;
|
||||
if(do_auto) {
|
||||
if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1,
|
||||
&noip6, rcv)) == -1) {
|
||||
&noip6, rcv, snd)) == -1) {
|
||||
if(noip6) {
|
||||
log_warn("IPv6 protocol not available");
|
||||
return 1;
|
||||
@@ -585,7 +665,7 @@ ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp,
|
||||
} else if(do_udp) {
|
||||
/* regular udp socket */
|
||||
if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1,
|
||||
&noip6, rcv)) == -1) {
|
||||
&noip6, rcv, snd)) == -1) {
|
||||
if(noip6) {
|
||||
log_warn("IPv6 protocol not available");
|
||||
return 1;
|
||||
@@ -603,7 +683,7 @@ ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp,
|
||||
}
|
||||
if(do_tcp) {
|
||||
if((s = make_sock_port(SOCK_STREAM, ifname, port, hints, 1,
|
||||
&noip6, 0)) == -1) {
|
||||
&noip6, 0, 0)) == -1) {
|
||||
if(noip6) {
|
||||
/*log_warn("IPv6 protocol not available");*/
|
||||
return 1;
|
||||
@@ -714,32 +794,6 @@ listen_delete(struct listen_dnsport* front)
|
||||
free(front);
|
||||
}
|
||||
|
||||
void listen_pushback(struct listen_dnsport* listen)
|
||||
{
|
||||
struct listen_list *p;
|
||||
log_assert(listen);
|
||||
for(p = listen->cps; p; p = p->next)
|
||||
{
|
||||
if(p->com->type != comm_udp &&
|
||||
p->com->type != comm_tcp_accept)
|
||||
continue;
|
||||
comm_point_stop_listening(p->com);
|
||||
}
|
||||
}
|
||||
|
||||
void listen_resume(struct listen_dnsport* listen)
|
||||
{
|
||||
struct listen_list *p;
|
||||
log_assert(listen);
|
||||
for(p = listen->cps; p; p = p->next)
|
||||
{
|
||||
if(p->com->type != comm_udp &&
|
||||
p->com->type != comm_tcp_accept)
|
||||
continue;
|
||||
comm_point_start_listening(p->com, -1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
struct listen_port*
|
||||
listening_ports_open(struct config_file* cfg)
|
||||
{
|
||||
@@ -769,17 +823,14 @@ listening_ports_open(struct config_file* cfg)
|
||||
if(!do_ip4 && !do_ip6) {
|
||||
return NULL;
|
||||
}
|
||||
if(do_auto && (!do_ip4 || !do_ip6)) {
|
||||
log_warn("interface_automatic option does not work when either do-ip4 or do-ip6 is not enabled. Disabling option.");
|
||||
do_auto = 0;
|
||||
}
|
||||
/* create ip4 and ip6 ports so that return addresses are nice. */
|
||||
if(do_auto || cfg->num_ifs == 0) {
|
||||
if(do_ip6) {
|
||||
hints.ai_family = AF_INET6;
|
||||
if(!ports_create_if(do_auto?"::0":"::1",
|
||||
do_auto, cfg->do_udp, do_tcp,
|
||||
&hints, portbuf, &list, cfg->socket_rcvbuf)) {
|
||||
&hints, portbuf, &list,
|
||||
cfg->so_rcvbuf, cfg->so_sndbuf)) {
|
||||
listening_ports_free(list);
|
||||
return NULL;
|
||||
}
|
||||
@@ -788,7 +839,8 @@ listening_ports_open(struct config_file* cfg)
|
||||
hints.ai_family = AF_INET;
|
||||
if(!ports_create_if(do_auto?"0.0.0.0":"127.0.0.1",
|
||||
do_auto, cfg->do_udp, do_tcp,
|
||||
&hints, portbuf, &list, cfg->socket_rcvbuf)) {
|
||||
&hints, portbuf, &list,
|
||||
cfg->so_rcvbuf, cfg->so_sndbuf)) {
|
||||
listening_ports_free(list);
|
||||
return NULL;
|
||||
}
|
||||
@@ -800,7 +852,7 @@ listening_ports_open(struct config_file* cfg)
|
||||
hints.ai_family = AF_INET6;
|
||||
if(!ports_create_if(cfg->ifs[i], 0, cfg->do_udp,
|
||||
do_tcp, &hints, portbuf, &list,
|
||||
cfg->socket_rcvbuf)) {
|
||||
cfg->so_rcvbuf, cfg->so_sndbuf)) {
|
||||
listening_ports_free(list);
|
||||
return NULL;
|
||||
}
|
||||
@@ -810,7 +862,7 @@ listening_ports_open(struct config_file* cfg)
|
||||
hints.ai_family = AF_INET;
|
||||
if(!ports_create_if(cfg->ifs[i], 0, cfg->do_udp,
|
||||
do_tcp, &hints, portbuf, &list,
|
||||
cfg->socket_rcvbuf)) {
|
||||
cfg->so_rcvbuf, cfg->so_sndbuf)) {
|
||||
listening_ports_free(list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -130,25 +130,6 @@ struct listen_dnsport* listen_create(struct comm_base* base,
|
||||
struct listen_port* ports, size_t bufsize, int tcp_accept_count,
|
||||
comm_point_callback_t* cb, void* cb_arg);
|
||||
|
||||
/**
|
||||
* Stop listening to the dnsports. Ports are still open but not checked
|
||||
* for readability - performs pushback of the load.
|
||||
* @param listen: the listening structs to stop listening on. Note that
|
||||
* udp and tcp-accept handlers stop, but ongoing tcp-handlers are kept
|
||||
* going, since its rude to 'reset connection by peer' them, instead,
|
||||
* we keep them and the callback will be called when its ready. It can
|
||||
* be dropped at that time. New tcp and udp queries can be served by
|
||||
* other threads.
|
||||
*/
|
||||
void listen_pushback(struct listen_dnsport* listen);
|
||||
|
||||
/**
|
||||
* Start listening again to the dnsports.
|
||||
* Call after the listen_pushback has been called.
|
||||
* @param listen: the listening structs to stop listening on.
|
||||
*/
|
||||
void listen_resume(struct listen_dnsport* listen);
|
||||
|
||||
/**
|
||||
* delete the listening structure
|
||||
* @param listen: listening structure.
|
||||
@@ -181,10 +162,12 @@ size_t listen_get_mem(struct listen_dnsport* listen);
|
||||
* @param noproto: on error, this is set true if cause is that the
|
||||
IPv6 proto (family) is not available.
|
||||
* @param rcv: set size on rcvbuf with socket option, if 0 it is not set.
|
||||
* @param snd: set size on sndbuf with socket option, if 0 it is not set.
|
||||
* @return: the socket. -1 on error.
|
||||
*/
|
||||
int create_udp_sock(int family, int socktype, struct sockaddr* addr,
|
||||
socklen_t addrlen, int v6only, int* inuse, int* noproto, int rcv);
|
||||
socklen_t addrlen, int v6only, int* inuse, int* noproto, int rcv,
|
||||
int snd);
|
||||
|
||||
/**
|
||||
* Create and bind TCP listening socket
|
||||
|
||||
+35
-6
@@ -39,6 +39,8 @@
|
||||
* This file contains functions to enable local zone authority service.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/dname.h"
|
||||
#include "ldns/host2wire.h"
|
||||
#include "services/localzone.h"
|
||||
#include "util/regional.h"
|
||||
#include "util/config_file.h"
|
||||
@@ -50,7 +52,7 @@
|
||||
#include "util/data/msgparse.h"
|
||||
|
||||
struct local_zones*
|
||||
local_zones_create()
|
||||
local_zones_create(void)
|
||||
{
|
||||
struct local_zones* zones = (struct local_zones*)calloc(1,
|
||||
sizeof(*zones));
|
||||
@@ -288,7 +290,7 @@ get_rr_nameclass(const char* str, uint8_t** nm, uint16_t* dclass)
|
||||
* @param type: type to look for (host order).
|
||||
* @return rrset pointer or NULL if not found.
|
||||
*/
|
||||
struct local_rrset*
|
||||
static struct local_rrset*
|
||||
local_data_find_type(struct local_data* data, uint16_t type)
|
||||
{
|
||||
struct local_rrset* p;
|
||||
@@ -610,6 +612,8 @@ lz_enter_defaults(struct local_zones* zones, struct config_file* cfg,
|
||||
{
|
||||
struct local_zone* z;
|
||||
|
||||
/* this list of zones is from RFC 6303 */
|
||||
|
||||
/* localhost. zone */
|
||||
if(!lz_exists(zones, "localhost.") &&
|
||||
!lz_nodefault(cfg, "localhost.")) {
|
||||
@@ -687,6 +691,8 @@ lz_enter_defaults(struct local_zones* zones, struct config_file* cfg,
|
||||
!add_as112_default(zones, cfg, buf, "0.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "254.169.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "2.0.192.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "100.51.198.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "113.0.203.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "255.255.255.255.in-addr.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.") ||
|
||||
!add_as112_default(zones, cfg, buf, "d.f.ip6.arpa.") ||
|
||||
@@ -963,6 +969,10 @@ void local_zones_print(struct local_zones* zones)
|
||||
log_nametypeclass(0, "transparent zone",
|
||||
z->name, 0, z->dclass);
|
||||
break;
|
||||
case local_zone_typetransparent:
|
||||
log_nametypeclass(0, "typetransparent zone",
|
||||
z->name, 0, z->dclass);
|
||||
break;
|
||||
case local_zone_static:
|
||||
log_nametypeclass(0, "static zone",
|
||||
z->name, 0, z->dclass);
|
||||
@@ -1038,10 +1048,10 @@ local_data_answer(struct local_zone* z, struct query_info* qinfo,
|
||||
if(!lr)
|
||||
return 0;
|
||||
if(z->type == local_zone_redirect) {
|
||||
/* convert rrset name to zone name; like a wildcard */
|
||||
/* convert rrset name to query name; like a wildcard */
|
||||
struct ub_packed_rrset_key r = *lr->rrset;
|
||||
r.rk.dname = z->name;
|
||||
r.rk.dname_len = z->namelen;
|
||||
r.rk.dname = qinfo->qname;
|
||||
r.rk.dname_len = qinfo->qname_len;
|
||||
return local_encode(qinfo, edns, buf, temp, &r, 1,
|
||||
LDNS_RCODE_NOERROR);
|
||||
}
|
||||
@@ -1091,7 +1101,10 @@ lz_zone_answer(struct local_zone* z, struct query_info* qinfo,
|
||||
*(uint16_t*)ldns_buffer_begin(buf),
|
||||
ldns_buffer_read_u16_at(buf, 2), edns);
|
||||
return 1;
|
||||
}
|
||||
} else if(z->type == local_zone_typetransparent) {
|
||||
/* no NODATA or NXDOMAINS for this zone type */
|
||||
return 0;
|
||||
}
|
||||
/* else z->type == local_zone_transparent */
|
||||
|
||||
/* if the zone is transparent and the name exists, but the type
|
||||
@@ -1141,6 +1154,20 @@ local_zones_answer(struct local_zones* zones, struct query_info* qinfo,
|
||||
return r;
|
||||
}
|
||||
|
||||
const char* local_zone_type2str(enum localzone_type t)
|
||||
{
|
||||
switch(t) {
|
||||
case local_zone_deny: return "deny";
|
||||
case local_zone_refuse: return "refuse";
|
||||
case local_zone_redirect: return "redirect";
|
||||
case local_zone_transparent: return "transparent";
|
||||
case local_zone_typetransparent: return "typetransparent";
|
||||
case local_zone_static: return "static";
|
||||
case local_zone_nodefault: return "nodefault";
|
||||
}
|
||||
return "badtyped";
|
||||
}
|
||||
|
||||
int local_zone_str2type(const char* type, enum localzone_type* t)
|
||||
{
|
||||
if(strcmp(type, "deny") == 0)
|
||||
@@ -1151,6 +1178,8 @@ int local_zone_str2type(const char* type, enum localzone_type* t)
|
||||
*t = local_zone_static;
|
||||
else if(strcmp(type, "transparent") == 0)
|
||||
*t = local_zone_transparent;
|
||||
else if(strcmp(type, "typetransparent") == 0)
|
||||
*t = local_zone_typetransparent;
|
||||
else if(strcmp(type, "redirect") == 0)
|
||||
*t = local_zone_redirect;
|
||||
else return 0;
|
||||
|
||||
+11
-1
@@ -63,6 +63,8 @@ enum localzone_type {
|
||||
local_zone_static,
|
||||
/** resolve normally */
|
||||
local_zone_transparent,
|
||||
/** do not block types at localdata names */
|
||||
local_zone_typetransparent,
|
||||
/** answer with data at zone apex */
|
||||
local_zone_redirect,
|
||||
/** remove default AS112 blocking contents for zone
|
||||
@@ -149,7 +151,7 @@ struct local_rrset {
|
||||
* Create local zones storage
|
||||
* @return new struct or NULL on error.
|
||||
*/
|
||||
struct local_zones* local_zones_create();
|
||||
struct local_zones* local_zones_create(void);
|
||||
|
||||
/**
|
||||
* Delete local zones storage
|
||||
@@ -233,6 +235,14 @@ int local_zones_answer(struct local_zones* zones, struct query_info* qinfo,
|
||||
*/
|
||||
int local_zone_str2type(const char* str, enum localzone_type* t);
|
||||
|
||||
/**
|
||||
* Print localzone type to a string. Pointer to a constant string.
|
||||
*
|
||||
* @param t: local zone type.
|
||||
* @return constant string that describes type.
|
||||
*/
|
||||
const char* local_zone_type2str(enum localzone_type t);
|
||||
|
||||
/**
|
||||
* Find zone that with exactly given name, class.
|
||||
* User must lock the tree or result zone.
|
||||
|
||||
+111
-25
@@ -43,6 +43,7 @@
|
||||
* send back to clients.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "ldns/wire2host.h"
|
||||
#include "services/mesh.h"
|
||||
#include "services/outbound_list.h"
|
||||
#include "services/cache/dns.h"
|
||||
@@ -233,7 +234,7 @@ mesh_delete_all(struct mesh_area* mesh)
|
||||
|
||||
int mesh_make_new_space(struct mesh_area* mesh)
|
||||
{
|
||||
struct mesh_state* m = mesh->jostle_last;
|
||||
struct mesh_state* m = mesh->jostle_first;
|
||||
/* free space is available */
|
||||
if(mesh->num_reply_states < mesh->max_reply_states)
|
||||
return 1;
|
||||
@@ -269,7 +270,11 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, struct edns_data* edns, struct comm_reply* rep,
|
||||
uint16_t qid)
|
||||
{
|
||||
struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags, 0);
|
||||
/* do not use CD flag from user for mesh state, we want the CD-query
|
||||
* to receive validation anyway, to protect out cache contents and
|
||||
* avoid bad-data in this cache that a downstream validator cannot
|
||||
* remove from this cache */
|
||||
struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0);
|
||||
int was_detached = 0;
|
||||
int was_noreply = 0;
|
||||
int added = 0;
|
||||
@@ -282,11 +287,22 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
mesh->stats_dropped ++;
|
||||
return;
|
||||
}
|
||||
/* for this new reply state, the reply address is free,
|
||||
* so the limit of reply addresses does not stop reply states*/
|
||||
} else {
|
||||
/* protect our memory usage from storing reply addresses */
|
||||
if(mesh->num_reply_addrs > mesh->max_reply_states*16) {
|
||||
verbose(VERB_ALGO, "Too many requests queued. "
|
||||
"dropping incoming query.");
|
||||
mesh->stats_dropped++;
|
||||
comm_point_drop_reply(rep);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* see if it already exists, if not, create one */
|
||||
if(!s) {
|
||||
struct rbnode_t* n;
|
||||
s = mesh_state_create(mesh->env,qinfo, qflags, 0);
|
||||
s = mesh_state_create(mesh->env, qinfo, qflags&BIT_RD, 0);
|
||||
if(!s) {
|
||||
log_err("mesh_state_create: out of memory; SERVFAIL");
|
||||
error_encode(rep->c->buffer, LDNS_RCODE_SERVFAIL,
|
||||
@@ -345,7 +361,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, struct edns_data* edns, ldns_buffer* buf,
|
||||
uint16_t qid, mesh_cb_func_t cb, void* cb_arg)
|
||||
{
|
||||
struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags, 0);
|
||||
struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0);
|
||||
int was_detached = 0;
|
||||
int was_noreply = 0;
|
||||
int added = 0;
|
||||
@@ -354,7 +370,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
/* see if it already exists, if not, create one */
|
||||
if(!s) {
|
||||
struct rbnode_t* n;
|
||||
s = mesh_state_create(mesh->env,qinfo, qflags, 0);
|
||||
s = mesh_state_create(mesh->env, qinfo, qflags&BIT_RD, 0);
|
||||
if(!s) {
|
||||
return 0;
|
||||
}
|
||||
@@ -388,6 +404,55 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
return 1;
|
||||
}
|
||||
|
||||
void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, uint32_t leeway)
|
||||
{
|
||||
struct mesh_state* s = mesh_area_find(mesh, qinfo, qflags&BIT_RD, 0);
|
||||
struct rbnode_t* n;
|
||||
/* already exists, and for a different purpose perhaps.
|
||||
* if mesh_no_list, keep it that way. */
|
||||
if(s) {
|
||||
/* make it ignore the cache from now on */
|
||||
if(!s->s.blacklist)
|
||||
sock_list_insert(&s->s.blacklist, NULL, 0, s->s.region);
|
||||
if(s->s.prefetch_leeway < leeway)
|
||||
s->s.prefetch_leeway = leeway;
|
||||
return;
|
||||
}
|
||||
if(!mesh_make_new_space(mesh)) {
|
||||
verbose(VERB_ALGO, "Too many queries. dropped prefetch.");
|
||||
mesh->stats_dropped ++;
|
||||
return;
|
||||
}
|
||||
s = mesh_state_create(mesh->env, qinfo, qflags&BIT_RD, 0);
|
||||
if(!s) {
|
||||
log_err("prefetch mesh_state_create: out of memory");
|
||||
return;
|
||||
}
|
||||
n = rbtree_insert(&mesh->all, &s->node);
|
||||
log_assert(n != NULL);
|
||||
/* set detached (it is now) */
|
||||
mesh->num_detached_states++;
|
||||
/* make it ignore the cache */
|
||||
sock_list_insert(&s->s.blacklist, NULL, 0, s->s.region);
|
||||
s->s.prefetch_leeway = leeway;
|
||||
|
||||
if(s->list_select == mesh_no_list) {
|
||||
/* move to either the forever or the jostle_list */
|
||||
if(mesh->num_forever_states < mesh->max_forever_states) {
|
||||
mesh->num_forever_states ++;
|
||||
mesh_list_insert(s, &mesh->forever_first,
|
||||
&mesh->forever_last);
|
||||
s->list_select = mesh_forever_list;
|
||||
} else {
|
||||
mesh_list_insert(s, &mesh->jostle_first,
|
||||
&mesh->jostle_last);
|
||||
s->list_select = mesh_jostle_list;
|
||||
}
|
||||
}
|
||||
mesh_run(mesh, s, module_event_new, NULL);
|
||||
}
|
||||
|
||||
void mesh_report_reply(struct mesh_area* mesh, struct outbound_entry* e,
|
||||
struct comm_reply* reply, int what)
|
||||
{
|
||||
@@ -447,6 +512,7 @@ mesh_state_create(struct module_env* env, struct query_info* qinfo,
|
||||
mstate->s.return_rcode = LDNS_RCODE_NOERROR;
|
||||
mstate->s.env = env;
|
||||
mstate->s.mesh_info = mstate;
|
||||
mstate->s.prefetch_leeway = 0;
|
||||
/* init modules */
|
||||
for(i=0; i<env->mesh->mods.num; i++) {
|
||||
mstate->s.minfo[i] = NULL;
|
||||
@@ -462,22 +528,24 @@ mesh_state_cleanup(struct mesh_state* mstate)
|
||||
int i;
|
||||
if(!mstate)
|
||||
return;
|
||||
mesh = mstate->s.env->mesh;
|
||||
/* drop unsent replies */
|
||||
if(!mstate->replies_sent) {
|
||||
struct mesh_reply* rep;
|
||||
struct mesh_cb* cb;
|
||||
for(rep=mstate->reply_list; rep; rep=rep->next) {
|
||||
comm_point_drop_reply(&rep->query_reply);
|
||||
mesh->num_reply_addrs--;
|
||||
}
|
||||
for(cb=mstate->cb_list; cb; cb=cb->next) {
|
||||
fptr_ok(fptr_whitelist_mesh_cb(cb->cb));
|
||||
(*cb->cb)(cb->cb_arg, LDNS_RCODE_SERVFAIL, NULL,
|
||||
sec_status_unchecked, NULL);
|
||||
mesh->num_reply_addrs--;
|
||||
}
|
||||
}
|
||||
|
||||
/* de-init modules */
|
||||
mesh = mstate->s.env->mesh;
|
||||
for(i=0; i<mesh->mods.num; i++) {
|
||||
fptr_ok(fptr_whitelist_mod_clear(mesh->mods.mod[i]->clear));
|
||||
(*mesh->mods.mod[i]->clear)(&mstate->s, i);
|
||||
@@ -525,6 +593,36 @@ mesh_state_delete(struct module_qstate* qstate)
|
||||
mesh_state_cleanup(mstate);
|
||||
}
|
||||
|
||||
/** helper recursive rbtree find routine */
|
||||
static int
|
||||
find_in_subsub(struct mesh_state* m, struct mesh_state* tofind, size_t *c)
|
||||
{
|
||||
struct mesh_state_ref* r;
|
||||
if((*c)++ > MESH_MAX_SUBSUB)
|
||||
return 1;
|
||||
RBTREE_FOR(r, struct mesh_state_ref*, &m->sub_set) {
|
||||
if(r->s == tofind || find_in_subsub(r->s, tofind, c))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** find cycle for already looked up mesh_state */
|
||||
static int
|
||||
mesh_detect_cycle_found(struct module_qstate* qstate, struct mesh_state* dep_m)
|
||||
{
|
||||
struct mesh_state* cyc_m = qstate->mesh_info;
|
||||
size_t counter = 0;
|
||||
if(!dep_m)
|
||||
return 0;
|
||||
if(dep_m == cyc_m || find_in_subsub(dep_m, cyc_m, &counter)) {
|
||||
if(counter > MESH_MAX_SUBSUB)
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mesh_detach_subs(struct module_qstate* qstate)
|
||||
{
|
||||
struct mesh_area* mesh = qstate->env->mesh;
|
||||
@@ -551,6 +649,10 @@ int mesh_attach_sub(struct module_qstate* qstate, struct query_info* qinfo,
|
||||
/* find it, if not, create it */
|
||||
struct mesh_area* mesh = qstate->env->mesh;
|
||||
struct mesh_state* sub = mesh_area_find(mesh, qinfo, qflags, prime);
|
||||
if(mesh_detect_cycle_found(qstate, sub)) {
|
||||
verbose(VERB_ALGO, "attach failed, cycle detected");
|
||||
return 0;
|
||||
}
|
||||
if(!sub) {
|
||||
struct rbnode_t* n;
|
||||
/* create a new one */
|
||||
@@ -672,7 +774,8 @@ mesh_send_reply(struct mesh_state* m, int rcode, struct reply_info* rep,
|
||||
struct timeval duration;
|
||||
int secure;
|
||||
/* examine security status */
|
||||
if(m->s.env->need_to_validate && !(r->qflags&BIT_CD) && rep &&
|
||||
if(m->s.env->need_to_validate && (!(r->qflags&BIT_CD) ||
|
||||
m->s.env->cfg->ignore_cd) && rep &&
|
||||
rep->security <= sec_status_bogus) {
|
||||
rcode = LDNS_RCODE_SERVFAIL;
|
||||
if(m->s.env->cfg->stat_extended)
|
||||
@@ -1006,30 +1109,13 @@ mesh_get_mem(struct mesh_area* mesh)
|
||||
return s;
|
||||
}
|
||||
|
||||
/** helper recursive rbtree find routine */
|
||||
static int
|
||||
find_in_subsub(struct mesh_state* m, struct mesh_state* tofind)
|
||||
{
|
||||
struct mesh_state_ref* r;
|
||||
RBTREE_FOR(r, struct mesh_state_ref*, &m->sub_set) {
|
||||
if(r->s == tofind || find_in_subsub(r->s, tofind))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
mesh_detect_cycle(struct module_qstate* qstate, struct query_info* qinfo,
|
||||
uint16_t flags, int prime)
|
||||
{
|
||||
struct mesh_area* mesh = qstate->env->mesh;
|
||||
struct mesh_state* cyc_m = qstate->mesh_info;
|
||||
struct mesh_state* dep_m = mesh_area_find(mesh, qinfo, flags, prime);
|
||||
if(!dep_m)
|
||||
return 0;
|
||||
if(dep_m == cyc_m || find_in_subsub(dep_m, cyc_m))
|
||||
return 1;
|
||||
return 0;
|
||||
return mesh_detect_cycle_found(qstate, dep_m);
|
||||
}
|
||||
|
||||
void mesh_list_insert(struct mesh_state* m, struct mesh_state** fp,
|
||||
|
||||
+25
-2
@@ -63,7 +63,14 @@ struct timehist;
|
||||
* Maximum number of mesh state activations. Any more is likely an
|
||||
* infinite loop in the module. It is then terminated.
|
||||
*/
|
||||
#define MESH_MAX_ACTIVATION 1000
|
||||
#define MESH_MAX_ACTIVATION 3000
|
||||
|
||||
/**
|
||||
* Max number of references-to-references-to-references.. search size.
|
||||
* Any more is treated like 'too large', and the creation of a new
|
||||
* dependency is failed (so that no loops can be created).
|
||||
*/
|
||||
#define MESH_MAX_SUBSUB 1024
|
||||
|
||||
/**
|
||||
* Mesh of query states
|
||||
@@ -286,6 +293,18 @@ int mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, struct edns_data* edns, ldns_buffer* buf,
|
||||
uint16_t qid, mesh_cb_func_t cb, void* cb_arg);
|
||||
|
||||
/**
|
||||
* New prefetch message. Create new query state if needed.
|
||||
* Will run the mesh area queries to process if a new query state is created.
|
||||
*
|
||||
* @param mesh: the mesh.
|
||||
* @param qinfo: query from client.
|
||||
* @param qflags: flags from client query.
|
||||
* @param leeway: TTL leeway what to expire earlier for this update.
|
||||
*/
|
||||
void mesh_new_prefetch(struct mesh_area* mesh, struct query_info* qinfo,
|
||||
uint16_t qflags, uint32_t leeway);
|
||||
|
||||
/**
|
||||
* Handle new event from the wire. A serviced query has returned.
|
||||
* The query state will be made runnable, and the mesh_area will process
|
||||
@@ -314,6 +333,8 @@ void mesh_detach_subs(struct module_qstate* qstate);
|
||||
* Attach subquery.
|
||||
* Creates it if it does not exist already.
|
||||
* Keeps sub and super references correct.
|
||||
* Performs a cycle detection - for double check - and fails if there is one.
|
||||
* Also fails if the sub-sub-references become too large.
|
||||
* Updates stat items in mesh_area structure.
|
||||
* Pass if it is priming query or not.
|
||||
* return:
|
||||
@@ -491,13 +512,15 @@ size_t mesh_get_mem(struct mesh_area* mesh);
|
||||
/**
|
||||
* Find cycle; see if the given mesh is in the targets sub, or sub-sub, ...
|
||||
* trees.
|
||||
* If the sub-sub structure is too large, it returns 'a cycle'=2.
|
||||
* @param qstate: given mesh querystate.
|
||||
* @param qinfo: query info for dependency.
|
||||
* @param flags: query flags of dependency.
|
||||
* @param prime: if dependency is a priming query or not.
|
||||
* @return true if the name,type,class exists and the given qstate mesh exists
|
||||
* as a dependency of that name. Thus if qstate becomes dependent on
|
||||
* name,type,class then a cycle is created.
|
||||
* name,type,class then a cycle is created, this is return value 1.
|
||||
* Too large to search is value 2 (also true).
|
||||
*/
|
||||
int mesh_detect_cycle(struct module_qstate* qstate, struct query_info* qinfo,
|
||||
uint16_t flags, int prime);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
* This file contains functions to help maintain a stack of modules.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
#include "services/modstack.h"
|
||||
#include "util/module.h"
|
||||
#include "util/fptr_wlist.h"
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
* queries it has outstanding to authoritative servers.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <sys/time.h>
|
||||
#include "services/outbound_list.h"
|
||||
#include "services/outside_network.h"
|
||||
|
||||
|
||||
+167
-53
@@ -40,6 +40,12 @@
|
||||
* wait for the pending answer events.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
#include "ldns/wire2host.h"
|
||||
#include "services/outside_network.h"
|
||||
#include "services/listen_dnsport.h"
|
||||
#include "services/cache/infra.h"
|
||||
@@ -53,9 +59,6 @@
|
||||
#include "util/random.h"
|
||||
#include "util/fptr_wlist.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
@@ -127,6 +130,65 @@ waiting_tcp_delete(struct waiting_tcp* w)
|
||||
free(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick random outgoing-interface of that family, and bind it.
|
||||
* port set to 0 so OS picks a port number for us.
|
||||
* if it is the ANY address, do not bind.
|
||||
* @param w: tcp structure with destination address.
|
||||
* @param s: socket fd.
|
||||
* @return false on error, socket closed.
|
||||
*/
|
||||
static int
|
||||
pick_outgoing_tcp(struct waiting_tcp* w, int s)
|
||||
{
|
||||
struct port_if* pi = NULL;
|
||||
int num;
|
||||
#ifdef INET6
|
||||
if(addr_is_ip6(&w->addr, w->addrlen))
|
||||
num = w->outnet->num_ip6;
|
||||
else
|
||||
#endif
|
||||
num = w->outnet->num_ip4;
|
||||
if(num == 0) {
|
||||
log_err("no TCP outgoing interfaces of family");
|
||||
log_addr(VERB_OPS, "for addr", &w->addr, w->addrlen);
|
||||
#ifndef USE_WINSOCK
|
||||
close(s);
|
||||
#else
|
||||
closesocket(s);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#ifdef INET6
|
||||
if(addr_is_ip6(&w->addr, w->addrlen))
|
||||
pi = &w->outnet->ip6_ifs[ub_random_max(w->outnet->rnd, num)];
|
||||
else
|
||||
#endif
|
||||
pi = &w->outnet->ip4_ifs[ub_random_max(w->outnet->rnd, num)];
|
||||
log_assert(pi);
|
||||
if(addr_is_any(&pi->addr, pi->addrlen)) {
|
||||
/* binding to the ANY interface is for listening sockets */
|
||||
return 1;
|
||||
}
|
||||
/* set port to 0 */
|
||||
if(addr_is_ip6(&pi->addr, pi->addrlen))
|
||||
((struct sockaddr_in6*)&pi->addr)->sin6_port = 0;
|
||||
else ((struct sockaddr_in*)&pi->addr)->sin_port = 0;
|
||||
if(bind(s, (struct sockaddr*)&pi->addr, pi->addrlen) != 0) {
|
||||
#ifndef USE_WINSOCK
|
||||
log_err("outgoing tcp: bind: %s", strerror(errno));
|
||||
close(s);
|
||||
#else
|
||||
log_err("outgoing tcp: bind: %s",
|
||||
wsa_strerror(WSAGetLastError()));
|
||||
closesocket(s);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
log_addr(VERB_ALGO, "tcp bound to src", &pi->addr, pi->addrlen);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** use next free buffer to service a tcp query */
|
||||
static int
|
||||
outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
|
||||
@@ -153,6 +215,9 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
|
||||
log_addr(0, "failed address", &w->addr, w->addrlen);
|
||||
return 0;
|
||||
}
|
||||
if(!pick_outgoing_tcp(w, s))
|
||||
return 0;
|
||||
|
||||
fd_set_nonblock(s);
|
||||
if(connect(s, (struct sockaddr*)&w->addr, w->addrlen) == -1) {
|
||||
#ifndef USE_WINSOCK
|
||||
@@ -755,12 +820,14 @@ udp_sockport(struct sockaddr_storage* addr, socklen_t addrlen, int port,
|
||||
struct sockaddr_in6* sa = (struct sockaddr_in6*)addr;
|
||||
sa->sin6_port = (in_port_t)htons((uint16_t)port);
|
||||
fd = create_udp_sock(AF_INET6, SOCK_DGRAM,
|
||||
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto, 0);
|
||||
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto,
|
||||
0, 0);
|
||||
} else {
|
||||
struct sockaddr_in* sa = (struct sockaddr_in*)addr;
|
||||
sa->sin_port = (in_port_t)htons((uint16_t)port);
|
||||
fd = create_udp_sock(AF_INET, SOCK_DGRAM,
|
||||
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto, 0);
|
||||
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto,
|
||||
0, 0);
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
@@ -807,9 +874,9 @@ select_ifport(struct outside_network* outnet, struct pending* pend,
|
||||
log_assert(outnet->unused_fds);
|
||||
tries = 0;
|
||||
while(1) {
|
||||
my_if = ub_random(outnet->rnd) % num_if;
|
||||
my_if = ub_random_max(outnet->rnd, num_if);
|
||||
pif = &ifs[my_if];
|
||||
my_port = ub_random(outnet->rnd) % pif->avail_total;
|
||||
my_port = ub_random_max(outnet->rnd, pif->avail_total);
|
||||
if(my_port < pif->inuse) {
|
||||
/* port already open */
|
||||
pend->pc = pif->out[my_port];
|
||||
@@ -1075,7 +1142,7 @@ lookup_serviced(struct outside_network* outnet, ldns_buffer* buff, int dnssec,
|
||||
/** Create new serviced entry */
|
||||
static struct serviced_query*
|
||||
serviced_create(struct outside_network* outnet, ldns_buffer* buff, int dnssec,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen)
|
||||
int want_dnssec, struct sockaddr_storage* addr, socklen_t addrlen)
|
||||
{
|
||||
struct serviced_query* sq = (struct serviced_query*)malloc(sizeof(*sq));
|
||||
rbnode_t* ins;
|
||||
@@ -1089,6 +1156,7 @@ serviced_create(struct outside_network* outnet, ldns_buffer* buff, int dnssec,
|
||||
}
|
||||
sq->qbuflen = ldns_buffer_limit(buff);
|
||||
sq->dnssec = dnssec;
|
||||
sq->want_dnssec = want_dnssec;
|
||||
memcpy(&sq->addr, addr, addrlen);
|
||||
sq->addrlen = addrlen;
|
||||
sq->outnet = outnet;
|
||||
@@ -1130,7 +1198,8 @@ serviced_delete(struct serviced_query* sq)
|
||||
/* clear up the pending query */
|
||||
if(sq->status == serviced_query_UDP_EDNS ||
|
||||
sq->status == serviced_query_UDP ||
|
||||
sq->status == serviced_query_PROBE_EDNS) {
|
||||
sq->status == serviced_query_PROBE_EDNS ||
|
||||
sq->status == serviced_query_UDP_EDNS_fallback) {
|
||||
struct pending* p = (struct pending*)sq->pending;
|
||||
if(p->pc)
|
||||
portcomm_loweruse(sq->outnet, p->pc);
|
||||
@@ -1238,14 +1307,16 @@ serviced_udp_send(struct serviced_query* sq, ldns_buffer* buff)
|
||||
if(!infra_host(sq->outnet->infra, &sq->addr, sq->addrlen, now, &vs,
|
||||
&edns_lame_known, &rtt))
|
||||
return 0;
|
||||
sq->last_rtt = rtt;
|
||||
verbose(VERB_ALGO, "EDNS lookup known=%d vs=%d", edns_lame_known, vs);
|
||||
if(sq->status == serviced_initial) {
|
||||
if((vs != -1 || edns_lame_known == 0) &&
|
||||
rtt > 5000 && rtt < 10001) {
|
||||
if(edns_lame_known == 0 && rtt > 5000 && rtt < 10001) {
|
||||
/* perform EDNS lame probe - check if server is
|
||||
* EDNS lame (EDNS queries to it are dropped) */
|
||||
verbose(VERB_ALGO, "serviced query: send probe to see "
|
||||
" if use of EDNS causes timeouts");
|
||||
rtt /= 10;
|
||||
/* even 700 msec may be too small */
|
||||
rtt = 1000;
|
||||
sq->status = serviced_query_PROBE_EDNS;
|
||||
} else if(vs != -1) {
|
||||
sq->status = serviced_query_UDP_EDNS;
|
||||
@@ -1255,7 +1326,6 @@ serviced_udp_send(struct serviced_query* sq, ldns_buffer* buff)
|
||||
}
|
||||
serviced_encode(sq, buff, sq->status == serviced_query_UDP_EDNS);
|
||||
sq->last_sent_time = *sq->outnet->now_tv;
|
||||
sq->last_rtt = rtt;
|
||||
sq->edns_lame_known = (int)edns_lame_known;
|
||||
verbose(VERB_ALGO, "serviced query UDP timeout=%d msec", rtt);
|
||||
sq->pending = pending_udp_query(sq->outnet, buff, &sq->addr,
|
||||
@@ -1407,12 +1477,25 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error,
|
||||
(LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) ==
|
||||
LDNS_RCODE_FORMERR || LDNS_RCODE_WIRE(ldns_buffer_begin(
|
||||
c->buffer)) == LDNS_RCODE_NOTIMPL) ) {
|
||||
if(!infra_edns_update(sq->outnet->infra, &sq->addr,
|
||||
/* attempt to fallback to nonEDNS */
|
||||
sq->status = serviced_query_TCP_EDNS_fallback;
|
||||
serviced_tcp_initiate(sq->outnet, sq, c->buffer);
|
||||
return 0;
|
||||
} else if(error==NETEVENT_NOERROR &&
|
||||
sq->status == serviced_query_TCP_EDNS_fallback &&
|
||||
(LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) ==
|
||||
LDNS_RCODE_NOERROR || LDNS_RCODE_WIRE(
|
||||
ldns_buffer_begin(c->buffer)) == LDNS_RCODE_NXDOMAIN
|
||||
|| LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer))
|
||||
== LDNS_RCODE_YXDOMAIN)) {
|
||||
/* the fallback produced a result that looks promising, note
|
||||
* that this server should be approached without EDNS */
|
||||
/* only store noEDNS in cache if domain is noDNSSEC */
|
||||
if(!sq->want_dnssec)
|
||||
if(!infra_edns_update(sq->outnet->infra, &sq->addr,
|
||||
sq->addrlen, -1, *sq->outnet->now_secs))
|
||||
log_err("Out of memory caching no edns for host");
|
||||
sq->status = serviced_query_TCP;
|
||||
serviced_tcp_initiate(sq->outnet, sq, c->buffer);
|
||||
return 0;
|
||||
}
|
||||
/* insert address into reply info */
|
||||
if(!rep) {
|
||||
@@ -1476,11 +1559,9 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
if(error == NETEVENT_TIMEOUT) {
|
||||
int rto = 0;
|
||||
if(sq->status == serviced_query_PROBE_EDNS) {
|
||||
/* non-EDNS probe failed; not an EDNS lame server */
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr,
|
||||
sq->addrlen, 0, (uint32_t)now.tv_sec)) {
|
||||
log_err("Out of memory caching edns works");
|
||||
}
|
||||
/* non-EDNS probe failed; we do not know its status,
|
||||
* keep trying with EDNS, timeout may not be caused
|
||||
* by EDNS. */
|
||||
sq->status = serviced_query_UDP_EDNS;
|
||||
}
|
||||
sq->retry++;
|
||||
@@ -1502,54 +1583,70 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
serviced_callbacks(sq, NETEVENT_TIMEOUT, c, rep);
|
||||
return 0;
|
||||
}
|
||||
} else if(error != NETEVENT_NOERROR) {
|
||||
/* udp returns error (due to no ID or interface available) */
|
||||
serviced_callbacks(sq, error, c, rep);
|
||||
return 0;
|
||||
}
|
||||
if(error == NETEVENT_NOERROR && sq->status == serviced_query_UDP_EDNS
|
||||
if(!fallback_tcp) {
|
||||
if(sq->status == serviced_query_UDP_EDNS
|
||||
&& (LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer))
|
||||
== LDNS_RCODE_FORMERR || LDNS_RCODE_WIRE(
|
||||
ldns_buffer_begin(c->buffer)) == LDNS_RCODE_NOTIMPL)) {
|
||||
/* note no EDNS, fallback without EDNS */
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
-1, (uint32_t)now.tv_sec)) {
|
||||
log_err("Out of memory caching no edns for host");
|
||||
}
|
||||
sq->status = serviced_query_UDP;
|
||||
/* try to get an answer by falling back without EDNS */
|
||||
verbose(VERB_ALGO, "serviced query: attempt without EDNS");
|
||||
sq->status = serviced_query_UDP_EDNS_fallback;
|
||||
sq->retry = 0;
|
||||
if(!serviced_udp_send(sq, c->buffer)) {
|
||||
serviced_callbacks(sq, NETEVENT_CLOSED, c, rep);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(LDNS_TC_WIRE(ldns_buffer_begin(c->buffer)) ||
|
||||
(error != NETEVENT_NOERROR && fallback_tcp) ) {
|
||||
/* fallback to TCP */
|
||||
/* this discards partial UDP contents */
|
||||
if(sq->status == serviced_query_UDP_EDNS)
|
||||
sq->status = serviced_query_TCP_EDNS;
|
||||
else sq->status = serviced_query_TCP;
|
||||
serviced_tcp_initiate(outnet, sq, c->buffer);
|
||||
return 0;
|
||||
}
|
||||
/* yay! an answer */
|
||||
if(sq->status == serviced_query_PROBE_EDNS) {
|
||||
} else if(sq->status == serviced_query_PROBE_EDNS) {
|
||||
/* probe without EDNS succeeds, so we conclude that this
|
||||
* host likely has EDNS packets dropped */
|
||||
log_addr(VERB_DETAIL, "timeouts, concluded that connection to "
|
||||
"host drops EDNS packets", &sq->addr, sq->addrlen);
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
/* only store noEDNS in cache if domain is noDNSSEC */
|
||||
if(!sq->want_dnssec)
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
-1, (uint32_t)now.tv_sec)) {
|
||||
log_err("Out of memory caching no edns for host");
|
||||
}
|
||||
}
|
||||
sq->status = serviced_query_UDP;
|
||||
} else if(sq->status == serviced_query_UDP_EDNS &&
|
||||
} else if(sq->status == serviced_query_UDP_EDNS &&
|
||||
!sq->edns_lame_known) {
|
||||
/* now we know that edns queries received answers store that */
|
||||
log_addr(VERB_ALGO, "serviced query: EDNS works for",
|
||||
&sq->addr, sq->addrlen);
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
0, (uint32_t)now.tv_sec)) {
|
||||
log_err("Out of memory caching edns works");
|
||||
}
|
||||
sq->edns_lame_known = 1;
|
||||
}
|
||||
if(now.tv_sec > sq->last_sent_time.tv_sec ||
|
||||
} else if(sq->status == serviced_query_UDP_EDNS_fallback &&
|
||||
!sq->edns_lame_known && (LDNS_RCODE_WIRE(
|
||||
ldns_buffer_begin(c->buffer)) == LDNS_RCODE_NOERROR ||
|
||||
LDNS_RCODE_WIRE(ldns_buffer_begin(c->buffer)) ==
|
||||
LDNS_RCODE_NXDOMAIN || LDNS_RCODE_WIRE(ldns_buffer_begin(
|
||||
c->buffer)) == LDNS_RCODE_YXDOMAIN)) {
|
||||
/* the fallback produced a result that looks promising, note
|
||||
* that this server should be approached without EDNS */
|
||||
/* only store noEDNS in cache if domain is noDNSSEC */
|
||||
if(!sq->want_dnssec) {
|
||||
log_addr(VERB_ALGO, "serviced query: EDNS fails for",
|
||||
&sq->addr, sq->addrlen);
|
||||
if(!infra_edns_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
-1, (uint32_t)now.tv_sec)) {
|
||||
log_err("Out of memory caching no edns for host");
|
||||
}
|
||||
} else {
|
||||
log_addr(VERB_ALGO, "serviced query: EDNS fails, but "
|
||||
"not stored because need DNSSEC for", &sq->addr,
|
||||
sq->addrlen);
|
||||
}
|
||||
sq->status = serviced_query_UDP;
|
||||
}
|
||||
if(now.tv_sec > sq->last_sent_time.tv_sec ||
|
||||
(now.tv_sec == sq->last_sent_time.tv_sec &&
|
||||
now.tv_usec > sq->last_sent_time.tv_usec)) {
|
||||
/* convert from microseconds to milliseconds */
|
||||
@@ -1560,7 +1657,22 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
|
||||
if(!infra_rtt_update(outnet->infra, &sq->addr, sq->addrlen,
|
||||
roundtime, sq->last_rtt, (uint32_t)now.tv_sec))
|
||||
log_err("out of memory noting rtt.");
|
||||
}
|
||||
} /* end of if_!fallback_tcp */
|
||||
/* perform TC flag check and TCP fallback after updating our
|
||||
* cache entries for EDNS status and RTT times */
|
||||
if(LDNS_TC_WIRE(ldns_buffer_begin(c->buffer)) || fallback_tcp) {
|
||||
/* fallback to TCP */
|
||||
/* this discards partial UDP contents */
|
||||
if(sq->status == serviced_query_UDP_EDNS ||
|
||||
sq->status == serviced_query_UDP_EDNS_fallback)
|
||||
/* if we have unfinished EDNS_fallback, start again */
|
||||
sq->status = serviced_query_TCP_EDNS;
|
||||
else sq->status = serviced_query_TCP;
|
||||
serviced_tcp_initiate(outnet, sq, c->buffer);
|
||||
return 0;
|
||||
}
|
||||
/* yay! an answer */
|
||||
serviced_callbacks(sq, error, c, rep);
|
||||
return 0;
|
||||
}
|
||||
@@ -1581,10 +1693,10 @@ callback_list_find(struct serviced_query* sq, void* cb_arg,
|
||||
struct serviced_query*
|
||||
outnet_serviced_query(struct outside_network* outnet,
|
||||
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
|
||||
uint16_t flags, int dnssec, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, comm_point_callback_t* callback,
|
||||
void* callback_arg, ldns_buffer* buff,
|
||||
int (*arg_compare)(void*,void*))
|
||||
uint16_t flags, int dnssec, int want_dnssec, int tcp_upstream,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
comm_point_callback_t* callback, void* callback_arg,
|
||||
ldns_buffer* buff, int (*arg_compare)(void*,void*))
|
||||
{
|
||||
struct serviced_query* sq;
|
||||
struct service_callback* cb;
|
||||
@@ -1600,13 +1712,14 @@ outnet_serviced_query(struct outside_network* outnet,
|
||||
return NULL;
|
||||
if(!sq) {
|
||||
/* make new serviced query entry */
|
||||
sq = serviced_create(outnet, buff, dnssec, addr, addrlen);
|
||||
sq = serviced_create(outnet, buff, dnssec, want_dnssec,
|
||||
addr, addrlen);
|
||||
if(!sq) {
|
||||
free(cb);
|
||||
return NULL;
|
||||
}
|
||||
/* perform first network action */
|
||||
if(outnet->do_udp) {
|
||||
if(outnet->do_udp && !tcp_upstream) {
|
||||
if(!serviced_udp_send(sq, buff)) {
|
||||
(void)rbtree_delete(outnet->serviced, sq);
|
||||
free(sq->qbuf);
|
||||
@@ -1752,7 +1865,8 @@ serviced_get_mem(struct serviced_query* sq)
|
||||
s += sizeof(*sb);
|
||||
if(sq->status == serviced_query_UDP_EDNS ||
|
||||
sq->status == serviced_query_UDP ||
|
||||
sq->status == serviced_query_PROBE_EDNS) {
|
||||
sq->status == serviced_query_PROBE_EDNS ||
|
||||
sq->status == serviced_query_UDP_EDNS_fallback) {
|
||||
s += sizeof(struct pending);
|
||||
s += comm_timer_get_mem(NULL);
|
||||
} else {
|
||||
|
||||
@@ -291,6 +291,8 @@ struct serviced_query {
|
||||
size_t qbuflen;
|
||||
/** If an EDNS section is included, the DO/CD bit will be turned on. */
|
||||
int dnssec;
|
||||
/** We want signatures, or else the answer is likely useless */
|
||||
int want_dnssec;
|
||||
/** where to send it */
|
||||
struct sockaddr_storage addr;
|
||||
/** length of addr field in use. */
|
||||
@@ -308,7 +310,11 @@ struct serviced_query {
|
||||
/** TCP without EDNS sent */
|
||||
serviced_query_TCP,
|
||||
/** probe to test EDNS lameness (EDNS is dropped) */
|
||||
serviced_query_PROBE_EDNS
|
||||
serviced_query_PROBE_EDNS,
|
||||
/** probe to test noEDNS0 (EDNS gives FORMERRorNOTIMP) */
|
||||
serviced_query_UDP_EDNS_fallback,
|
||||
/** probe to test TCP noEDNS0 (EDNS gives FORMERRorNOTIMP) */
|
||||
serviced_query_TCP_EDNS_fallback
|
||||
}
|
||||
/** variable with current status */
|
||||
status;
|
||||
@@ -427,6 +433,9 @@ void pending_delete(struct outside_network* outnet, struct pending* p);
|
||||
* @param dnssec: if set, DO bit is set in EDNS queries.
|
||||
* If the value includes BIT_CD, CD bit is set when in EDNS queries.
|
||||
* If the value includes BIT_DO, DO bit is set when in EDNS queries.
|
||||
* @param want_dnssec: signatures are needed, without EDNS the answer is
|
||||
* likely to be useless.
|
||||
* @param tcp_upstream: use TCP for upstream queries.
|
||||
* @param callback: callback function.
|
||||
* @param callback_arg: user argument to callback function.
|
||||
* @param addr: to which server to send the query.
|
||||
@@ -439,10 +448,10 @@ void pending_delete(struct outside_network* outnet, struct pending* p);
|
||||
*/
|
||||
struct serviced_query* outnet_serviced_query(struct outside_network* outnet,
|
||||
uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass,
|
||||
uint16_t flags, int dnssec, struct sockaddr_storage* addr,
|
||||
socklen_t addrlen, comm_point_callback_t* callback,
|
||||
void* callback_arg, ldns_buffer* buff,
|
||||
int (*arg_compare)(void*,void*));
|
||||
uint16_t flags, int dnssec, int want_dnssec, int tcp_upstream,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
comm_point_callback_t* callback, void* callback_arg,
|
||||
ldns_buffer* buff, int (*arg_compare)(void*,void*));
|
||||
|
||||
/**
|
||||
* Remove service query callback.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -52,6 +52,9 @@
|
||||
#include "iterator/iter_fwd.h"
|
||||
#include "validator/validator.h"
|
||||
#include "services/localzone.h"
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
@@ -80,40 +83,6 @@ usage()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/** compare and print decimal option */
|
||||
#define O_DEC(opt, str, var) if(strcmp(opt, str)==0) \
|
||||
{printf("%d\n", (int)cfg->var);}
|
||||
/** compare and print unsigned option */
|
||||
#define O_UNS(opt, str, var) if(strcmp(opt, str)==0) \
|
||||
{printf("%u\n", (unsigned)cfg->var);}
|
||||
/** compare and print yesno option */
|
||||
#define O_YNO(opt, str, var) if(strcmp(opt, str)==0) \
|
||||
{printf("%s\n", cfg->var?"yes":"no");}
|
||||
/** compare and print string option */
|
||||
#define O_STR(opt, str, var) if(strcmp(opt, str)==0) \
|
||||
{printf("%s\n", cfg->var?cfg->var:"");}
|
||||
/** compare and print array option */
|
||||
#define O_IFC(opt, str, num, arr) if(strcmp(opt, str)==0) \
|
||||
{int i; for(i=0; i<cfg->num; i++) printf("%s\n", cfg->arr[i]);}
|
||||
/** compare and print memorysize option */
|
||||
#define O_MEM(opt, str, var) if(strcmp(opt, str)==0) { \
|
||||
if(cfg->var > 1024*1024*1024) { \
|
||||
size_t f=cfg->var/(size_t)1000000, b=cfg->var%(size_t)1000000; \
|
||||
printf("%u%6.6u\n", (unsigned)f, (unsigned)b); \
|
||||
} else printf("%u\n", (unsigned)cfg->var);}
|
||||
/** compare and print list option */
|
||||
#define O_LST(opt, name, lst) if(strcmp(opt, name)==0) { \
|
||||
struct config_strlist* p = cfg->lst; \
|
||||
for(p = cfg->lst; p; p = p->next) \
|
||||
printf("%s\n", p->str); \
|
||||
}
|
||||
/** compare and print list option */
|
||||
#define O_LS2(opt, name, lst) if(strcmp(opt, name)==0) { \
|
||||
struct config_str2list* p = cfg->lst; \
|
||||
for(p = cfg->lst; p; p = p->next) \
|
||||
printf("%s %s\n", p->str, p->str2); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Print given option to stdout
|
||||
* @param cfg: config
|
||||
@@ -123,96 +92,8 @@ usage()
|
||||
static void
|
||||
print_option(struct config_file* cfg, const char* opt)
|
||||
{
|
||||
O_DEC(opt, "verbosity", verbosity)
|
||||
else O_DEC(opt, "statistics-interval", stat_interval)
|
||||
else O_YNO(opt, "statistics-cumulative", stat_interval)
|
||||
else O_YNO(opt, "extended-statistics", stat_extended)
|
||||
else O_DEC(opt, "num-threads", num_threads)
|
||||
else O_IFC(opt, "interface", num_ifs, ifs)
|
||||
else O_IFC(opt, "outgoing-interface", num_out_ifs, out_ifs)
|
||||
else O_YNO(opt, "interface-automatic", if_automatic)
|
||||
else O_DEC(opt, "port", port)
|
||||
else O_DEC(opt, "outgoing-range", outgoing_num_ports)
|
||||
else O_DEC(opt, "outgoing-num-tcp", outgoing_num_tcp)
|
||||
else O_DEC(opt, "incoming-num-tcp", incoming_num_tcp)
|
||||
else O_DEC(opt, "edns-buffer-size", edns_buffer_size)
|
||||
else O_DEC(opt, "msg-buffer-size", msg_buffer_size)
|
||||
else O_MEM(opt, "msg-cache-size", msg_cache_size)
|
||||
else O_DEC(opt, "msg-cache-slabs", msg_cache_slabs)
|
||||
else O_DEC(opt, "num-queries-per-thread", num_queries_per_thread)
|
||||
else O_UNS(opt, "jostle-timeout", jostle_time)
|
||||
else O_MEM(opt, "so-rcvbuf", socket_rcvbuf)
|
||||
else O_MEM(opt, "rrset-cache-size", rrset_cache_size)
|
||||
else O_DEC(opt, "rrset-cache-slabs", rrset_cache_slabs)
|
||||
else O_DEC(opt, "cache-max-ttl", max_ttl)
|
||||
else O_DEC(opt, "infra-host-ttl", host_ttl)
|
||||
else O_DEC(opt, "infra-lame-ttl", lame_ttl)
|
||||
else O_DEC(opt, "infra-cache-slabs", infra_cache_slabs)
|
||||
else O_MEM(opt, "infra-cache-numhosts", infra_cache_numhosts)
|
||||
else O_MEM(opt, "infra-cache-lame-size", infra_cache_lame_size)
|
||||
else O_YNO(opt, "do-ip4", do_ip4)
|
||||
else O_YNO(opt, "do-ip6", do_ip6)
|
||||
else O_YNO(opt, "do-udp", do_udp)
|
||||
else O_YNO(opt, "do-tcp", do_tcp)
|
||||
else O_YNO(opt, "do-daemonize", do_daemonize)
|
||||
else O_STR(opt, "chroot", chrootdir)
|
||||
else O_STR(opt, "username", username)
|
||||
else O_STR(opt, "directory", directory)
|
||||
else O_STR(opt, "logfile", logfile)
|
||||
else O_STR(opt, "pidfile", pidfile)
|
||||
else O_YNO(opt, "hide-identity", hide_identity)
|
||||
else O_YNO(opt, "hide-version", hide_version)
|
||||
else O_STR(opt, "identity", identity)
|
||||
else O_STR(opt, "version", version)
|
||||
else O_STR(opt, "target-fetch-policy", target_fetch_policy)
|
||||
else O_YNO(opt, "harden-short-bufsize", harden_short_bufsize)
|
||||
else O_YNO(opt, "harden-large-queries", harden_large_queries)
|
||||
else O_YNO(opt, "harden-glue", harden_glue)
|
||||
else O_YNO(opt, "harden-dnssec-stripped", harden_dnssec_stripped)
|
||||
else O_YNO(opt, "harden-referral-path", harden_referral_path)
|
||||
else O_YNO(opt, "use-caps-for-id", use_caps_bits_for_id)
|
||||
else O_DEC(opt, "unwanted-reply-threshold", unwanted_threshold)
|
||||
else O_YNO(opt, "do-not-query-localhost", donotquery_localhost)
|
||||
else O_STR(opt, "module-config", module_conf)
|
||||
else O_STR(opt, "dlv-anchor-file", dlv_anchor_file)
|
||||
else O_DEC(opt, "val-bogus-ttl", bogus_ttl)
|
||||
else O_YNO(opt, "val-clean-additional", val_clean_additional)
|
||||
else O_DEC(opt, "val-log-level", val_log_level)
|
||||
else O_YNO(opt, "val-permissive-mode", val_permissive_mode)
|
||||
else O_STR(opt, "val-nsec3-keysize-iterations",val_nsec3_key_iterations)
|
||||
else O_UNS(opt, "add-holddown", add_holddown)
|
||||
else O_UNS(opt, "del-holddown", del_holddown)
|
||||
else O_UNS(opt, "keep-missing", keep_missing)
|
||||
else O_MEM(opt, "key-cache-size", key_cache_size)
|
||||
else O_DEC(opt, "key-cache-slabs", key_cache_slabs)
|
||||
else O_MEM(opt, "neg-cache-size", neg_cache_size)
|
||||
else O_YNO(opt, "control-enable", remote_control_enable)
|
||||
else O_DEC(opt, "control-port", control_port)
|
||||
else O_STR(opt, "server-key-file", server_key_file)
|
||||
else O_STR(opt, "server-cert-file", server_cert_file)
|
||||
else O_STR(opt, "control-key-file", control_key_file)
|
||||
else O_STR(opt, "control-cert-file", control_cert_file)
|
||||
else O_LST(opt, "root-hints", root_hints)
|
||||
else O_LS2(opt, "access-control", acls)
|
||||
else O_LST(opt, "do-not-query-address", donotqueryaddrs)
|
||||
else O_LST(opt, "private-address", private_address)
|
||||
else O_LST(opt, "private-domain", private_domain)
|
||||
else O_LST(opt, "auto-trust-anchor-file", auto_trust_anchor_file_list)
|
||||
else O_LST(opt, "trust-anchor-file", trust_anchor_file_list)
|
||||
else O_LST(opt, "trust-anchor", trust_anchor_list)
|
||||
else O_LST(opt, "trusted-keys-file", trusted_keys_file_list)
|
||||
else O_LST(opt, "dlv-anchor", dlv_anchor_list)
|
||||
else O_LST(opt, "control-interface", control_ifs)
|
||||
else O_UNS(opt, "val-override-date", val_date_override)
|
||||
/* not here:
|
||||
* outgoing-permit, outgoing-avoid - have list of ports
|
||||
* local-zone - zones and nodefault variables
|
||||
* local-data - see below
|
||||
* local-data-ptr - converted to local-data entries
|
||||
* stub-zone, name, stub-addr, stub-host, stub-prime
|
||||
* forward-zone, name, forward-addr, forward-host
|
||||
*/
|
||||
else fatal_exit("cannot print option '%s'", opt);
|
||||
if(!config_get_option(cfg, opt, config_print_func, stdout))
|
||||
fatal_exit("cannot print option '%s'", opt);
|
||||
}
|
||||
|
||||
/** check if module works with config */
|
||||
@@ -276,7 +157,7 @@ interfacechecks(struct config_file* cfg)
|
||||
socklen_t alen;
|
||||
int i, j;
|
||||
for(i=0; i<cfg->num_ifs; i++) {
|
||||
if(!ipstrtoaddr(cfg->ifs[i], UNBOUND_DNS_PORT, &a, &alen)) {
|
||||
if(!extstrtoaddr(cfg->ifs[i], &a, &alen)) {
|
||||
fatal_exit("cannot parse interface specified as '%s'",
|
||||
cfg->ifs[i]);
|
||||
}
|
||||
@@ -437,7 +318,7 @@ morechecks(struct config_file* cfg, const char* fname)
|
||||
|
||||
if(cfg->verbosity < 0)
|
||||
fatal_exit("verbosity value < 0");
|
||||
if(cfg->num_threads < 0 || cfg->num_threads > 10000)
|
||||
if(cfg->num_threads <= 0 || cfg->num_threads > 10000)
|
||||
fatal_exit("num_threads value weird");
|
||||
if(!cfg->do_ip4 && !cfg->do_ip6)
|
||||
fatal_exit("ip4 and ip6 are both disabled, pointless");
|
||||
@@ -497,6 +378,8 @@ morechecks(struct config_file* cfg, const char* fname)
|
||||
cfg->root_hints, cfg->chrootdir, cfg);
|
||||
check_chroot_filelist("trust-anchor-file",
|
||||
cfg->trust_anchor_file_list, cfg->chrootdir, cfg);
|
||||
check_chroot_filelist("auto-trust-anchor-file",
|
||||
cfg->auto_trust_anchor_file_list, cfg->chrootdir, cfg);
|
||||
check_chroot_filelist_wild("trusted-keys-file",
|
||||
cfg->trusted_keys_file_list, cfg->chrootdir, cfg);
|
||||
check_chroot_string("dlv-anchor-file", &cfg->dlv_anchor_file,
|
||||
|
||||
@@ -46,7 +46,10 @@ CLIENTNAME=unbound-control
|
||||
DAYS=7200
|
||||
|
||||
# size of keys in bits
|
||||
BITS=1024
|
||||
BITS=1536
|
||||
|
||||
# hash algorithm
|
||||
HASH=sha256
|
||||
|
||||
# base name for unbound server keys
|
||||
SVR_BASE=unbound_server
|
||||
@@ -54,6 +57,9 @@ SVR_BASE=unbound_server
|
||||
# base name for unbound-control keys
|
||||
CTL_BASE=unbound_control
|
||||
|
||||
# we want -rw-r--- access (say you run this as root: grp=yes (server), all=no).
|
||||
umask 0026
|
||||
|
||||
# end of options
|
||||
|
||||
# functions:
|
||||
@@ -75,7 +81,7 @@ while test $# -ne 0; do
|
||||
echo " -d dir use directory to store keys and certificates."
|
||||
echo " default: $DESTDIR"
|
||||
echo "please run this command using the same user id that the "
|
||||
echo "unboun daemon uses, it needs read privileges."
|
||||
echo "unbound daemon uses, it needs read privileges."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -84,7 +90,7 @@ done
|
||||
|
||||
# go!:
|
||||
echo "setup in directory $DESTDIR"
|
||||
cd "$DESTDIR" || error "could not cd"
|
||||
cd "$DESTDIR" || error "could not cd to $DESTDIR"
|
||||
|
||||
# create certificate keys; do not recreate if they already exist.
|
||||
if test -f $SVR_BASE.key; then
|
||||
@@ -104,7 +110,7 @@ fi
|
||||
cat >request.cfg <<EOF
|
||||
[req]
|
||||
default_bits=$BITS
|
||||
default_md=sha1
|
||||
default_md=$HASH
|
||||
prompt=no
|
||||
distinguished_name=req_distinguished_name
|
||||
|
||||
@@ -122,7 +128,7 @@ openssl x509 -in $SVR_BASE.pem -addtrust serverAuth -out $SVR_BASE"_trust.pem"
|
||||
cat >request.cfg <<EOF
|
||||
[req]
|
||||
default_bits=$BITS
|
||||
default_md=sha1
|
||||
default_md=$HASH
|
||||
prompt=no
|
||||
distinguished_name=req_distinguished_name
|
||||
|
||||
@@ -132,7 +138,7 @@ EOF
|
||||
test -f request.cfg || error "could not create request.cfg"
|
||||
|
||||
echo "create $CTL_BASE.pem (signed client certificate)"
|
||||
openssl req -key $CTL_BASE.key -config request.cfg -new | openssl x509 -req -days $DAYS -CA $SVR_BASE"_trust.pem" -CAkey $SVR_BASE.key -CAcreateserial -out $CTL_BASE.pem
|
||||
openssl req -key $CTL_BASE.key -config request.cfg -new | openssl x509 -req -days $DAYS -CA $SVR_BASE"_trust.pem" -CAkey $SVR_BASE.key -CAcreateserial -$HASH -out $CTL_BASE.pem
|
||||
test -f $CTL_BASE.pem || error "could not create $CTL_BASE.pem"
|
||||
# create trusted usage pem
|
||||
# openssl x509 -in $CTL_BASE.pem -addtrust clientAuth -out $CTL_BASE"_trust.pem"
|
||||
|
||||
@@ -42,6 +42,18 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#ifdef HAVE_OPENSSL_SSL_H
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
#ifdef HAVE_OPENSSL_ERR_H
|
||||
#include <openssl/err.h>
|
||||
#endif
|
||||
#ifdef HAVE_OPENSSL_RAND_H
|
||||
#include <openssl/rand.h>
|
||||
#endif
|
||||
#include "util/log.h"
|
||||
#include "util/config_file.h"
|
||||
#include "util/locks.h"
|
||||
@@ -66,6 +78,7 @@ usage()
|
||||
printf(" stats_noreset peek at statistics\n");
|
||||
printf(" status display status of server\n");
|
||||
printf(" verbosity <number> change logging detail\n");
|
||||
printf(" log_reopen close and open the logfile\n");
|
||||
printf(" local_zone <name> <type> add new local zone\n");
|
||||
printf(" local_zone_remove <name> remove local zone and its contents\n");
|
||||
printf(" local_data <RR data...> add local data, for example\n");
|
||||
@@ -83,6 +96,14 @@ usage()
|
||||
printf(" flush_stats flush statistics, make zero\n");
|
||||
printf(" flush_requestlist drop queries that are worked on\n");
|
||||
printf(" dump_requestlist show what is worked on\n");
|
||||
printf(" flush_infra [all | ip] remove ping, edns for one IP or all\n");
|
||||
printf(" dump_infra show ping and edns entries\n");
|
||||
printf(" set_option opt: val set option to value, no reload\n");
|
||||
printf(" get_option opt get option value\n");
|
||||
printf(" list_stubs list stub-zones and root hints in use\n");
|
||||
printf(" list_forwards list forward-zones in use\n");
|
||||
printf(" list_local_zones list local-zones in use\n");
|
||||
printf(" list_local_data list local-data RRs in use\n");
|
||||
printf(" forward [off | addr ...] without arg show forward setup\n");
|
||||
printf(" or off to turn off root forwarding\n");
|
||||
printf(" or give list of ip addresses\n");
|
||||
@@ -237,12 +258,13 @@ send_file(SSL* ssl, FILE* in, char* buf, size_t sz)
|
||||
static int
|
||||
go_cmd(SSL* ssl, int argc, char* argv[])
|
||||
{
|
||||
const char* pre="UBCT";
|
||||
char pre[10];
|
||||
const char* space=" ";
|
||||
const char* newline="\n";
|
||||
int was_error = 0, first_line = 1;
|
||||
int r, i;
|
||||
char buf[1024];
|
||||
snprintf(pre, sizeof(pre), "UBCT%d ", UNBOUND_CONTROL_VERSION);
|
||||
if(SSL_write(ssl, pre, (int)strlen(pre)) <= 0)
|
||||
ssl_err("could not SSL_write");
|
||||
for(i=0; i<argc; i++) {
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
/* remove alloc checks, not in this part of the code */
|
||||
#ifdef UNBOUND_ALLOC_STATS
|
||||
#undef malloc
|
||||
@@ -48,6 +51,14 @@
|
||||
#undef free
|
||||
#undef realloc
|
||||
#endif
|
||||
#ifdef UNBOUND_ALLOC_LITE
|
||||
#undef malloc
|
||||
#undef calloc
|
||||
#undef free
|
||||
#undef realloc
|
||||
#undef strdup
|
||||
#define unbound_lite_wrapstr(s) s
|
||||
#endif
|
||||
#include "libunbound/unbound.h"
|
||||
#include <ldns/ldns.h>
|
||||
|
||||
@@ -486,6 +497,12 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
if(debuglevel != 0) /* set after possible -C options */
|
||||
check_ub_res(ub_ctx_debuglevel(ctx, debuglevel));
|
||||
if(ub_ctx_get_option(ctx, "use-syslog", &optarg) == 0) {
|
||||
if(strcmp(optarg, "yes") == 0) /* disable use-syslog */
|
||||
check_ub_res(ub_ctx_set_option(ctx,
|
||||
"use-syslog:", "no"));
|
||||
free(optarg);
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if(argc != 1)
|
||||
|
||||
+9
-20
@@ -100,19 +100,11 @@ void worker_sighandler(int ATTR_UNUSED(sig), void* ATTR_UNUSED(arg))
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
int worker_send_packet(ldns_buffer* ATTR_UNUSED(pkt),
|
||||
struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
socklen_t ATTR_UNUSED(addrlen), int ATTR_UNUSED(timeout),
|
||||
struct module_qstate* ATTR_UNUSED(q), int ATTR_UNUSED(use_tcp))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct outbound_entry* worker_send_query(uint8_t* ATTR_UNUSED(qname),
|
||||
size_t ATTR_UNUSED(qnamelen), uint16_t ATTR_UNUSED(qtype),
|
||||
uint16_t ATTR_UNUSED(qclass), uint16_t ATTR_UNUSED(flags),
|
||||
int ATTR_UNUSED(dnssec), struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
int ATTR_UNUSED(dnssec), int ATTR_UNUSED(want_dnssec),
|
||||
struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
socklen_t ATTR_UNUSED(addrlen), struct module_qstate* ATTR_UNUSED(q))
|
||||
{
|
||||
log_assert(0);
|
||||
@@ -139,19 +131,11 @@ worker_alloc_cleanup(void* ATTR_UNUSED(arg))
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
int libworker_send_packet(ldns_buffer* ATTR_UNUSED(pkt),
|
||||
struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
socklen_t ATTR_UNUSED(addrlen), int ATTR_UNUSED(timeout),
|
||||
struct module_qstate* ATTR_UNUSED(q), int ATTR_UNUSED(use_tcp))
|
||||
{
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct outbound_entry* libworker_send_query(uint8_t* ATTR_UNUSED(qname),
|
||||
size_t ATTR_UNUSED(qnamelen), uint16_t ATTR_UNUSED(qtype),
|
||||
uint16_t ATTR_UNUSED(qclass), uint16_t ATTR_UNUSED(flags),
|
||||
int ATTR_UNUSED(dnssec), struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
int ATTR_UNUSED(dnssec), int ATTR_UNUSED(want_dnssec),
|
||||
struct sockaddr_storage* ATTR_UNUSED(addr),
|
||||
socklen_t ATTR_UNUSED(addrlen), struct module_qstate* ATTR_UNUSED(q))
|
||||
{
|
||||
log_assert(0);
|
||||
@@ -241,3 +225,8 @@ int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
|
||||
log_assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void remote_get_opt_ssl(char* ATTR_UNUSED(str), void* ATTR_UNUSED(arg))
|
||||
{
|
||||
log_assert(0);
|
||||
}
|
||||
|
||||
+11
-1
@@ -41,10 +41,20 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#include "libunbound/unbound.h"
|
||||
#include "libunbound/context.h"
|
||||
#include "util/locks.h"
|
||||
#include "util/log.h"
|
||||
#ifdef UNBOUND_ALLOC_LITE
|
||||
#undef malloc
|
||||
#undef calloc
|
||||
#undef realloc
|
||||
#undef free
|
||||
#undef strdup
|
||||
#endif
|
||||
|
||||
/** keeping track of the async ids */
|
||||
struct track_id {
|
||||
@@ -74,7 +84,7 @@ struct lookinfo {
|
||||
static int num_wait = 0;
|
||||
|
||||
/** usage information for asynclook */
|
||||
void usage(char* argv[])
|
||||
static void usage(char* argv[])
|
||||
{
|
||||
printf("usage: %s [options] name ...\n", argv[0]);
|
||||
printf("names are looked up at the same time, asynchronously.\n");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user