Compare commits

...
Author SHA1 Message Date
Wouter Wijngaards 9a9d6bdf0c Review comments, tag changelog entry.
git-svn-id: file:///svn/unbound/trunk@1942 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-17 08:58:51 +00:00
Wouter Wijngaards 0e248f9000 unit test for x64
git-svn-id: file:///svn/unbound/trunk@1941 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-15 10:31:13 +00:00
Wouter Wijngaards da50c48599 unit test for negative cache DS response
git-svn-id: file:///svn/unbound/trunk@1940 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-15 10:00:55 +00:00
Wouter Wijngaards 7094eab574 fixes and new ldns tarball.
git-svn-id: file:///svn/unbound/trunk@1939 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-15 09:31:39 +00:00
Wouter Wijngaards ab9bd76768 Answer qclass=ANY.
git-svn-id: file:///svn/unbound/trunk@1938 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-15 09:10:04 +00:00
Wouter Wijngaards 72926a9f8c on IPv4 UDP turn off DF flag.
git-svn-id: file:///svn/unbound/trunk@1937 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-11 16:02:49 +00:00
Wouter Wijngaards 47e7b5fb51 Check rrsig expiration last in verify_rrsig
git-svn-id: file:///svn/unbound/trunk@1936 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-10 16:03:31 +00:00
Wouter Wijngaards d3dc108dd9 Readup fixes.
git-svn-id: file:///svn/unbound/trunk@1935 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-10 15:41:52 +00:00
Wouter Wijngaards e43b2c9338 More design choice explanation.
git-svn-id: file:///svn/unbound/trunk@1934 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-10 10:23:51 +00:00
Wouter Wijngaards 1d2c4f70fa fix crash for hauke
git-svn-id: file:///svn/unbound/trunk@1933 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-09 16:27:13 +00:00
Wouter Wijngaards c68aebb3d7 - Fix SOA excluded from negative DS responses. Reported by Hauke
Lampe.  The negative cache did not include proper SOA records for
	  negative qtype DS responses which makes BIND barf on it, such
	  responses are now only used internally.
	- Fix negative cache lookup of closestencloser check of DS type bit.



git-svn-id: file:///svn/unbound/trunk@1932 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-09 14:55:19 +00:00
Wouter Wijngaards 90da0cc2e8 Fix bug#287
git-svn-id: file:///svn/unbound/trunk@1931 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-09 09:07:56 +00:00
Wouter Wijngaards c88952d4e0 Specify port number in interface lines.
git-svn-id: file:///svn/unbound/trunk@1930 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-08 16:31:56 +00:00
Wouter Wijngaards 59c529bada Fix lookup of domains with parent-child zonecut data differences.
git-svn-id: file:///svn/unbound/trunk@1929 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-08 13:37:59 +00:00
Wouter Wijngaards eeb6bf49d0 change to trigger update to test new commithook with builtin ldns tarball.
git-svn-id: file:///svn/unbound/trunk@1928 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-07 15:04:48 +00:00
Wouter Wijngaards fd9c8a700e test for bug#287
git-svn-id: file:///svn/unbound/trunk@1927 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-07 10:19:28 +00:00
Wouter Wijngaards 1ce514a384 Fix bug#287.
git-svn-id: file:///svn/unbound/trunk@1926 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-07 09:18:38 +00:00
Wouter Wijngaards 408079e49f Test for module-config "iterator"
git-svn-id: file:///svn/unbound/trunk@1925 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-01 08:12:12 +00:00
Wouter Wijngaards 4d1c4c8002 Fix crash reported on unbound-users with module-config "iterator"
git-svn-id: file:///svn/unbound/trunk@1924 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-12-01 08:12:00 +00:00
Wouter Wijngaards c253c24202 Fix bug #284.
git-svn-id: file:///svn/unbound/trunk@1923 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-30 13:07:39 +00:00
Wouter Wijngaards 15e5041086 1.4.1 and libtool version fix
git-svn-id: file:///svn/unbound/trunk@1922 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-26 14:28:40 +00:00
Wouter Wijngaards 836f0358ea updated ldns.
git-svn-id: file:///svn/unbound/trunk@1920 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-26 11:12:32 +00:00
Wouter Wijngaards 039f276b0c fixup spinning
git-svn-id: file:///svn/unbound/trunk@1919 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-23 12:12:59 +00:00
Wouter Wijngaards 44a28f4343 Patch applied from David Hubbard.
git-svn-id: file:///svn/unbound/trunk@1918 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-23 11:01:10 +00:00
Wouter Wijngaards cffd76e6e4 revert nonworking fixup
git-svn-id: file:///svn/unbound/trunk@1917 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-20 15:43:13 +00:00
Wouter Wijngaards 54046475e7 workaround
git-svn-id: file:///svn/unbound/trunk@1916 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-20 15:28:10 +00:00
Wouter Wijngaards caeebbf4fa review comments
git-svn-id: file:///svn/unbound/trunk@1915 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-20 12:06:00 +00:00
Wouter Wijngaards 521bd29041 Utility script to convert anchors.mf from the ITAR into individual files that are amenable to RFC5011 tracking.
git-svn-id: file:///svn/unbound/trunk@1914 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-20 10:37:06 +00:00
Wouter Wijngaards 9abe770f9e iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1913 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-19 10:22:48 +00:00
Wouter Wijngaards 41a5b9efca better argument help for unbound-control
git-svn-id: file:///svn/unbound/trunk@1912 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-19 10:01:42 +00:00
Wouter Wijngaards 980f3f10b7 iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1911 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-17 16:02:59 +00:00
Wouter Wijngaards 83cf9d20c8 noted multiple autotrust lines needed in example.conf
git-svn-id: file:///svn/unbound/trunk@1910 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-17 09:43:09 +00:00
Wouter Wijngaards a4c7a739d9 svn tag changelog entry
git-svn-id: file:///svn/unbound/trunk@1908 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-16 14:32:04 +00:00
Wouter Wijngaards c0093acd97 CLOSEST trust anchors tested with CNAME and NSEC3 optout.
git-svn-id: file:///svn/unbound/trunk@1907 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-16 14:13:58 +00:00
Wouter Wijngaards 62ab524058 Fix#282 libunbound memleak on error condition by Eric Sesterhenn.
git-svn-id: file:///svn/unbound/trunk@1906 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-16 13:36:54 +00:00
Wouter Wijngaards c56fdce932 Fixup unsigned CNAME to signed CNAME detection of signatures.
git-svn-id: file:///svn/unbound/trunk@1905 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-16 13:34:03 +00:00
Wouter Wijngaards 502a542820 please lint
git-svn-id: file:///svn/unbound/trunk@1904 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-13 15:03:01 +00:00
Wouter Wijngaards 23af66982c - unbound-host does not fail on type ANY.
- Fixed wireparse failure to put RRSIGs together with data in some
	  long ANY mix cases, which fixes validation failures.


git-svn-id: file:///svn/unbound/trunk@1903 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-13 14:51:36 +00:00
Wouter Wijngaards a4a7894f79 Fix validation failure cnamenodata proof failed for hud.gov.
git-svn-id: file:///svn/unbound/trunk@1902 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-13 10:10:05 +00:00
Wouter Wijngaards 5423af1836 review fixes.
git-svn-id: file:///svn/unbound/trunk@1901 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-12 16:27:11 +00:00
Wouter Wijngaards e19f71ffa0 Fixup to clean errinf on restart so no extremely long printouts.
git-svn-id: file:///svn/unbound/trunk@1900 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-12 15:07:38 +00:00
Wouter Wijngaards 009b2d7c0b iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1899 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-12 09:12:06 +00:00
Wouter Wijngaards eb6253aa6c review comments. updated ldns tarball with 1.6.2.
git-svn-id: file:///svn/unbound/trunk@1898 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-11 16:18:38 +00:00
Wouter Wijngaards 5bc9a80e40 review fixes.
git-svn-id: file:///svn/unbound/trunk@1897 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-10 16:02:05 +00:00
Wouter Wijngaards 6e8e4e87b7 Fixed argument optionality in help output.
git-svn-id: file:///svn/unbound/trunk@1896 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-10 13:28:09 +00:00
Wouter Wijngaards ff33e077de Fix crash bug with DLV and dnssec-retry for the domain registered in it.
git-svn-id: file:///svn/unbound/trunk@1895 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-10 10:42:50 +00:00
Wouter Wijngaards 9890caff91 and error
git-svn-id: file:///svn/unbound/trunk@1894 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-10 08:15:08 +00:00
Wouter Wijngaards 45c07da4a0 debug code
git-svn-id: file:///svn/unbound/trunk@1893 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-09 16:26:24 +00:00
Wouter Wijngaards 7617c18be1 more error text
git-svn-id: file:///svn/unbound/trunk@1892 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-05 19:32:02 +00:00
Wouter Wijngaards 463d7e09c5 better error text.
git-svn-id: file:///svn/unbound/trunk@1891 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-05 19:22:50 +00:00
Wouter Wijngaards b3caa5ab37 pylib for python in different location test updated.
git-svn-id: file:///svn/unbound/trunk@1890 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-05 12:03:54 +00:00
Wouter Wijngaards 479bebfff4 please lint on FreeBSD6
git-svn-id: file:///svn/unbound/trunk@1889 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-05 11:12:06 +00:00
Wouter Wijngaards 586893d761 lint fixes on FreeBSD 7.
git-svn-id: file:///svn/unbound/trunk@1888 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-05 10:39:12 +00:00
Wouter Wijngaards 07f5b21b7b parameter documented
git-svn-id: file:///svn/unbound/trunk@1887 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-02 15:23:41 +00:00
Wouter Wijngaards 4f1a72bb75 GOST draft version -00 to -01 changes incorporated.
git-svn-id: file:///svn/unbound/trunk@1886 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-02 15:05:06 +00:00
Wouter Wijngaards aa8a6eeadf Unit test for fixed autotrust init with DS.
git-svn-id: file:///svn/unbound/trunk@1885 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-02 14:30:46 +00:00
Wouter Wijngaards bf8bc06860 Fix autotrust initialised with DS.
git-svn-id: file:///svn/unbound/trunk@1884 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-11-02 13:56:14 +00:00
Wouter Wijngaards 1727bfc34e please doxygen.
git-svn-id: file:///svn/unbound/trunk@1883 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-29 12:55:26 +00:00
Wouter Wijngaards 1d8013c67a do-udp: no fixed.
git-svn-id: file:///svn/unbound/trunk@1882 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-29 12:11:38 +00:00
Wouter Wijngaards 5b66f07e38 edns-buffer-size option.
git-svn-id: file:///svn/unbound/trunk@1881 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-29 10:37:44 +00:00
Wouter Wijngaards 81cfcd8053 iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1880 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-29 07:48:36 +00:00
Wouter Wijngaards 8171793d2a ldns tarball updated.
git-svn-id: file:///svn/unbound/trunk@1879 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-28 21:59:45 +00:00
Wouter Wijngaards 9a08ad419e sha256 support enabled by default.
git-svn-id: file:///svn/unbound/trunk@1878 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-28 21:56:54 +00:00
Wouter Wijngaards 3b78d84a7e iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1877 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-28 08:24:41 +00:00
Wouter Wijngaards d3bc6d6b5a Removed hard malloc failure reported by Greg Woods.
git-svn-id: file:///svn/unbound/trunk@1876 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-28 08:04:38 +00:00
Wouter Wijngaards 9bb3fdd547 iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1875 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-27 07:27:01 +00:00
Wouter Wijngaards f42d27e1a2 - Made new validator error string available from libunbound for
applications.  It is in result->why_bogus, a zero-terminated string.
	  unbound-host prints it by default if a result is bogus.
	  Also the errinf is public in module_qstate (for other modules).
	Binary API different. bumped library ABI version.


git-svn-id: file:///svn/unbound/trunk@1874 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-08 17:05:53 +00:00
Wouter Wijngaards d7868e4077 Fix double time subtraction in negative cache.
git-svn-id: file:///svn/unbound/trunk@1873 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-08 09:18:40 +00:00
Wouter Wijngaards 2c33330994 neater errors for algo and key failure.
git-svn-id: file:///svn/unbound/trunk@1872 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-08 08:02:00 +00:00
Wouter Wijngaards 7782cf2b97 More detailed errors.
git-svn-id: file:///svn/unbound/trunk@1871 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-08 07:23:49 +00:00
Wouter Wijngaards a909fa9a3a neater explanation for unsigned or signatureless negative DS replies.
git-svn-id: file:///svn/unbound/trunk@1870 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-08 06:57:23 +00:00
Wouter Wijngaards e0b639accd More vallog reason. Doxygen.
git-svn-id: file:///svn/unbound/trunk@1869 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-08 06:35:14 +00:00
Wouter Wijngaards ce45cbda6d - moved version number to 1.4.0 because of 1.3.4 release with only
the NSEC3 patch.
	- val-log-level: 2 shows extended error information for validation
	  failures, but still one (longish) line per failure.  For example:
	  validation failure <example.com. DNSKEY IN>: signature expired from
	  192.0.2.4 for trust anchor example.com. while building chain of trust
	  validation failure <www.example.com. A IN>: no signatures from
	  192.0.2.6 for key example.com. while building chain of trust



git-svn-id: file:///svn/unbound/trunk@1868 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-07 16:45:47 +00:00
Wouter Wijngaards 6f37df3b92 Fix trunk.
git-svn-id: file:///svn/unbound/trunk@1866 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-07 14:00:56 +00:00
Wouter Wijngaards b07370a4c2 Fix check for NSEC3 signatures
git-svn-id: file:///svn/unbound/trunk@1865 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-07 12:57:12 +00:00
Wouter Wijngaards 1a02ab895b Fix check for signatures.
git-svn-id: file:///svn/unbound/trunk@1864 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-07 12:56:57 +00:00
Wouter Wijngaards 989a6f4f89 typo in changelog
git-svn-id: file:///svn/unbound/trunk@1863 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-07 09:32:00 +00:00
Wouter Wijngaards 5ff6b1c5fb retry mode: empty non terminal.
git-svn-id: file:///svn/unbound/trunk@1862 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-07 08:53:09 +00:00
Wouter Wijngaards 4d49d792c3 retry mode: DNSKEY.
git-svn-id: file:///svn/unbound/trunk@1861 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-07 08:22:27 +00:00
Wouter Wijngaards 5d2e8e8e97 Retry mode, DS and prime.
git-svn-id: file:///svn/unbound/trunk@1860 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-07 07:52:02 +00:00
Wouter Wijngaards 455c3d130d Data retry on validation failure.
git-svn-id: file:///svn/unbound/trunk@1859 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-06 08:31:47 +00:00
Wouter Wijngaards c43987e8e1 iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1858 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-02 08:12:54 +00:00
Wouter Wijngaards 0679bf6502 Fix autotrust-5011 file used from libunbound (no probing by itself because
it may not have the processor whenever it likes).


git-svn-id: file:///svn/unbound/trunk@1857 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-02 08:08:44 +00:00
Wouter Wijngaards 35f077bc06 unbound-host -d and -C fix
git-svn-id: file:///svn/unbound/trunk@1856 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-10-02 07:51:36 +00:00
Wouter Wijngaards 71959c05df review fixes.
git-svn-id: file:///svn/unbound/trunk@1855 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-28 14:52:53 +00:00
Wouter Wijngaards 1c75281303 Read iana root multiline and prevent integer underflow.
git-svn-id: file:///svn/unbound/trunk@1854 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-28 13:14:01 +00:00
Wouter Wijngaards 5007a44e52 review fixes
git-svn-id: file:///svn/unbound/trunk@1853 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-25 15:20:29 +00:00
Wouter Wijngaards 2043463b6a review nits
git-svn-id: file:///svn/unbound/trunk@1852 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-25 11:16:43 +00:00
Wouter Wijngaards d59a8baec2 so-rcvbuf option.
git-svn-id: file:///svn/unbound/trunk@1851 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-25 08:54:50 +00:00
Wouter Wijngaards c467aabbf1 review comments
git-svn-id: file:///svn/unbound/trunk@1850 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-23 15:15:41 +00:00
Wouter Wijngaards 430a6bd697 Test of original autotrust formatted data.
git-svn-id: file:///svn/unbound/trunk@1849 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-23 12:50:42 +00:00
Wouter Wijngaards ee1c4c1cce Failure handling for 5011.
git-svn-id: file:///svn/unbound/trunk@1848 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-23 09:05:44 +00:00
Wouter Wijngaards 44e2f9b0d9 Can handle a number of keys for the trust point.
git-svn-id: file:///svn/unbound/trunk@1847 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-22 14:40:14 +00:00
Wouter Wijngaards 1f7304d146 revocation of trust anchors works.
git-svn-id: file:///svn/unbound/trunk@1846 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-22 14:04:43 +00:00
Wouter Wijngaards 9dc9f0a8e8 rfc5011 and algorithm rollover
git-svn-id: file:///svn/unbound/trunk@1845 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-22 12:20:21 +00:00
Wouter Wijngaards 19ab8e1429 remove memory leak from testbed
git-svn-id: file:///svn/unbound/trunk@1844 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-18 12:34:30 +00:00
Wouter Wijngaards aff6654685 Test TTLs and signatures.
git-svn-id: file:///svn/unbound/trunk@1843 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-18 11:23:50 +00:00
Wouter Wijngaards d0cef76cff Pick up revocations even if not normally validly signed.
git-svn-id: file:///svn/unbound/trunk@1842 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-18 10:13:06 +00:00
Wouter Wijngaards 82b8ddc9bb autotrust tests and fixes.
git-svn-id: file:///svn/unbound/trunk@1841 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-18 07:49:29 +00:00
Wouter Wijngaards 2588d76522 manual page fixes from Tony Finch
git-svn-id: file:///svn/unbound/trunk@1840 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-17 14:52:43 +00:00
Wouter Wijngaards 5d4249a6b0 spelling
git-svn-id: file:///svn/unbound/trunk@1839 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-17 14:38:20 +00:00
Wouter Wijngaards 2c134eb981 Changelog.
git-svn-id: file:///svn/unbound/trunk@1838 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-17 14:36:15 +00:00
Wouter Wijngaards c4cfcdab6b Fix problem with delegation where glue has expired.
git-svn-id: file:///svn/unbound/trunk@1837 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-17 14:36:06 +00:00
Wouter Wijngaards 75fbd42ca3 Fix unbound-host compile with --enable-alloc-checks.
git-svn-id: file:///svn/unbound/trunk@1836 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-17 10:50:44 +00:00
Wouter Wijngaards aae91da6d2 sharper match.
git-svn-id: file:///svn/unbound/trunk@1835 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-16 13:13:46 +00:00
Wouter Wijngaards 90b4b1dae9 Fixup memstats for pretty time print in log file.
git-svn-id: file:///svn/unbound/trunk@1834 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-16 13:01:51 +00:00
Wouter Wijngaards 795a25c117 Fixed memstats for log-ascii format.
git-svn-id: file:///svn/unbound/trunk@1833 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-16 12:56:00 +00:00
Wouter Wijngaards 45acda0535 Memory leak fix.
git-svn-id: file:///svn/unbound/trunk@1832 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-16 12:47:56 +00:00
Wouter Wijngaards 9c822ebc9e iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1831 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-15 14:15:24 +00:00
Wouter Wijngaards 165a235f4d debug prints for high verbosity
git-svn-id: file:///svn/unbound/trunk@1830 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-15 14:03:44 +00:00
Wouter Wijngaards 46d341b036 please lint
git-svn-id: file:///svn/unbound/trunk@1829 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-10 15:07:18 +00:00
Wouter Wijngaards 7923a28c13 line buffering
git-svn-id: file:///svn/unbound/trunk@1828 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-10 14:33:46 +00:00
Wouter Wijngaards 2e02003687 prettier compiling in optimize mode
git-svn-id: file:///svn/unbound/trunk@1827 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-10 14:16:19 +00:00
Wouter Wijngaards c611bbba3f ldns with parse fixes
git-svn-id: file:///svn/unbound/trunk@1826 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-10 13:54:03 +00:00
Wouter Wijngaards b322353d8b remove printf format warning
git-svn-id: file:///svn/unbound/trunk@1825 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-10 13:41:01 +00:00
Wouter Wijngaards 7ccf79d42d can print .bg key.
git-svn-id: file:///svn/unbound/trunk@1824 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-10 13:13:55 +00:00
Wouter Wijngaards d7dafa112b load_cache is meant for debugging.
git-svn-id: file:///svn/unbound/trunk@1823 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-10 10:09:24 +00:00
Wouter Wijngaards dcb11b2ee4 Fixup TTL too large bug for bogus responses.
git-svn-id: file:///svn/unbound/trunk@1822 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-10 10:01:36 +00:00
Wouter Wijngaards 30d0bf14eb lint fix
git-svn-id: file:///svn/unbound/trunk@1821 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-08 08:24:44 +00:00
Wouter Wijngaards 1f45bbbd63 Fixups.
git-svn-id: file:///svn/unbound/trunk@1820 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-08 07:20:47 +00:00
Wouter Wijngaards 3f68f01313 - autotrust testbound scenarios.
- autotrust fix that failure count is written to file.
        - autotrust fix that keys may become valid after add holddown time
          alone, before the probe returns.


git-svn-id: file:///svn/unbound/trunk@1819 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-07 14:34:29 +00:00
Wouter Wijngaards 18e9cbb39f fix python memory leak.
git-svn-id: file:///svn/unbound/trunk@1818 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-04 14:14:54 +00:00
Wouter Wijngaards ca9c1fa2a8 libevent-2.0 compatibility.
git-svn-id: file:///svn/unbound/trunk@1817 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-04 13:29:11 +00:00
Wouter Wijngaards 310cbbc372 Set path earlier.
git-svn-id: file:///svn/unbound/trunk@1816 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-04 12:22:46 +00:00
Wouter Wijngaards 3bca178111 Test the new doxygen pick up.
git-svn-id: file:///svn/unbound/trunk@1815 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-04 11:26:49 +00:00
Wouter Wijngaards 4774b8b129 Test new doxygen for automated tests.
git-svn-id: file:///svn/unbound/trunk@1814 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-04 10:35:17 +00:00
Wouter Wijngaards e46441787c source IP from python and doxygen fixes.
git-svn-id: file:///svn/unbound/trunk@1813 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 14:51:38 +00:00
Wouter Wijngaards cd3a1ff351 more enum fixes
git-svn-id: file:///svn/unbound/trunk@1812 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 12:28:17 +00:00
Wouter Wijngaards e80d0936f3 more enum fixes in ldns tarball
git-svn-id: file:///svn/unbound/trunk@1811 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 12:19:29 +00:00
Wouter Wijngaards 41a29b050b makefile fix ordering
git-svn-id: file:///svn/unbound/trunk@1810 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 12:19:18 +00:00
Wouter Wijngaards 37d8551a7a Makefile fix for parallel makes.
git-svn-id: file:///svn/unbound/trunk@1809 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 12:06:06 +00:00
Wouter Wijngaards 17ffb78b10 ldns-updated
git-svn-id: file:///svn/unbound/trunk@1808 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 12:04:39 +00:00
Wouter Wijngaards 51ba9a4856 check better for iphlpapi.h
git-svn-id: file:///svn/unbound/trunk@1807 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 10:19:06 +00:00
Wouter Wijngaards 0fc43d4a62 Luca Bruno's patch.
git-svn-id: file:///svn/unbound/trunk@1806 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 10:07:13 +00:00
Wouter Wijngaards e5cab7b264 document last change
git-svn-id: file:///svn/unbound/trunk@1805 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-03 09:29:54 +00:00
Wouter Wijngaards 8e2ef1caeb - TRAFFIC keyword for testbound. Simplifies test generation.
${range lower val upper} to check probe timeout values.
- test with 5011-prepublish rollover and revocation.
- fix revocation of RR for autotrust, stray exclamation mark.


git-svn-id: file:///svn/unbound/trunk@1804 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-02 13:11:52 +00:00
Wouter Wijngaards c7bea9d33a more keys for autotrust testing.
git-svn-id: file:///svn/unbound/trunk@1803 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-02 10:04:34 +00:00
Wouter Wijngaards 415236c002 active probe
git-svn-id: file:///svn/unbound/trunk@1802 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-01 14:47:57 +00:00
Wouter Wijngaards 0a35d358ee More lint.
git-svn-id: file:///svn/unbound/trunk@1801 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-01 13:15:51 +00:00
Wouter Wijngaards 544b3f8428 lint and doc
git-svn-id: file:///svn/unbound/trunk@1800 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-01 13:09:55 +00:00
Wouter Wijngaards 9f9edf9ce6 docs
git-svn-id: file:///svn/unbound/trunk@1799 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-01 13:07:38 +00:00
Wouter Wijngaards eb3eb4f250 randomise probe time.
git-svn-id: file:///svn/unbound/trunk@1798 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-01 12:45:10 +00:00
Wouter Wijngaards de7808f2e0 do not confuse lint
git-svn-id: file:///svn/unbound/trunk@1797 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-01 09:48:57 +00:00
Wouter Wijngaards 4f2461a124 macro arithmetic.
git-svn-id: file:///svn/unbound/trunk@1796 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-09-01 09:30:28 +00:00
Wouter Wijngaards a24f9ff9ea variable processing.
git-svn-id: file:///svn/unbound/trunk@1795 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-31 15:58:38 +00:00
Wouter Wijngaards dafe1ae21b try again
git-svn-id: file:///svn/unbound/trunk@1794 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-28 10:22:44 +00:00
Wouter Wijngaards b8c4d7088d please lint
git-svn-id: file:///svn/unbound/trunk@1793 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-28 09:49:11 +00:00
Wouter Wijngaards f974f7880b Fixup unbound-control for forwards and stubs.
git-svn-id: file:///svn/unbound/trunk@1792 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-28 09:43:05 +00:00
Wouter Wijngaards bad061a35a Empty callback.
git-svn-id: file:///svn/unbound/trunk@1791 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-27 15:22:48 +00:00
Wouter Wijngaards ba47856946 iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1790 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-27 10:24:13 +00:00
Wouter Wijngaards a1a71348bf Test for DLV DS lookup fix.
git-svn-id: file:///svn/unbound/trunk@1789 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-27 10:13:55 +00:00
Wouter Wijngaards e3b8b9bcea Test for DS lookup fix.
git-svn-id: file:///svn/unbound/trunk@1788 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-27 10:07:58 +00:00
Wouter Wijngaards 902323da2f autotrust probing and testbound with fake timer support.
git-svn-id: file:///svn/unbound/trunk@1787 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-26 13:23:49 +00:00
Wouter Wijngaards b422db1c80 clean up on exit because otherwise re-lex may not be possible
git-svn-id: file:///svn/unbound/trunk@1786 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 15:37:02 +00:00
Wouter Wijngaards 568253e4ff Fixup DS query handling.
git-svn-id: file:///svn/unbound/trunk@1785 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 15:15:10 +00:00
Wouter Wijngaards 6b959f8043 remove debug print
git-svn-id: file:///svn/unbound/trunk@1784 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 14:59:48 +00:00
Wouter Wijngaards ea36edbc03 less slash
git-svn-id: file:///svn/unbound/trunk@1783 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 14:08:11 +00:00
Wouter Wijngaards 0e7ff77cd2 prefix
git-svn-id: file:///svn/unbound/trunk@1782 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 14:01:25 +00:00
Wouter Wijngaards 012d05073b mingw32 fix
git-svn-id: file:///svn/unbound/trunk@1781 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 13:54:36 +00:00
Wouter Wijngaards b93f679049 configure detect ssl get_compression_methods and ctime_r fix.
git-svn-id: file:///svn/unbound/trunk@1780 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 13:05:31 +00:00
Wouter Wijngaards 6770898042 yylex_destroy configure.
git-svn-id: file:///svn/unbound/trunk@1779 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 12:10:24 +00:00
Wouter Wijngaards e89cbd00fa ctime_r compat definition
git-svn-id: file:///svn/unbound/trunk@1778 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 10:29:25 +00:00
Wouter Wijngaards b8a2dfb2c9 revoke point handling
git-svn-id: file:///svn/unbound/trunk@1777 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 10:02:17 +00:00
Wouter Wijngaards 7d90b75ce8 autotrust options
git-svn-id: file:///svn/unbound/trunk@1776 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 08:46:33 +00:00
Wouter Wijngaards 0210f4ae41 iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1775 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 08:07:47 +00:00
Wouter Wijngaards d8e6209a2e Fixup memleak in unsupported algorithm checks at startup.
git-svn-id: file:///svn/unbound/trunk@1774 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-25 06:51:00 +00:00
Wouter Wijngaards 4e176a0aa6 less memory leaks.
git-svn-id: file:///svn/unbound/trunk@1773 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-24 15:56:45 +00:00
Wouter Wijngaards 78ed2ec08a Cleaner memleak output.
git-svn-id: file:///svn/unbound/trunk@1772 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-24 15:30:05 +00:00
Wouter Wijngaards 6f1f6dafb5 autotrust test routines.
git-svn-id: file:///svn/unbound/trunk@1771 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-24 14:40:25 +00:00
Wouter Wijngaards 28be658942 debug routines and first brazilian prime has been done.
git-svn-id: file:///svn/unbound/trunk@1770 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-21 15:27:23 +00:00
Wouter Wijngaards ca94ca57b4 autotrust work
git-svn-id: file:///svn/unbound/trunk@1769 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-20 11:49:33 +00:00
Wouter Wijngaards 1e2111f593 iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1768 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-19 15:53:45 +00:00
Wouter Wijngaards 0deef63323 autotrust state table updates.
git-svn-id: file:///svn/unbound/trunk@1767 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-19 15:30:20 +00:00
Wouter Wijngaards 701b4ccdd6 autotrust event_update routine.
git-svn-id: file:///svn/unbound/trunk@1766 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-18 15:36:46 +00:00
Wouter Wijngaards a8dccbdd40 autotrust
git-svn-id: file:///svn/unbound/trunk@1765 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-17 15:58:27 +00:00
Wouter Wijngaards c42056b9aa Blacklist when 16 queries fail in a row.
git-svn-id: file:///svn/unbound/trunk@1764 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-17 12:43:23 +00:00
Wouter Wijngaards 1cd84ce84e make better use of the cache.
git-svn-id: file:///svn/unbound/trunk@1763 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-14 14:15:08 +00:00
Wouter Wijngaards 948567bea8 Fix bug in DLV. Iana portlist.
git-svn-id: file:///svn/unbound/trunk@1762 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-14 13:58:54 +00:00
Wouter Wijngaards ed67590f74 report RTT
git-svn-id: file:///svn/unbound/trunk@1761 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-14 08:35:46 +00:00
Wouter Wijngaards 21e791248f autotrust work
git-svn-id: file:///svn/unbound/trunk@1760 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-13 15:32:04 +00:00
Wouter Wijngaards a85b563d37 fixup
git-svn-id: file:///svn/unbound/trunk@1759 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-13 14:00:06 +00:00
Wouter Wijngaards 3251765048 autotrust work
git-svn-id: file:///svn/unbound/trunk@1758 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-12 15:26:47 +00:00
Wouter Wijngaards 5ecf670277 lint
git-svn-id: file:///svn/unbound/trunk@1757 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-11 14:25:34 +00:00
Wouter Wijngaards df59a81a56 iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1756 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-11 12:25:56 +00:00
Wouter Wijngaards f3579ce5f2 Nicer names for test files.
git-svn-id: file:///svn/unbound/trunk@1755 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-11 10:33:56 +00:00
Wouter Wijngaards f015b01072 updated unit tests.
git-svn-id: file:///svn/unbound/trunk@1754 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-11 10:24:45 +00:00
Wouter Wijngaards 01cd1823a4 GOST checked for. ldns-1.6.1 release candidate tarball.
git-svn-id: file:///svn/unbound/trunk@1753 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-11 10:02:53 +00:00
Wouter Wijngaards 0205e3ae29 Label as experimental, include ldns that does so.
git-svn-id: file:///svn/unbound/trunk@1752 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-10 09:09:29 +00:00
Wouter Wijngaards 48d786dcc8 nicer warning during GOST testing.
git-svn-id: file:///svn/unbound/trunk@1751 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-07 15:29:25 +00:00
Wouter Wijngaards 538ca28828 OpenSSL config() and small memory leak. No more ENGINE_load_gost().
git-svn-id: file:///svn/unbound/trunk@1750 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-07 15:23:35 +00:00
Wouter Wijngaards b6076e3b6d Tests for DS GOST.
git-svn-id: file:///svn/unbound/trunk@1749 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-06 14:45:40 +00:00
Wouter Wijngaards 783178c785 iana and ldns updated.
git-svn-id: file:///svn/unbound/trunk@1748 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-06 13:59:53 +00:00
Wouter Wijngaards 1f4222aa94 GOST support with --enable-gost.
git-svn-id: file:///svn/unbound/trunk@1747 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-06 13:38:55 +00:00
Wouter Wijngaards 74abf6ced0 trunk to 1.3.4
git-svn-id: file:///svn/unbound/trunk@1746 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-05 15:55:58 +00:00
Wouter Wijngaards 870b34a8ec noted.
git-svn-id: file:///svn/unbound/trunk@1745 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-04 14:28:17 +00:00
Wouter Wijngaards 75611ab90d iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1743 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-04 12:55:26 +00:00
Wouter Wijngaards 49d65b8ebf Test example signatures for rsasha256 and rsasha512.
git-svn-id: file:///svn/unbound/trunk@1742 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-04 12:45:51 +00:00
Wouter Wijngaards 6f4522a55c iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1741 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-03 09:04:06 +00:00
Wouter Wijngaards b97dbd3c8f Fix for Roland, tell why the error happens.
git-svn-id: file:///svn/unbound/trunk@1740 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-08-03 08:46:26 +00:00
Wouter Wijngaards 112df5ab6c iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1739 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-27 12:44:50 +00:00
Wouter Wijngaards a134925d91 Updated cacti files for request queue statistics counters.
git-svn-id: file:///svn/unbound/trunk@1738 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-27 12:35:48 +00:00
Wouter Wijngaards 38bc0800ee 1.3.3rc1 tag.
git-svn-id: file:///svn/unbound/trunk@1737 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-23 13:40:26 +00:00
Wouter Wijngaards dcea0777bf Fixup for root prime requests sent when not needed.
git-svn-id: file:///svn/unbound/trunk@1736 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-23 13:21:42 +00:00
Wouter Wijngaards 894ba681f0 Fixup lameness handling in server selection.
git-svn-id: file:///svn/unbound/trunk@1735 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-21 13:52:39 +00:00
Wouter Wijngaards 72aa0bad92 Log option for bogus only.
git-svn-id: file:///svn/unbound/trunk@1734 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-20 14:22:29 +00:00
Wouter Wijngaards f73ce55c6e nicer error message
git-svn-id: file:///svn/unbound/trunk@1733 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-20 13:31:45 +00:00
Wouter Wijngaards 658e84f7a0 root hints update-anchor.sh
git-svn-id: file:///svn/unbound/trunk@1732 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-20 09:43:40 +00:00
Wouter Wijngaards f1bd145b60 ignore transient sendto conditions.
git-svn-id: file:///svn/unbound/trunk@1731 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-20 08:35:13 +00:00
Wouter Wijngaards b5f7bf86ac makedist can setup.exe crosscompile
git-svn-id: file:///svn/unbound/trunk@1730 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-16 10:56:00 +00:00
Wouter Wijngaards 56d8c3d59d remove debug print
git-svn-id: file:///svn/unbound/trunk@1729 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-16 10:19:48 +00:00
Wouter Wijngaards 2b9e9b4111 fix replacement malloc
git-svn-id: file:///svn/unbound/trunk@1728 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-16 10:17:52 +00:00
Wouter Wijngaards d9a6ccfb52 Setup.exe making on crosscompile.
git-svn-id: file:///svn/unbound/trunk@1727 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-15 15:10:17 +00:00
Wouter Wijngaards cd5ac9634c with autoconf
git-svn-id: file:///svn/unbound/trunk@1726 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-15 14:24:45 +00:00
Wouter Wijngaards b5f2b7d36b fixup compile on XP.
git-svn-id: file:///svn/unbound/trunk@1725 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-15 13:47:58 +00:00
Wouter Wijngaards 91e49260a7 documented. Makefile slightly better at dependencies.
git-svn-id: file:///svn/unbound/trunk@1724 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-15 13:08:52 +00:00
Wouter Wijngaards a0d67a87f0 setup.exe can be created from crosscompile.
git-svn-id: file:///svn/unbound/trunk@1723 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-15 11:50:13 +00:00
Wouter Wijngaards 43d9c09372 crosscompile with mingw32 works.
git-svn-id: file:///svn/unbound/trunk@1722 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-14 14:44:53 +00:00
Wouter Wijngaards e33276b5c3 iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1721 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-14 08:24:23 +00:00
Wouter Wijngaards 630e83f58b ldns update and RAND_MAX clean up
git-svn-id: file:///svn/unbound/trunk@1720 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-14 07:54:05 +00:00
Wouter Wijngaards ff77c81fd1 fixup unit test for portability
git-svn-id: file:///svn/unbound/trunk@1719 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-13 17:06:11 +00:00
Wouter Wijngaards 560e1c86b3 reported by Mees de Roo
git-svn-id: file:///svn/unbound/trunk@1718 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-13 16:00:20 +00:00
Wouter Wijngaards 73da11fe07 Fix mingw ID randomness from 8 to 16 bits.
git-svn-id: file:///svn/unbound/trunk@1717 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-13 15:47:42 +00:00
Wouter Wijngaards 7b03403efd examine dnskey on child side retry.
git-svn-id: file:///svn/unbound/trunk@1716 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-13 14:14:11 +00:00
Wouter Wijngaards 902cad61c6 trunk moves to 1.3.3.
git-svn-id: file:///svn/unbound/trunk@1715 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-13 13:28:12 +00:00
Wouter Wijngaards 82f83d8d06 Fix for windows crash at start (after install for example)
git-svn-id: file:///svn/unbound/trunk@1713 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-13 07:45:19 +00:00
Wouter Wijngaards fa842c30de Final version
git-svn-id: file:///svn/unbound/trunk@1712 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-10 12:27:16 +00:00
Wouter Wijngaards 506af05011 child retry
git-svn-id: file:///svn/unbound/trunk@1711 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-10 10:01:58 +00:00
Wouter Wijngaards f644c06516 updated plans
git-svn-id: file:///svn/unbound/trunk@1710 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-09 14:48:31 +00:00
Wouter Wijngaards 9755c94372 version 1.3.2 in trunk
git-svn-id: file:///svn/unbound/trunk@1709 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-09 09:08:08 +00:00
Wouter Wijngaards f0138c1cca Tag 1.3.1
git-svn-id: file:///svn/unbound/trunk@1708 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-09 09:00:24 +00:00
Wouter Wijngaards 374a7f45c2 it could be worse
git-svn-id: file:///svn/unbound/trunk@1707 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-08 12:07:03 +00:00
Wouter Wijngaards f3b66c177b Second precision.
git-svn-id: file:///svn/unbound/trunk@1706 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-08 11:37:50 +00:00
Wouter Wijngaards d535e6919e more thinking
git-svn-id: file:///svn/unbound/trunk@1705 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-07 15:00:18 +00:00
Wouter Wijngaards 0c7b289051 iana portlist updated
git-svn-id: file:///svn/unbound/trunk@1704 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-07 10:37:56 +00:00
Wouter Wijngaards 5decb468c2 rrset id for cache flush
git-svn-id: file:///svn/unbound/trunk@1703 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-07 10:16:34 +00:00
Wouter Wijngaards 5e90d568eb updated fedora spec file.
git-svn-id: file:///svn/unbound/trunk@1702 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-06 17:02:41 +00:00
Wouter Wijngaards 9e8a5100ad updated fedora spec file
git-svn-id: file:///svn/unbound/trunk@1701 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-06 17:02:17 +00:00
Wouter Wijngaards 1dc1ffabb4 Plans.
git-svn-id: file:///svn/unbound/trunk@1700 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-06 14:51:58 +00:00
Wouter Wijngaards c299e49384 uname fixup.
git-svn-id: file:///svn/unbound/trunk@1699 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-06 12:13:15 +00:00
Wouter Wijngaards 8595d94e0f Prettier, comments from Jelte.
git-svn-id: file:///svn/unbound/trunk@1698 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-06 09:34:47 +00:00
Wouter Wijngaards bfceac5b2e reviewcomments
git-svn-id: file:///svn/unbound/trunk@1697 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-06 08:34:54 +00:00
Wouter Wijngaards b794eb84ac changelog
git-svn-id: file:///svn/unbound/trunk@1696 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-03 19:41:31 +00:00
Wouter Wijngaards 1cf8bdae51 Fix for linking when ldns installed.
git-svn-id: file:///svn/unbound/trunk@1695 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-03 19:40:14 +00:00
Wouter Wijngaards 1bc4092127 fixup
git-svn-id: file:///svn/unbound/trunk@1694 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-07-01 11:48:34 +00:00
Wouter Wijngaards 1e97b85e45 Ldns 1.6.0 to be.
git-svn-id: file:///svn/unbound/trunk@1693 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-30 14:08:39 +00:00
Wouter Wijngaards edae0ad954 More lenient.
git-svn-id: file:///svn/unbound/trunk@1692 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-30 13:20:02 +00:00
Wouter Wijngaards d453b4a43b More lenient checks.
git-svn-id: file:///svn/unbound/trunk@1691 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-30 12:50:57 +00:00
Wouter Wijngaards 7bd415ffdd Removed debug prints.
git-svn-id: file:///svn/unbound/trunk@1690 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-30 08:24:19 +00:00
Wouter Wijngaards d232dbd4a5 Linux IPv6 large response support.
git-svn-id: file:///svn/unbound/trunk@1689 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-29 13:47:48 +00:00
Wouter Wijngaards 373758092f ldns tarball update.
git-svn-id: file:///svn/unbound/trunk@1688 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-29 10:36:52 +00:00
Wouter Wijngaards b6406cae1e Better wrongly truncated check. And debug statements.
git-svn-id: file:///svn/unbound/trunk@1687 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-29 10:15:27 +00:00
Wouter Wijngaards 298aff3ad2 ldns tarball update.
git-svn-id: file:///svn/unbound/trunk@1686 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-29 09:59:43 +00:00
Wouter Wijngaards efee0803d0 debugprint for wrongly_truncated
git-svn-id: file:///svn/unbound/trunk@1685 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-29 08:52:58 +00:00
Wouter Wijngaards ec30ae3ca6 Fixup for EDNS probe (neater than patch on mailing list).
git-svn-id: file:///svn/unbound/trunk@1684 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-26 13:15:06 +00:00
Wouter Wijngaards 4ead61eb63 Updated fedora spec file, with python support.
git-svn-id: file:///svn/unbound/trunk@1683 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-22 15:00:21 +00:00
Wouter Wijngaards 206a6bb539 iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1682 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-22 08:04:01 +00:00
Wouter Wijngaards fb5fa2bdb1 and changelog separate.
git-svn-id: file:///svn/unbound/trunk@1681 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-22 07:56:27 +00:00
Wouter Wijngaards 8b2f5dcaf0 Fixup strict aliasing safer.
git-svn-id: file:///svn/unbound/trunk@1680 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-22 07:56:19 +00:00
Wouter Wijngaards 4d97a3a400 documentation
git-svn-id: file:///svn/unbound/trunk@1679 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-19 11:40:44 +00:00
Wouter Wijngaards 368dc659ea Handle referral path check cases where NS is in the answer section.
git-svn-id: file:///svn/unbound/trunk@1678 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-19 08:55:12 +00:00
Wouter Wijngaards e49e0539d8 newer bison.
git-svn-id: file:///svn/unbound/trunk@1677 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-19 07:47:46 +00:00
Wouter Wijngaards aec8f4644f strict aliasing warning in config_file code.
git-svn-id: file:///svn/unbound/trunk@1676 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-19 07:45:45 +00:00
Wouter Wijngaards 6f745bc49e iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1675 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-19 07:27:53 +00:00
Wouter Wijngaards ef564b5a29 Fixup strict aliasing warning on Fedora 11.
git-svn-id: file:///svn/unbound/trunk@1674 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-19 07:09:12 +00:00
Wouter Wijngaards c1b2364d1d please lint
git-svn-id: file:///svn/unbound/trunk@1673 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-18 14:39:50 +00:00
Wouter Wijngaards 790fe91662 python warning suppress.
git-svn-id: file:///svn/unbound/trunk@1672 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-18 14:28:28 +00:00
Wouter Wijngaards 819f9d817a autoconf 2.63 for configure
git-svn-id: file:///svn/unbound/trunk@1671 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-18 14:08:56 +00:00
Wouter Wijngaards e0bc4f2c97 extremely lenient for truncated positive replies
git-svn-id: file:///svn/unbound/trunk@1670 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-18 10:59:59 +00:00
Wouter Wijngaards efcb61fb22 Fixup parse problem reported by Hauke Lampe.
git-svn-id: file:///svn/unbound/trunk@1669 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-18 09:31:58 +00:00
Wouter Wijngaards d94c548dab non-TODO.
git-svn-id: file:///svn/unbound/trunk@1668 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-17 15:18:38 +00:00
Wouter Wijngaards a18c4eaebc Do later, notabug but a feature.
git-svn-id: file:///svn/unbound/trunk@1667 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-17 14:58:07 +00:00
Wouter Wijngaards e92fd4ff33 typo
git-svn-id: file:///svn/unbound/trunk@1666 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-17 11:55:48 +00:00
Wouter Wijngaards 7bd75483e1 credits entry for cz.nic
git-svn-id: file:///svn/unbound/trunk@1665 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-17 07:12:16 +00:00
Wouter Wijngaards 573fd6652b Extra test, but no dlv negative cache failures discovered.
git-svn-id: file:///svn/unbound/trunk@1664 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-16 14:57:19 +00:00
Wouter Wijngaards 13d2817b62 python testenv easier to use.
git-svn-id: file:///svn/unbound/trunk@1663 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-16 12:38:46 +00:00
Wouter Wijngaards f39e5fe3a8 check messages taken from cache, also in iterator.
git-svn-id: file:///svn/unbound/trunk@1662 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-16 12:03:41 +00:00
Wouter Wijngaards a569062627 touchup to munin memory report
git-svn-id: file:///svn/unbound/trunk@1661 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-16 09:34:18 +00:00
Wouter Wijngaards a40ec4b935 Fix max depth check.
git-svn-id: file:///svn/unbound/trunk@1660 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-16 09:06:52 +00:00
Wouter Wijngaards 427ddba6d7 iana portlist updated.
git-svn-id: file:///svn/unbound/trunk@1659 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-16 08:31:07 +00:00
Wouter Wijngaards b757b29910 FAQ entry.
git-svn-id: file:///svn/unbound/trunk@1658 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-16 08:23:32 +00:00
Wouter Wijngaards 3898abde02 Fixup DLV lookups and pickup responses from cache.
git-svn-id: file:///svn/unbound/trunk@1657 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-15 13:27:53 +00:00
Wouter Wijngaards 8466ac7e7f bug #254, whitespace in example.conf
git-svn-id: file:///svn/unbound/trunk@1656 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-13 09:49:53 +00:00
Wouter Wijngaards 80f6ed2ff0 Check right value.
git-svn-id: file:///svn/unbound/trunk@1655 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-12 14:16:13 +00:00
Wouter Wijngaards 19d72a41cb todo
git-svn-id: file:///svn/unbound/trunk@1654 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-12 10:04:29 +00:00
Wouter Wijngaards 07411c16a9 Fixup stub below a forward, the stub is still honored and not trumped by the
forward zone.


git-svn-id: file:///svn/unbound/trunk@1653 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-12 09:01:42 +00:00
Wouter Wijngaards 5ca6d8c50b mesh callbacks review, call error if deleted unfulfilled, check fptr wlist.
git-svn-id: file:///svn/unbound/trunk@1652 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-12 07:53:36 +00:00
Wouter Wijngaards 16e920f416 Fixed potential wrong NSEC, but the bug could not be triggered. Unit test
added anyway.


git-svn-id: file:///svn/unbound/trunk@1651 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-12 07:23:04 +00:00
Wouter Wijngaards 89f0fd7252 forward-zone and DS fixup. Test.
git-svn-id: file:///svn/unbound/trunk@1650 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-11 18:54:07 +00:00
Wouter Wijngaards a40ec010be Got contributed script to turn etc hosts into unbound config.
git-svn-id: file:///svn/unbound/trunk@1649 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-11 18:30:53 +00:00
Wouter Wijngaards 1b8519e619 Fixup stub chain of trust from public to private servers.
git-svn-id: file:///svn/unbound/trunk@1648 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-11 14:02:37 +00:00
Wouter Wijngaards add0079981 And review fixup recommit.
git-svn-id: file:///svn/unbound/trunk@1647 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-11 10:52:28 +00:00
Wouter Wijngaards 2c56564e4e recommit 9 June 2009.
git-svn-id: file:///svn/unbound/trunk@1646 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-11 09:43:23 +00:00
Wouter Wijngaards baaaae857a munin show total memory if sbrk trick does not work (eg. FreeBSD).
git-svn-id: file:///svn/unbound/trunk@1645 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-08 15:43:15 +00:00
Wouter Wijngaards b6099d5f55 fail python if no swig
git-svn-id: file:///svn/unbound/trunk@1644 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-08 14:53:27 +00:00
Wouter Wijngaards 8c36960c29 lint, aliasing.
git-svn-id: file:///svn/unbound/trunk@1643 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-08 14:51:00 +00:00
Wouter Wijngaards 3c5c0b2727 iana post list updated.
git-svn-id: file:///svn/unbound/trunk@1642 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-08 13:55:58 +00:00
Wouter Wijngaards 6dd6542f04 TODO items.
git-svn-id: file:///svn/unbound/trunk@1641 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-08 13:47:06 +00:00
Wouter Wijngaards 6451748967 Remove REVOKE flag support.
git-svn-id: file:///svn/unbound/trunk@1639 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-08 08:29:17 +00:00
Wouter Wijngaards b2ff49e4c4 review comments Matthijs.
git-svn-id: file:///svn/unbound/trunk@1637 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-03 08:06:42 +00:00
Wouter Wijngaards 38ec4f4777 Fixup bad free.
git-svn-id: file:///svn/unbound/trunk@1635 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-03 07:57:19 +00:00
Wouter Wijngaards 413d579e58 1.3.0 tag remove
git-svn-id: file:///svn/unbound/trunk@1633 be551aaa-1e26-0410-a405-d3ace91eadb9
2009-06-02 13:44:57 +00:00
262 changed files with 46422 additions and 24894 deletions
+55 -45
View File
@@ -5,8 +5,10 @@ debug_enabled=@debug_enabled@
ifeq "$(QUIET)" ""
ifeq ($(debug_enabled),yes)
QUIET=yes
LIBTOOLQUIET=yes
else
QUIET=no
LIBTOOLQUIET=yes
endif
endif
@@ -35,6 +37,7 @@ doxygen=@doxygen@
libtool=@libtool@
ldnsdir=@ldnsdir@
staticexe=@staticexe@
EXEEXT=@EXEEXT@
configfile=@ub_conf_file@
UNBOUND_RUN_DIR=@UNBOUND_RUN_DIR@
CHECKLOCK_SRC=@CHECKLOCK_SRC@
@@ -46,6 +49,7 @@ PYTHON_SITE_PKG=@PYTHON_SITE_PKG@
SWIG=@SWIG@
YACC=@YACC@
LEX=@LEX@
STRIP=@STRIP@
CC=@CC@
CPPFLAGS=-I. @CPPFLAGS@
ifneq "$(srcdir)" "."
@@ -60,16 +64,16 @@ RUNTIME_PATH=@RUNTIME_PATH@
DEPFLAG=@DEPFLAG@
DATE=$(shell date +%Y%m%d)
LIBTOOL=$(libtool)
ifeq "$(QUIET)" "yes"
ifeq "$(LIBTOOLQUIET)" "yes"
LIBTOOL+=--quiet
endif
BUILD=build/
WINDRES=windres
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
# 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
LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray
INSTALL=$(srcdir)/install-sh
ifeq "$(WITH_PYTHONMODULE)" "yes"
@@ -82,6 +86,7 @@ COMMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/services/*.c \
$(srcdir)/iterator/*.c $(srcdir)/validator/*.c $(PYTHONMOD_SRC))) \
util/configparser.c util/configlexer.c $(CHECKLOCK_SRC)
COMMON_OBJ=$(addprefix $(BUILD),$(COMMON_SRC:.c=.lo))
COMPAT_SRC=$(addprefix compat/,$(LIBOBJS:.o=.c))
COMPAT_OBJ=$(addprefix $(BUILD)compat/,$(LIBOBJS:.o=.lo))
UNITTEST_SRC=$(patsubst $(srcdir)/%,%, \
$(wildcard $(srcdir)/testcode/unit*.c)) \
@@ -139,15 +144,17 @@ ifeq "$(UB_ON_WINDOWS)" "yes"
CONTROL_OBJ+=$(BUILD)winrc/rsrc_unbound_control.o
CHECKCONF_OBJ+=$(BUILD)winrc/rsrc_unbound_checkconf.o
WINAPPS=unbound-service-install unbound-service-remove anchor-update
WINAPPS=$(addsuffix $(EXEEXT), unbound-service-install \
unbound-service-remove anchor-update)
COMPAT_WINAPP=$(filter-out $(BUILD)compat/ctime_r.lo, $(COMPAT_OBJ))
SVCINST_SRC=winrc/unbound-service-install.c winrc/w_inst.c
SVCINST_OBJ=$(addprefix $(BUILD),$(SVCINST_SRC:.c=.lo)) $(COMPAT_OBJ) \
SVCINST_OBJ=$(addprefix $(BUILD),$(SVCINST_SRC:.c=.lo)) $(COMPAT_WINAPP) \
$(BUILD)winrc/rsrc_svcinst.o
SVCUNINST_SRC=winrc/unbound-service-remove.c winrc/w_inst.c
SVCUNINST_OBJ=$(addprefix $(BUILD),$(SVCUNINST_SRC:.c=.lo)) $(COMPAT_OBJ) \
SVCUNINST_OBJ=$(addprefix $(BUILD),$(SVCUNINST_SRC:.c=.lo)) $(COMPAT_WINAPP) \
$(BUILD)winrc/rsrc_svcuninst.o
ANCHORUPD_SRC=winrc/anchor-update.c
ANCHORUPD_OBJ=$(addprefix $(BUILD),$(ANCHORUPD_SRC:.c=.lo)) $(COMPAT_OBJ) \
ANCHORUPD_OBJ=$(addprefix $(BUILD),$(ANCHORUPD_SRC:.c=.lo)) $(COMPAT_WINAPP) \
$(BUILD)winrc/rsrc_anchorupd.o
ALL_SRC:=$(sort $(ALL_SRC) $(SVCINST_SRC) $(SVCUNINST_SRC) $(ANCHORUPD_SRC))
ALL_OBJ:=$(sort $(ALL_OBJ) $(SVCINST_OBJ) $(SVCUNINST_OBJ) $(ANCHORUPD_OBJ))
@@ -171,12 +178,12 @@ $(BUILD)%.lo: $(srcdir)/%.c
@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) -c $< -o $@
$Q$(COMPILE) -o $@ -c $<
all: $(COMMON_OBJ) unbound unbound-checkconf lib unbound-host unbound-control unbound-control-setup $(WINAPPS)
all: $(COMMON_OBJ) unbound$(EXEEXT) unbound-checkconf$(EXEEXT) lib unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-control-setup $(WINAPPS)
TEST_BIN=asynclook delayer harvest lock-verify memstats perf pktview signit \
streamtcp testbound unittest
TEST_BIN=$(addsuffix $(EXEEXT),asynclook delayer harvest lock-verify \
memstats perf pktview signit streamtcp testbound unittest)
tests: all $(TEST_BIN)
test: tests
@@ -184,88 +191,89 @@ test: tests
lib: libunbound.la
libunbound.la: $(LIBUNBOUND_OBJ)
$(INFO) Link $@
$Q$(LINK_LIB) -export-symbols $(srcdir)/libunbound/ubsyms.def -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)
ifeq ($(patsubst ldns-src%,ldns-src,$(ldnsdir)),ldns-src)
ldnslib=$(ldnsdir)/lib/libldns.a
$(ldnslib):
$(ldnslib): $(ldnsdir)/lib
$(ldnsdir)/lib:
@if test ! -z "$(ldnsdir)"; \
then (cd $(ldnsdir) && $(MAKE)); fi
else
ldnslib=
endif
unbound: $(DAEMON_OBJ) $(ldnslib)
libunbound.la: $(LIBUNBOUND_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK_LIB) -export-symbols $(srcdir)/libunbound/ubsyms.def -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)
unbound$(EXEEXT): $(DAEMON_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(DAEMON_OBJ)) -lssl $(LIBS)
unbound-checkconf: $(CHECKCONF_OBJ) $(ldnslib)
unbound-checkconf$(EXEEXT): $(CHECKCONF_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(CHECKCONF_OBJ)) $(LIBS)
unbound-control: $(CONTROL_OBJ) $(ldnslib)
unbound-control$(EXEEXT): $(CONTROL_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(CONTROL_OBJ)) -lssl $(LIBS)
unbound-host: $(HOST_OBJ) libunbound.la $(ldnslib)
unbound-host$(EXEEXT): $(HOST_OBJ) libunbound.la $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(HOST_OBJ)) -L. -L.libs -lunbound $(LIBS)
unbound-service-install: $(SVCINST_OBJ)
unbound-service-install$(EXEEXT): $(SVCINST_OBJ)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(SVCINST_OBJ)) $(LIBS)
unbound-service-remove: $(SVCUNINST_OBJ)
unbound-service-remove$(EXEEXT): $(SVCUNINST_OBJ)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(SVCUNINST_OBJ)) $(LIBS)
anchor-update: $(ANCHORUPD_OBJ) libunbound.la $(ldnslib)
anchor-update$(EXEEXT): $(ANCHORUPD_OBJ) libunbound.la $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(ANCHORUPD_OBJ)) -L. -L.libs -lunbound $(LIBS)
unittest: $(UNITTEST_OBJ) $(ldnslib)
unittest$(EXEEXT): $(UNITTEST_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(UNITTEST_OBJ)) $(LIBS)
testbound: $(TESTBOUND_OBJ) $(ldnslib)
testbound$(EXEEXT): $(TESTBOUND_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(TESTBOUND_OBJ)) -lssl $(LIBS)
lock-verify: $(LOCKVERIFY_OBJ) $(ldnslib)
lock-verify$(EXEEXT): $(LOCKVERIFY_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(LOCKVERIFY_OBJ)) $(LIBS)
pktview: $(PKTVIEW_OBJ) $(ldnslib)
pktview$(EXEEXT): $(PKTVIEW_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(PKTVIEW_OBJ)) $(LIBS)
signit: $(SIGNIT_OBJ) $(ldnslib)
signit$(EXEEXT): $(SIGNIT_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(SIGNIT_OBJ)) $(LIBS)
memstats: $(MEMSTATS_OBJ) $(ldnslib)
memstats$(EXEEXT): $(MEMSTATS_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(MEMSTATS_OBJ)) $(LIBS)
asynclook: $(ASYNCLOOK_OBJ) $(ldnslib) libunbound.la
asynclook$(EXEEXT): $(ASYNCLOOK_OBJ) $(ldnslib) libunbound.la
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(ASYNCLOOK_OBJ)) $(LIBS) -L. -L.libs -lunbound
streamtcp: $(STREAMTCP_OBJ) $(ldnslib)
streamtcp$(EXEEXT): $(STREAMTCP_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(STREAMTCP_OBJ)) $(LIBS)
perf: $(PERF_OBJ) $(ldnslib)
perf$(EXEEXT): $(PERF_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(PERF_OBJ)) $(LIBS)
delayer: $(DELAYER_OBJ) $(ldnslib)
delayer$(EXEEXT): $(DELAYER_OBJ) $(ldnslib)
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(DELAYER_OBJ)) $(LIBS)
harvest: $(HARVEST_OBJ) $(ldnslib) libunbound.la
harvest$(EXEEXT): $(HARVEST_OBJ) $(ldnslib) libunbound.la
$(INFO) Link $@
$Q$(LINK) -o $@ $(sort $(HARVEST_OBJ)) $(LIBS) -L. -L.libs -lunbound
@@ -318,7 +326,7 @@ util/configparser.c util/configparser.h: $(srcdir)/util/configparser.y
clean:
rm -f *.o *.d *.lo *~ tags
rm -f unbound unbound-checkconf unbound-host unbound-control unbound-control-setup libunbound.la
rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-control-setup libunbound.la
rm -rf autom4te.cache .libs build doc/html doc/xml
realclean: clean
@@ -343,16 +351,18 @@ tags: $(srcdir)/*.[ch] $(srcdir)/*/*.[ch]
doc:
if test -n "$(doxygen)"; then \
$(doxygen) $(srcdir)/doc/unbound.doxygen; fi
ifeq "$(findstring yes,$(WITH_PYUNBOUND)$(WITH_PYTHONMODULE))" "yes"
if test -x "`which sphinx-build 2>&1`"; then \
sphinx-build -b html pythonmod/doc doc/html/pythonmod; \
sphinx-build -b html libunbound/python/doc doc/html/pyunbound;\
fi
endif
strip:
strip unbound
strip unbound-checkconf
strip unbound-control
strip unbound-host
$(STRIP) unbound$(EXEEXT)
$(STRIP) unbound-checkconf$(EXEEXT)
$(STRIP) unbound-control$(EXEEXT)
$(STRIP) unbound-host$(EXEEXT)
install:
$(INSTALL) -m 755 -d $(DESTDIR)$(sbindir)
@@ -363,10 +373,10 @@ install:
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 755 -d $(DESTDIR)$(libdir)
$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
$(LIBTOOL) --mode=install cp unbound $(DESTDIR)$(sbindir)/unbound
$(LIBTOOL) --mode=install cp unbound-checkconf $(DESTDIR)$(sbindir)/unbound-checkconf
$(LIBTOOL) --mode=install cp unbound-control $(DESTDIR)$(sbindir)/unbound-control
$(LIBTOOL) --mode=install cp unbound-host $(DESTDIR)$(sbindir)/unbound-host
$(LIBTOOL) --mode=install cp unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound$(EXEEXT)
$(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)
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
@@ -389,7 +399,7 @@ endif
$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
uninstall:
rm -f -- $(DESTDIR)$(sbindir)/unbound $(DESTDIR)$(sbindir)/unbound-checkconf $(DESTDIR)$(sbindir)/unbound-host $(DESTDIR)$(sbindir)/unbound-control $(DESTDIR)$(sbindir)/unbound-control-setup
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)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3
rm -f -- $(DESTDIR)$(includedir)/unbound.h
@@ -427,7 +437,7 @@ $(BUILD)%.d: $(srcdir)/%.c
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),realclean)
ifeq ($(debug_enabled),yes)
-include $(addprefix $(BUILD),$(ALL_SRC:.c=.d))
-include $(addprefix $(BUILD),$(ALL_SRC:.c=.d) $(COMPAT_SRC:.c=.d))
endif
endif
endif
Vendored
+5344 -3963
View File
File diff suppressed because it is too large Load Diff
+144 -87
View File
@@ -2,8 +2,14 @@
# Copyright 2009, Wouter Wijngaards, NLnet Labs.
# BSD licensed.
#
# Version 1
# 2009-04-23
# Version 4
# Changelog
# 2009-07-14 U_CHAR detection improved for windows crosscompile.
# added ACX_FUNC_MALLOC
# fixup some #if to #ifdef
# NONBLOCKING test for mingw crosscompile.
# 2009-07-13 added ACX_WITH_SSL_OPTIONAL
# 2009-07-03 fixup LDFLAGS for empty ssl dir.
#
# Automates some of the checking constructs. Aims at portability for POSIX.
# Documentation for functions is below.
@@ -28,6 +34,8 @@
# ACX_TYPE_IN_PORT_T - in_port_t type.
# ACX_ARG_RPATH - add --disable-rpath option.
# ACX_WITH_SSL - add --with-ssl option, link -lcrypto.
# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto,
# where --without-ssl is also accepted
# ACX_LIB_SSL - setup to link -lssl.
# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files.
# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably.
@@ -35,6 +43,7 @@
# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work.
# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments.
# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably.
# ACX_FUNC_MALLOC - check malloc, define replacement .
# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format.
# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused.
# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback.
@@ -478,14 +487,20 @@ AC_PROG_LIBTOOL
dnl Detect if u_char type is defined, otherwise define it.
AC_DEFUN([ACX_TYPE_U_CHAR],
[AC_CHECK_TYPE(u_char, unsigned char)])
[AC_CHECK_TYPE([u_char], ,
[AC_DEFINE([u_char], [unsigned char], [Define to 'unsigned char if not defined])], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
]) ])
dnl Detect if rlim_t type is defined, otherwise define it.
AC_DEFUN([ACX_TYPE_RLIM_T],
[AC_CHECK_TYPE(rlim_t, ,
[AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_RESOURCE_H
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
]) ])
@@ -496,31 +511,34 @@ AC_DEFUN([ACX_TYPE_SOCKLEN_T],
AC_CHECK_TYPE(socklen_t, ,
[AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_SOCKET_H
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_WS2TCPIP_H
# include <ws2tcpip.h>
#endif
]) ])
dnl Detect if socklen_t type is defined, otherwise define it.
dnl Detect if in_addr_t type is defined, otherwise define it.
AC_DEFUN([ACX_TYPE_IN_ADDR_T],
[ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_H
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]) ])
dnl Detect if socklen_t type is defined, otherwise define it.
dnl Detect if in_port_t type is defined, otherwise define it.
AC_DEFUN([ACX_TYPE_IN_PORT_T],
[ AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_TYPES_H
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_H
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]) ])
@@ -553,7 +571,89 @@ AC_DEFUN([ACX_RUNTIME_PATH_ADD], [
fi
])
dnl Check for SSL.
dnl Common code for both ACX_WITH_SSL and ACX_WITH_SSL_OPTIONAL
dnl Takes one argument; the withval checked in those 2 functions
dnl sets up the environment for the given openssl path
AC_DEFUN([ACX_SSL_CHECKS], [
withval=$1
if test x_$withval != x_no; then
AC_MSG_CHECKING(for SSL)
if test x_$withval = x_ -o x_$withval = x_yes; then
withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr"
fi
for dir in $withval; do
ssldir="$dir"
if test -f "$dir/include/openssl/ssl.h"; then
found_ssl="yes"
AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.])
dnl assume /usr/include is already in the include-path.
if test "$ssldir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$ssldir/include"
fi
break;
fi
done
if test x_$found_ssl != x_yes; then
AC_MSG_ERROR(Cannot find the SSL libraries in $withval)
else
AC_MSG_RESULT(found in $ssldir)
HAVE_SSL=yes
dnl assume /usr is already in the lib and dynlib paths.
if test "$ssldir" != "/usr" -a "$ssldir" != ""; then
LDFLAGS="$LDFLAGS -L$ssldir/lib"
ACX_RUNTIME_PATH_ADD([$ssldir/lib])
fi
AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto])
LIBS="$LIBS -lcrypto"
AC_TRY_LINK(, [
int HMAC_CTX_init(void);
(void)HMAC_CTX_init();
], [
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
[If you have HMAC_CTX_init])
], [
AC_MSG_RESULT(no)
# check if -lwsock32 or -lgdi32 are needed.
BAKLIBS="$LIBS"
LIBS="$LIBS -lgdi32"
AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
AC_TRY_LINK([], [
int HMAC_CTX_init(void);
(void)HMAC_CTX_init();
],[
AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
[If you have HMAC_CTX_init])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
LIBS="$BAKLIBS"
LIBS="$LIBS -ldl"
AC_MSG_CHECKING([if -lcrypto needs -ldl])
AC_TRY_LINK([], [
int HMAC_CTX_init(void);
(void)HMAC_CTX_init();
],[
AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
[If you have HMAC_CTX_init])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
])
])
])
fi
AC_SUBST(HAVE_SSL)
AC_SUBST(RUNTIME_PATH)
fi
AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT])
])dnl End of ACX_SSL_CHECKS
dnl Check for SSL, where SSL is mandatory
dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS.
dnl Checks main header files of SSL.
@@ -569,83 +669,25 @@ AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
if test x_$withval = x_no; then
AC_MSG_ERROR([Need SSL library to do digital signature cryptography])
fi
if test x_$withval != x_no; then
AC_MSG_CHECKING(for SSL)
if test x_$withval = x_ -o x_$withval = x_yes; then
withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr"
fi
for dir in $withval; do
ssldir="$dir"
if test -f "$dir/include/openssl/ssl.h"; then
found_ssl="yes"
AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.])
dnl assume /usr/include is already in the include-path.
if test "$ssldir" != "/usr"; then
CPPFLAGS="$CPPFLAGS -I$ssldir/include"
fi
break;
fi
done
if test x_$found_ssl != x_yes; then
AC_MSG_ERROR(Cannot find the SSL libraries in $withval)
else
AC_MSG_RESULT(found in $ssldir)
HAVE_SSL=yes
dnl assume /usr is already in the lib and dynlib paths.
if test "$ssldir" != "/usr"; then
LDFLAGS="$LDFLAGS -L$ssldir/lib"
ACX_RUNTIME_PATH_ADD([$ssldir/lib])
fi
AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto])
LIBS="$LIBS -lcrypto"
AC_TRY_LINK(, [
int HMAC_CTX_init(void);
(void)HMAC_CTX_init();
], [
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
[If you have HMAC_CTX_init])
], [
AC_MSG_RESULT(no)
# check if -lwsock32 or -lgdi32 are needed.
BAKLIBS="$LIBS"
LIBS="$LIBS -lgdi32"
AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
AC_TRY_LINK([], [
int HMAC_CTX_init(void);
(void)HMAC_CTX_init();
],[
AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
[If you have HMAC_CTX_init])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
LIBS="$BAKLIBS"
LIBS="$LIBS -ldl"
AC_MSG_CHECKING([if -lcrypto needs -ldl])
AC_TRY_LINK([], [
int HMAC_CTX_init(void);
(void)HMAC_CTX_init();
],[
AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
[If you have HMAC_CTX_init])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
])
])
])
fi
AC_SUBST(HAVE_SSL)
AC_SUBST(RUNTIME_PATH)
fi
AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT])
ACX_SSL_CHECKS($withval)
])dnl End of ACX_WITH_SSL
dnl Check for SSL, where ssl is optional (--without-ssl is allowed)
dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS.
dnl Checks main header files of SSL.
dnl
AC_DEFUN([ACX_WITH_SSL_OPTIONAL],
[
AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
[enable SSL (will check /usr/local/ssl
/usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[
],[
withval="yes"
])
ACX_SSL_CHECKS($withval)
])dnl End of ACX_WITH_SSL_OPTIONAL
dnl Setup to use -lssl
dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one).
AC_DEFUN([ACX_LIB_SSL],
@@ -777,6 +819,10 @@ dnl a nonblocking socket do not work, a new call to select is necessary.
AC_DEFUN([ACX_CHECK_NONBLOCKING_BROKEN],
[
AC_MSG_CHECKING([if nonblocking sockets work])
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([
#include <stdio.h>
#include <string.h>
@@ -902,6 +948,7 @@ AC_RUN_IFELSE(AC_LANG_PROGRAM([
], [
AC_MSG_RESULT([crosscompile(yes)])
])
fi
])dnl End of ACX_CHECK_NONBLOCKING_BROKEN
dnl Check if mkdir has one or two arguments.
@@ -945,6 +992,16 @@ AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available])
],[AC_MSG_RESULT(no)])
])dnl end of ACX_FUNC_IOCTLSOCKET
dnl detect malloc and provide malloc compat prototype.
dnl $1: unique name for compat code
AC_DEFUN([ACX_FUNC_MALLOC],
[
AC_FUNC_MALLOC
if test "$ac_cv_func_malloc_0_nonnull" = no; then
AC_DEFINE_UNQUOTED([malloc], [rpl_malloc_$1], [Define if replacement function should be used.])
fi
])
dnl Define fallback for fseeko and ftello if needed.
AC_DEFUN([AHX_CONFIG_FSEEKO],
[
+39
View File
@@ -0,0 +1,39 @@
/* taken from ldns 1.6.1 */
#include "config.h"
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include "util/locks.h"
/** the lock for ctime buffer */
static lock_basic_t ctime_lock;
/** has it been inited */
static int ctime_r_init = 0;
/** cleanup ctime_r on exit */
static void
ctime_r_cleanup(void)
{
if(ctime_r_init) {
ctime_r_init = 0;
lock_basic_destroy(&ctime_lock);
}
}
char *ctime_r(const time_t *timep, char *buf)
{
char* result;
if(!ctime_r_init) {
/* still small race where this init can be done twice,
* which is mostly harmless */
ctime_r_init = 1;
lock_basic_init(&ctime_lock);
atexit(&ctime_r_cleanup);
}
lock_basic_lock(&ctime_lock);
result = ctime(timep);
if(buf && result)
strcpy(buf, result);
lock_basic_unlock(&ctime_lock);
return result;
}
+1 -2
View File
@@ -3,7 +3,6 @@
#include "config.h"
#undef malloc
#include <sys/types.h>
void *malloc ();
@@ -12,7 +11,7 @@ void *malloc ();
If N is zero, allocate a 1-byte block. */
void *
rpl_malloc (size_t n)
rpl_malloc_unbound (size_t n)
{
if (n == 0)
n = 1;
+65 -20
View File
@@ -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 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2007-05-17'
timestamp='2009-04-27'
# 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
@@ -56,8 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -324,14 +324,30 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -532,7 +548,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[45])
*:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -793,12 +809,15 @@ EOF
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
x86)
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
EM64T | authenticamd | genuineintel)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
@@ -833,7 +852,14 @@ EOF
echo ${UNAME_MACHINE}-pc-minix
exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -925,6 +951,9 @@ EOF
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 ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -954,8 +983,8 @@ EOF
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit ;;
xtensa:Linux:*:*)
echo xtensa-unknown-linux-gnu
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
@@ -975,9 +1004,6 @@ EOF
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
@@ -1092,8 +1118,11 @@ EOF
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
@@ -1131,6 +1160,16 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1206,6 +1245,9 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1314,6 +1356,9 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1474,9 +1519,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
+76 -17
View File
@@ -31,15 +31,19 @@
/* Define to 1 if you have the `chroot' function. */
#undef HAVE_CHROOT
/* Define to 1 if you have the `ctime_r' function. */
#undef HAVE_CTIME_R
/* Define to 1 if you have the `daemon' function. */
#undef HAVE_DAEMON
/* 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
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `ENGINE_load_gost' function. */
#undef HAVE_ENGINE_LOAD_GOST
/* Define to 1 if you have the `event_base_free' function. */
#undef HAVE_EVENT_BASE_FREE
@@ -121,6 +125,9 @@
/* if the function 'ioctlsocket' is available */
#undef HAVE_IOCTLSOCKET
/* Define to 1 if you have the <iphlpapi.h> header file. */
#undef HAVE_IPHLPAPI_H
/* Define to 1 if you have the `kill' function. */
#undef HAVE_KILL
@@ -149,6 +156,15 @@
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the `OPENSSL_config' function. */
#undef HAVE_OPENSSL_CONFIG
/* Define to 1 if you have the <openssl/conf.h> header file. */
#undef HAVE_OPENSSL_CONF_H
/* Define to 1 if you have the <openssl/engine.h> header file. */
#undef HAVE_OPENSSL_ENGINE_H
/* Define to 1 if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H
@@ -314,6 +330,13 @@
/* Define to 1 if you have the `_beginthreadex' function. */
#undef HAVE__BEGINTHREADEX
/* if lex has yylex_destroy */
#undef LEX_HAS_YYLEX_DESTROY
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to the maximum message length to pass to syslog. */
#undef MAXSYSLOGMSGLEN
@@ -397,12 +420,37 @@
/* define this to enable debug checks. */
#undef UNBOUND_DEBUG
/* Define this to enable GOST support. */
#undef USE_GOST
/* Define if you want to use internal select based events */
#undef USE_MINI_EVENT
/* Define this to enable SHA256 and SHA512 support. */
#undef USE_SHA2
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Whether the windows socket API is used */
#undef USE_WINSOCK
@@ -419,13 +467,6 @@
`char[]'. */
#undef YYTEXT_POINTER
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
@@ -435,6 +476,16 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
@@ -465,7 +516,7 @@
/* Define to `signed char' if <sys/types.h> does not define. */
#undef int8_t
/* Define to rpl_malloc if the replacement function should be used. */
/* Define if replacement function should be used. */
#undef malloc
/* Define to `long int' if <sys/types.h> does not define. */
@@ -486,7 +537,7 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define to `unsigned char' if <sys/types.h> does not define. */
/* Define to 'unsigned char if not defined */
#undef u_char
/* Define to `int' if <sys/types.h> doesn't define. */
@@ -602,6 +653,14 @@
#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
@@ -629,11 +688,6 @@
#endif /* HAVE_FSEEKO */
#ifndef RAND_MAX
#define RAND_MAX 2147483647
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
#endif
@@ -718,6 +772,11 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
#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))
/* using version of libevent that is not threadsafe. */
# define LIBEVENT_SIGNAL_PROBLEM 1
Vendored
+80 -20
View File
@@ -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 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2007-04-29'
timestamp='2009-04-17'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -72,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -122,6 +122,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -249,13 +250,16 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep \
| maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64vr | mips64vrel \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
@@ -268,6 +272,7 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nios | nios2 \
@@ -277,7 +282,7 @@ case $basic_machine in
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| 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 | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -286,7 +291,7 @@ case $basic_machine in
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
@@ -329,14 +334,17 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
@@ -358,20 +366,24 @@ case $basic_machine in
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| 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-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
@@ -435,6 +447,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -443,10 +459,22 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@@ -475,8 +503,8 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
cr16)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
@@ -514,6 +542,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
@@ -668,6 +700,14 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
@@ -813,6 +853,14 @@ case $basic_machine in
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
@@ -1021,6 +1069,10 @@ case $basic_machine in
basic_machine=tic6x-unknown
os=-coff
;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
@@ -1096,6 +1148,10 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
@@ -1134,7 +1190,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1206,8 +1262,9 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1216,7 +1273,7 @@ case $os in
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1356,6 +1413,9 @@ case $os in
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-none)
;;
*)
Vendored
+9584 -13900
View File
File diff suppressed because it is too large Load Diff
+95 -22
View File
@@ -6,10 +6,10 @@ sinclude(acx_pthread.m4)
sinclude(acx_python.m4)
sinclude(ac_pkg_swig.m4)
AC_INIT(unbound, 1.3.0, unbound-bugs@nlnetlabs.nl, unbound)
AC_INIT(unbound, 1.4.1, unbound-bugs@nlnetlabs.nl, unbound)
LIBUNBOUND_CURRENT=1
LIBUNBOUND_REVISION=0
LIBUNBOUND_CURRENT=2
LIBUNBOUND_REVISION=1
LIBUNBOUND_AGE=0
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
@@ -19,6 +19,13 @@ LIBUNBOUND_AGE=0
# 1.2.0 had 0:17:0
# 1.2.1 had 0:18:0
# 1.3.0 had 1:0:0 # ub_cancel and -export-symbols.
# 1.3.1 had 1:1:0
# 1.3.2 had 1:2:0
# 1.3.3 had 1:3:0
# 1.3.4 had 1:4: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
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
@@ -56,7 +63,10 @@ esac
# are we on MinGW?
if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
else on_mingw="no"; fi
else
if echo $target | grep mingw32 >/dev/null; then on_mingw="yes"
else on_mingw="no"; fi
fi
#
# Determine configuration file
@@ -175,9 +185,19 @@ if test "$srcdir" != "."; then
CPPFLAGS="$CPPFLAGS -I$srcdir"
fi
AC_DEFUN([ACX_YYLEX_DESTROY], [
AC_MSG_CHECKING([for yylex_destroy])
if echo %% | $LEX -t 2>&1 | grep yylex_destroy >/dev/null 2>&1; then
AC_DEFINE(LEX_HAS_YYLEX_DESTROY, 1, [if lex has yylex_destroy])
AC_MSG_RESULT(yes)
else AC_MSG_RESULT(no); fi
])
AC_PROG_LEX
ACX_YYLEX_DESTROY
AC_PROG_YACC
AC_CHECK_PROG(doxygen, doxygen, doxygen)
AC_CHECK_TOOL(STRIP, strip)
ACX_LIBTOOL_C_ONLY
# Checks for header files.
@@ -312,10 +332,7 @@ if test x_$ub_test_python != x_no; then
AC_PROG_SWIG
AC_MSG_CHECKING(SWIG)
if test ! -x "$SWIG"; then
AC_MSG_RESULT(failed, won't build Python module and PyUnbound)
AC_SUBST(swig, "")
ub_with_pyunbound=no
ub_with_pythonmod=no
AC_ERROR([failed to find swig tool, install it, or do not build Python module and PyUnbound])
else
AC_DEFINE(HAVE_SWIG, 1, [Define if you have Swig libraries and header files.])
AC_SUBST(swig, "$SWIG")
@@ -346,12 +363,44 @@ fi
# Checks for libraries.
ACX_WITH_SSL
ACX_LIB_SSL
AC_CHECK_FUNCS([EVP_sha1 EVP_sha256 EVP_sha512 ENGINE_load_gost])
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_INCLUDES_DEFAULT
#ifdef HAVE_OPENSSL_ERR_H
#include <openssl/err.h>
#endif
AC_ARG_ENABLE(sha2, AC_HELP_STRING([--enable-sha2], [Enable SHA256 and SHA512 RRSIG support]))
#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 <openssl/ssl.h>
#include <openssl/evp.h>
])
AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support]))
case "$enable_sha2" in
no)
;;
yes|*)
AC_DEFINE([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.])
;;
esac
AC_ARG_ENABLE(gost, AC_HELP_STRING([--enable-gost], [Enable GOST support, experimental]))
case "$enable_gost" in
yes)
AC_DEFINE_UNQUOTED([USE_SHA2], [], [Define this to enable SHA256 and SHA512 support.])
AC_CHECK_LIB(crypto, EVP_PKEY_set_type_str, [:],[AC_MSG_ERROR([OpenSSL >= 1.0.0 is needed for GOST support])])
AC_DEFINE([USE_GOST], [1], [Define this to enable GOST support.])
;;
no|*)
;;
@@ -394,9 +443,9 @@ if test x_$withval = x_yes -o x_$withval != x_no; then
mkdir build >/dev/null 2>&1
mkdir build/libevent >/dev/null 2>&1
mkdir build/libevent/.libs >/dev/null 2>&1
ev_files_o=`ls $thedir/*.o | grep -v evdns\.o`
ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo`
ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o`
ev_files_o=`ls $thedir/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
ev_files_lo=`ls $thedir/*.lo | grep -v evdns\.lo | grep -v bufferevent_openssl\.lo`
ev_files_libso=`ls $thedir/.libs/*.o | grep -v evdns\.o | grep -v bufferevent_openssl\.o`
cp $ev_files_o build/libevent
cp $ev_files_lo build/libevent
cp $ev_files_libso build/libevent/.libs
@@ -410,8 +459,8 @@ large outgoing port ranges. ])
fi
else
AC_MSG_RESULT(found in $thedir)
dnl assume /usr is in default path.
if test "$thedir" != "/usr"; then
dnl assume /usr is in default path, do not add "".
if test "$thedir" != "/usr" -a "$thedir" != ""; then
LDFLAGS="$LDFLAGS -L$thedir/lib"
ACX_RUNTIME_PATH_ADD([$thedir/lib])
fi
@@ -443,6 +492,10 @@ if test x_$enable_static_exe = x_yes; then
staticexe="-static"
if test "$on_mingw" = yes; then
staticexe="-all-static"
# for static crosscompile, include gdi32 and zlib here.
if test "`uname`" = "Linux"; then
LIBS="$LIBS -lgdi32 -lz"
fi
fi
fi
@@ -463,7 +516,7 @@ AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
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
AC_FUNC_MALLOC
ACX_FUNC_MALLOC([unbound])
fi
AC_FUNC_CHOWN
@@ -477,6 +530,11 @@ if test "$USE_WINSOCK" = 1; then
AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
UB_ON_WINDOWS=yes
AC_SUBST(UB_ON_WINDOWS)
AC_CHECK_HEADERS([iphlpapi.h],,, [AC_INCLUDES_DEFAULT
#include <windows.h>
])
AC_CHECK_TOOL(WINDRES, windres)
LIBS="$LIBS -liphlpapi"
fi
if test $ac_cv_func_getaddrinfo = no; then
AC_LIBOBJ([fake-rfc2553])
@@ -507,6 +565,7 @@ AC_REPLACE_FUNCS(snprintf)
AC_REPLACE_FUNCS(strlcpy)
AC_REPLACE_FUNCS(memmove)
AC_REPLACE_FUNCS(gmtime_r)
AC_REPLACE_FUNCS(ctime_r)
# check this after all other compilation checks, since the linking of the lib
# may break checks after this.
@@ -514,9 +573,11 @@ 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"
CPPFLAGS="-I$withval/include $CPPFLAGS"
LDFLAGS="-L$withval -L$withval/lib $LDFLAGS"
ACX_RUNTIME_PATH_ADD([$withval/lib])
if test "$withval" != ""; then
CPPFLAGS="-I$withval/include $CPPFLAGS"
LDFLAGS="-L$withval -L$withval/lib $LDFLAGS"
ACX_RUNTIME_PATH_ADD([$withval/lib])
fi
ldnsdir="$withval"
AC_SUBST(ldnsdir)
])
@@ -561,7 +622,7 @@ fi dnl end of use_ldns_builtin == yes
ACX_STRIP_EXT_FLAGS
LDFLAGS="$LATE_LDFLAGS $LDFLAGS"
AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [5120], [Define to the maximum message length to pass to syslog.])
AC_DEFINE_UNQUOTED([MAXSYSLOGMSGLEN], [10240], [Define to the maximum message length to pass to syslog.])
AH_BOTTOM(
dnl this must be first AH_CONFIG, to define the flags before any includes.
@@ -628,12 +689,19 @@ dnl includes
#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
AHX_CONFIG_UNUSED_ATTRIBUTE
AHX_CONFIG_FSEEKO
AHX_CONFIG_RAND_MAX
AHX_CONFIG_MAXHOSTNAMELEN
AHX_CONFIG_SNPRINTF(unbound)
AHX_CONFIG_INET_PTON(unbound)
@@ -650,6 +718,11 @@ AHX_CONFIG_W32_FD_SET_T
AHX_CONFIG_IPV6_MIN_MTU
[
#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))
/* using version of libevent that is not threadsafe. */
# define LIBEVENT_SIGNAL_PROBLEM 1
+4
View File
@@ -8,7 +8,11 @@ distribution but may be helpful.
* 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.
@@ -0,0 +1,67 @@
#!/usr/bin/perl -WT
use strict;
use warnings;
my $hostsfile = '/etc/hosts';
my $localzonefile = '/etc/unbound/localzone.conf.new';
my $localzone = 'example.com';
open( HOSTS,"<${hostsfile}" ) or die( "Could not open ${hostsfile}: $!" );
open( ZONE,">${localzonefile}" ) or die( "Could not open ${localzonefile}: $!" );
print ZONE "server:\n\n";
print ZONE "local-zone: \"${localzone}\" transparent\n\n";
my %ptrhash;
while ( my $hostline = <HOSTS> ) {
# Skip comments
if ( $hostline !~ "^#" and $hostline !~ '^\s+$' ) {
my @entries = split( /\s+/, $hostline );
my $ip;
my $count = 0;
foreach my $entry ( @entries ) {
if ( $count == 0 ) {
$ip = $entry;
} else {
if ( $count == 1) {
# Only return localhost for 127.0.0.1 and ::1
if ( ($ip ne '127.0.0.1' and $ip ne '::1') or $entry =~ 'localhost' ) {
if ( ! defined $ptrhash{$ip} ) {
$ptrhash{$ip} = $entry;
print ZONE "local-data-ptr: \"$ip $entry\"\n";
}
}
}
# Use AAAA for IPv6 addresses
my $a = 'A';
if ( $ip =~ ':' ) {
$a = 'AAAA';
}
print ZONE "local-data: \"$entry ${a} $ip\"\n";
}
$count++;
}
print ZONE "\n";
}
}
__END__
+46
View File
@@ -0,0 +1,46 @@
#/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."
+87 -10
View File
@@ -1,6 +1,14 @@
# initial python set up
%{?!with_python: %define with_python 0}
%if %{with_python}
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%endif
Summary: Validating, recursive, and caching DNS(SEC) resolver
Name: unbound
Version: 1.2.1rc1
Version: 1.3.1rc2
Release: 1%{?dist}
License: BSD
Url: http://www.nlnetlabs.nl/unbound/
@@ -8,18 +16,23 @@ 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
Group: System Environment/Daemons
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: flex, openssl-devel >= 0.9.8g-12, ldns-devel >= 1.5.0,
BuildRequires: libevent-devel >= 1.4.5
BuildRequires: flex, openssl-devel , ldns-devel >= 1.5.0,
BuildRequires: libevent-devel
%if %{with_python}
BuildRequires: python-devel
%endif
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
Requires: ldns >= 1.5.0
Requires: ldns >= 1.5.0, dnssec-conf >= 1.19
Requires(pre): shadow-utils
# Is this obsolete?
#Provides: caching-nameserver
%description
Unbound is a validating, recursive, and caching DNS(SEC) resolver.
@@ -59,14 +72,29 @@ Requires: openssl >= 0.9.8g-12
%description libs
Contains libraries used by the unbound server and client applications
%if %{with_python}
%package python
Summary: Python modules and extensions for unbound
Group: Applications/System
Requires: %{name}-libs = %{version}-%{release}
%description python
Python modules and extensions for unbound
%endif
%prep
%setup -q
%patch0 -p1
%build
%configure --with-ldns= -with-libevent --with-pthreads --with-ssl \
%configure --with-ldns= --with-libevent --with-pthreads --with-ssl \
--disable-rpath --enable-debug --disable-static \
--with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \
--with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid
--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}
%install
@@ -102,6 +130,11 @@ rm -rf ${RPM_BUILD_ROOT}
%{_sbindir}/*
%{_mandir}/*/*
%if %{with_python}
%files python
%{python_sitelib}/*
%endif
%files munin
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/munin/plugin-conf.d/unbound
@@ -125,12 +158,20 @@ useradd -r -g unbound -d %{_sysconfdir}/unbound -s /sbin/nologin \
-c "Unbound DNS resolver" unbound
exit 0
%post
%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
%post libs -p /sbin/ldconfig
%preun
if [ "$1" -eq 0 ]; then
/sbin/service %{name} stop >/dev/null 2>&1
@@ -145,6 +186,42 @@ fi
%postun libs -p /sbin/ldconfig
%changelog
* 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
* Sat Jun 20 2009 Paul Wouters <paul@xelerance.com> - 1.3.0-1
- Updated to 1.3.0
- Added unbound-python sub package. disabled for now
- Patch from svn to fix DLV lookups
- Patches from svn to detect wrong truncated response from BIND 9.6.1 with
minimal-responses)
- Added Default-Start and Default-Stop to unbound.init
- Re-enabled --enable-sha2
- Re-enabled glob.patch
* Wed May 20 2009 Paul Wouters <paul@xelerance.com> - 1.2.1-7
- unbound-iterator.patch was not commited
* Wed May 20 2009 Paul Wouters <paul@xelerance.com> - 1.2.1-6
- Fix for https://bugzilla.redhat.com/show_bug.cgi?id=499793
* Tue Mar 17 2009 Paul Wouters <paul@xelerance.com> - 1.2.1-5
- Use --nocheck to avoid giving an error on missing unbound-remote certs/keys
* Tue Mar 10 2009 Adam Tkac <atkac redhat com> - 1.2.1-4
- enable DNSSEC only if it is enabled in sysconfig/dnssec
* Mon Mar 09 2009 Adam Tkac <atkac redhat com> - 1.2.1-3
- add DNSSEC support to initscript and enabled it per default
- add requires dnssec-conf
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Tue Feb 10 2009 Paul Wouters <paul@xelerance.com - 1.2.1-1
- updated to 1.2.1
* Sun Jan 18 2009 Tomas Mraz <tmraz@redhat.com> - 1.2.0-2
- rebuild with new openssl
Binary file not shown.
+15 -1
View File
@@ -437,7 +437,21 @@ queue)
done
;;
memory)
for x in mem.total.sbrk mem.cache.rrset mem.cache.message \
mn=`echo mem.total.sbrk | sed $ABBREV | tr . _`
get_value 'mem.total.sbrk'
if test $value -eq 0; then
chk=`echo $ctrl | sed -e 's/-control$/-checkconf/'`
pidf=`$chk -o pidfile $conf 2>&1`
pid=`cat $pidf 2>&1`
value=`ps -p "$pid" -o rss= 2>&1`
if test "`expr $value + 1 - 1 2>&1`" -eq "$value" 2>&1; then
value=`expr $value \* 1024`
else
value=0
fi
fi
echo "$mn.value" $value
for x in mem.cache.rrset mem.cache.message \
mem.mod.iterator mem.mod.validator; do
print_value $x
done
+20 -7
View File
@@ -8,7 +8,7 @@ ubhost=unbound-host
usage ( )
{
echo "usage: update-anchor [-b] <zone name> <trust anchor file>"
echo "usage: update-anchor [-r hs] [-b] <zone name> <trust anchor file>"
echo " performs an update of trust anchor file"
echo " the trust anchor file is overwritten with the latest keys"
echo " the trust anchor file should contain only keys for one zone"
@@ -16,13 +16,15 @@ usage ( )
echo " without -b the file is made in unbound format."
echo " "
echo "alternate:"
echo " update-anchor [-b] -d directory"
echo " update-anchor [-r hints] [-b] -d directory"
echo " update all <zone>.anchor files in the directory."
echo " "
echo " name the files br.anchor se.anchor ..., and include them in"
echo " the validating resolver config file."
echo " put keys for the root in a file with the name root.anchor."
echo ""
echo "-r root.hints use different root hints. Strict option order."
echo ""
echo "Exit code 0 means anchors updated, 1 no changes, others are errors."
exit 2
}
@@ -32,6 +34,12 @@ if test $# -eq 0; then
fi
bindformat="no"
filearg='-f'
roothints=""
if test X"$1" = "X-r"; then
shift
roothints="$1"
shift
fi
if test X"$1" = "X-b"; then
shift
bindformat="yes"
@@ -46,10 +54,15 @@ do_update ( ) {
# arguments: <zonename> <keyfile>
zonename="$1"
keyfile="$2"
tmp2=$tmpfile.2
tmpfile="/tmp/update-anchor.$$"
$ubhost -v $filearg "$keyfile" -t DNSKEY "$zonename" >$tmpfile
tmp2=$tmpfile.2
tmp3=$tmpfile.3
rh=""
if test -n "$roothints"; then
echo "server: root-hints: '$roothints'" > $tmp3
rh="-C $tmp3"
fi
$ubhost -v $rh $filearg "$keyfile" -t DNSKEY "$zonename" >$tmpfile
if test $? -ne 0; then
rm -f $tmpfile
echo "Error: Could not update zone $zonename anchor file $keyfile"
@@ -65,7 +78,7 @@ do_update ( ) {
rm -f $tmpfile
echo "Error: Could not update zone $zonename anchor file $keyfile"
echo "Cause: result of lookup was not secure"
echo " (keys too far out of date? domain changed ownership?)"
echo " (keys too far out of date? domain changed ownership? need root hints?)"
return 3
fi
@@ -115,7 +128,7 @@ do_update ( ) {
echo "$zonename key file $keyfile unchanged."
fi
rm -f $tmpfile $tmp2
rm -f $tmpfile $tmp2 $tmp3
}
no_updated=1
+152 -51
View File
@@ -43,14 +43,20 @@
#include "daemon/cachedump.h"
#include "daemon/remote.h"
#include "daemon/worker.h"
#include "daemon/daemon.h"
#include "services/cache/rrset.h"
#include "services/cache/dns.h"
#include "services/cache/infra.h"
#include "services/modstack.h"
#include "util/data/msgreply.h"
#include "util/regional.h"
#include "util/net_help.h"
#include "util/data/dname.h"
#include "iterator/iterator.h"
#include "iterator/iter_delegpt.h"
#include "iterator/iter_utils.h"
#include "iterator/iter_fwd.h"
#include "iterator/iter_hints.h"
/** convert to ldns rr */
static ldns_rr*
@@ -394,17 +400,16 @@ load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
*go_on = 0;
return 1;
}
log_info("rd %s", (char*)ldns_buffer_begin(buf));
status = ldns_rr_new_frm_str(&rr, (char*)ldns_buffer_begin(buf),
LDNS_DEFAULT_TTL, NULL, NULL);
if(status != LDNS_STATUS_OK) {
(void)ssl_printf(ssl, "error cannot parse rr :%s: %s\n",
log_warn("error cannot parse rr :%s: %s",
ldns_get_errorstr_by_id(status),
(char*)ldns_buffer_begin(buf));
return 0;
}
if(is_rrsig && ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) {
(void)ssl_printf(ssl, "error expected rrsig but got %s\n",
log_warn("error expected rrsig but got %s",
(char*)ldns_buffer_begin(buf));
return 0;
}
@@ -415,7 +420,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) {
(void)ssl_printf(ssl, "error cannot rr2wire :%s\n",
log_warn("error cannot rr2wire :%s",
ldns_get_errorstr_by_id(status));
ldns_rr_free(rr);
return 0;
@@ -428,7 +433,7 @@ load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
ldns_buffer_begin(buf), ldns_buffer_limit(buf));
if(!d->rr_data[i]) {
ldns_rr_free(rr);
(void)ssl_printf(ssl, "error out of memory\n");
log_warn("error out of memory");
return 0;
}
@@ -443,7 +448,7 @@ load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
rk->rk.dname = regional_alloc_init(region,
ldns_buffer_begin(buf), ldns_buffer_limit(buf));
if(!rk->rk.dname) {
(void)ssl_printf(ssl, "error out of memory\n");
log_warn("error out of memory");
ldns_rr_free(rr);
return 0;
}
@@ -455,7 +460,7 @@ load_rr(SSL* ssl, ldns_buffer* buf, struct regional* region,
/** move entry into cache */
static int
move_into_cache(SSL* ssl, struct ub_packed_rrset_key* k,
move_into_cache(struct ub_packed_rrset_key* k,
struct packed_rrset_data* d, struct worker* worker)
{
struct ub_packed_rrset_key* ak;
@@ -466,7 +471,7 @@ move_into_cache(SSL* ssl, struct ub_packed_rrset_key* k,
ak = alloc_special_obtain(&worker->alloc);
if(!ak) {
(void)ssl_printf(ssl, "error out of memory\n");
log_warn("error out of memory");
return 0;
}
ak->entry.data = NULL;
@@ -474,7 +479,7 @@ move_into_cache(SSL* ssl, struct ub_packed_rrset_key* k,
ak->entry.hash = rrset_key_hash(&k->rk);
ak->rk.dname = (uint8_t*)memdup(k->rk.dname, k->rk.dname_len);
if(!ak->rk.dname) {
(void)ssl_printf(ssl, "error out of memory\n");
log_warn("error out of memory");
ub_packed_rrset_parsedelete(ak, &worker->alloc);
return 0;
}
@@ -484,6 +489,7 @@ move_into_cache(SSL* ssl, struct ub_packed_rrset_key* k,
s += d->rr_len[i];
ad = (struct packed_rrset_data*)malloc(s);
if(!ad) {
log_warn("error out of memory");
ub_packed_rrset_parsedelete(ak, &worker->alloc);
return 0;
}
@@ -528,13 +534,12 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker)
sizeof(*rk));
d = (struct packed_rrset_data*)regional_alloc_zero(region, sizeof(*d));
if(!rk || !d) {
(void) ssl_printf(ssl, "error out of memory\n");
log_warn("error out of memory");
return 0;
}
if(strncmp(s, ";rrset", 6) != 0) {
(void)ssl_printf(ssl, "error expected ';rrset' but got %s\n",
s);
log_warn("error expected ';rrset' but got %s", s);
return 0;
}
s += 6;
@@ -544,11 +549,13 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker)
}
if(sscanf(s, " %u %u %u %u %u", &ttl, &rr_count, &rrsig_count,
&trust, &security) != 5) {
(void)ssl_printf(ssl, "error bad rrset spec %s\n", s);
log_warn("error bad rrset spec %s", s);
return 0;
}
if(rr_count == 0 && rrsig_count == 0)
if(rr_count == 0 && rrsig_count == 0) {
log_warn("bad rrset without contents");
return 0;
}
d->count = (size_t)rr_count;
d->rrsig_count = (size_t)rrsig_count;
d->security = (enum sec_status)security;
@@ -562,7 +569,7 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker)
d->rr_data = regional_alloc_zero(region,
sizeof(uint8_t*)*(d->count+d->rrsig_count));
if(!d->rr_len || !d->rr_ttl || !d->rr_data) {
(void) ssl_printf(ssl, "error out of memory\n");
log_warn("error out of memory");
return 0;
}
@@ -570,12 +577,14 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker)
for(i=0; i<rr_count; i++) {
if(!load_rr(ssl, buf, region, rk, d, i, 0,
&go_on, *worker->env.now)) {
log_warn("could not read rr %u", i);
return 0;
}
}
for(i=0; i<rrsig_count; i++) {
if(!load_rr(ssl, buf, region, rk, d, i+rr_count, 1,
&go_on, *worker->env.now)) {
log_warn("could not read rrsig %u", i);
return 0;
}
}
@@ -584,7 +593,7 @@ load_rrset(SSL* ssl, ldns_buffer* buf, struct worker* worker)
return 1;
}
return move_into_cache(ssl, rk, d, worker);
return move_into_cache(rk, d, worker);
}
/** load rrset cache */
@@ -604,7 +613,7 @@ load_rrset_cache(SSL* ssl, struct worker* worker)
/** read qinfo from next three words */
static char*
load_qinfo(char* str, struct query_info* qinfo, ldns_buffer* buf,
struct regional* region, SSL* ssl)
struct regional* region)
{
/* s is part of the buf */
char* s = str;
@@ -616,7 +625,7 @@ load_qinfo(char* str, struct query_info* qinfo, ldns_buffer* buf,
if(s) s = strchr(s+1, ' ');
if(s) s = strchr(s+1, ' ');
if(!s) {
(void)ssl_printf(ssl, "error line too short, %s\n", str);
log_warn("error line too short, %s", str);
return NULL;
}
s[0] = 0;
@@ -625,7 +634,7 @@ load_qinfo(char* str, struct query_info* qinfo, ldns_buffer* buf,
/* parse them */
status = ldns_rr_new_question_frm_str(&rr, str, NULL, NULL);
if(status != LDNS_STATUS_OK) {
(void)ssl_printf(ssl, "error cannot parse: %s %s\n",
log_warn("error cannot parse: %s %s",
ldns_get_errorstr_by_id(status), str);
return NULL;
}
@@ -635,7 +644,7 @@ load_qinfo(char* str, struct query_info* qinfo, ldns_buffer* buf,
status = ldns_dname2buffer_wire(buf, ldns_rr_owner(rr));
ldns_rr_free(rr);
if(status != LDNS_STATUS_OK) {
(void)ssl_printf(ssl, "error cannot dname2wire: %s\n",
log_warn("error cannot dname2wire: %s",
ldns_get_errorstr_by_id(status));
return NULL;
}
@@ -644,7 +653,7 @@ load_qinfo(char* str, struct query_info* qinfo, ldns_buffer* buf,
qinfo->qname = (uint8_t*)regional_alloc_init(region,
ldns_buffer_begin(buf), ldns_buffer_limit(buf));
if(!qinfo->qname) {
(void)ssl_printf(ssl, "error out of memory\n");
log_warn("error out of memory");
return NULL;
}
@@ -670,12 +679,12 @@ load_ref(SSL* ssl, ldns_buffer* buf, struct worker* worker,
return 1;
}
s = load_qinfo(s, &qinfo, buf, region, ssl);
s = load_qinfo(s, &qinfo, buf, region);
if(!s) {
return 0;
}
if(sscanf(s, " %u", &flags) != 1) {
(void)ssl_printf(ssl, "error cannot parse flags: %s\n", s);
log_warn("error cannot parse flags: %s", s);
return 0;
}
@@ -711,11 +720,11 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker)
regional_free_all(region);
if(strncmp(s, "msg ", 4) != 0) {
(void)ssl_printf(ssl, "error expected msg but got %s\n", s);
log_warn("error expected msg but got %s", s);
return 0;
}
s += 4;
s = load_qinfo(s, &qinf, buf, region, ssl);
s = load_qinfo(s, &qinf, buf, region);
if(!s) {
return 0;
}
@@ -723,7 +732,7 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker)
/* read remainder of line */
if(sscanf(s, " %u %u %u %u %u %u %u", &flags, &qdcount, &ttl,
&security, &an, &ns, &ar) != 7) {
(void)ssl_printf(ssl, "error cannot parse numbers: %s\n", s);
log_warn("error cannot parse numbers: %s", s);
return 0;
}
rep.flags = (uint16_t)flags;
@@ -749,7 +758,7 @@ load_msg(SSL* ssl, ldns_buffer* buf, struct worker* worker)
return 1; /* skip this one, not all references satisfied */
if(!dns_cache_store(&worker->env, &qinf, &rep, 0)) {
(void)ssl_printf(ssl, "error out of memory\n");
log_warn("error out of memory");
return 0;
}
return 1;
@@ -779,6 +788,84 @@ load_cache(SSL* ssl, struct worker* worker)
return read_fixed(ssl, worker->env.scratch_buffer, "EOF");
}
/** print details on a delegation point */
static void
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;
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));
if(!ssl_printf(ssl, "%-16s\t", buf))
return;
if(a->bogus) {
if(!ssl_printf(ssl, "Address is BOGUS. "))
return;
}
/* lookup 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,
*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. ",
lame?"LAME ":"", dlame?"NoDNSSEC ":"",
rlame?"NoAuthButRecursive ":"", rtt, lost))
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":""))
return;
} else {
if(!ssl_printf(ssl, "EDNS %d%s.",
edns_vs, edns_lame_known?" probed":""))
return;
}
}
if(!ssl_printf(ssl, "\n"))
return;
}
}
/** print main dp info */
static void
print_dp_main(SSL* ssl, struct delegpt* dp, struct dns_msg* msg)
{
size_t i, n_ns, n_miss, n_addr, n_res, n_avail;
/* print the dp */
if(msg)
for(i=0; i<msg->rep->rrset_count; i++) {
struct ub_packed_rrset_key* k = msg->rep->rrsets[i];
struct packed_rrset_data* d =
(struct packed_rrset_data*)k->entry.data;
if(d->security == sec_status_bogus) {
if(!ssl_printf(ssl, "Address is BOGUS:\n"))
return;
}
if(!dump_rrset(ssl, k, d, 0))
return;
}
delegpt_count_ns(dp, &n_ns, &n_miss);
delegpt_count_addr(dp, &n_addr, &n_res, &n_avail);
/* since dp has not been used by iterator, all are available*/
if(!ssl_printf(ssl, "Delegation with %d names, of which %d "
"can be examined to query further addresses.\n"
"%sIt provides %d IP addresses.\n",
(int)n_ns, (int)n_miss, (dp->bogus?"It is BOGUS. ":""),
(int)n_addr))
return;
}
int print_deleg_lookup(SSL* ssl, struct worker* worker, uint8_t* nm,
size_t nmlen, int ATTR_UNUSED(nmlabs))
{
@@ -788,18 +875,34 @@ int print_deleg_lookup(SSL* ssl, struct worker* worker, uint8_t* nm,
struct regional* region = worker->scratchpad;
char b[260];
struct query_info qinfo;
size_t i, n_ns, n_miss, n_addr, n_res, n_avail;
struct iter_hints_stub* stub;
struct iter_env* ie;
regional_free_all(region);
qinfo.qname = nm;
qinfo.qname_len = nmlen;
qinfo.qtype = LDNS_RR_TYPE_A;
qinfo.qclass = LDNS_RR_CLASS_IN;
if(modstack_find(&worker->daemon->mods, "iterator") == -1) {
return ssl_printf(ssl, "error: no iterator module\n");
}
ie = (struct iter_env*)worker->env.modinfo[modstack_find(&worker->
daemon->mods, "iterator")];
dname_str(nm, b);
if(!ssl_printf(ssl, "The following name servers are used for lookup "
"of %s\n", b))
return 0;
dp = forwards_lookup(worker->env.fwds, nm, qinfo.qclass);
if(dp) {
if(!ssl_printf(ssl, "forwarding request:\n"))
return 0;
print_dp_main(ssl, dp, NULL);
print_dp_details(ssl, worker, dp);
return 1;
}
while(1) {
dp = dns_cache_find_delegation(&worker->env, nm, nmlen,
qinfo.qtype, qinfo.qclass, region, &msg,
@@ -808,29 +911,10 @@ int print_deleg_lookup(SSL* ssl, struct worker* worker, uint8_t* nm,
return ssl_printf(ssl, "no delegation from "
"cache; goes to configured roots\n");
}
/* print the dp */
for(i=0; i<msg->rep->rrset_count; i++) {
struct ub_packed_rrset_key* k = msg->rep->rrsets[i];
struct packed_rrset_data* d =
(struct packed_rrset_data*)k->entry.data;
if(d->security == sec_status_bogus) {
if(!ssl_printf(ssl, "Address is BOGUS:\n"))
return 0;
}
if(!dump_rrset(ssl, k, d, 0))
return 0;
}
delegpt_count_ns(dp, &n_ns, &n_miss);
delegpt_count_addr(dp, &n_addr, &n_res, &n_avail);
/* since dp has not been used by iterator, all are available*/
if(!ssl_printf(ssl, "Delegation with %d names, of which %d "
"have no addresses in cache.\n"
"It provides %d IP addresses. %s\n",
(int)n_ns, (int)n_miss, (int)n_addr,
(dp->bogus?"It is BOGUS":"") ))
return 0;
/* go up? */
if(iter_dp_is_useless(&qinfo, BIT_RD, dp)) {
print_dp_main(ssl, dp, msg);
print_dp_details(ssl, worker, dp);
if(!ssl_printf(ssl, "cache delegation was "
"useless (no IP addresses)\n"))
return 0;
@@ -848,8 +932,25 @@ int print_deleg_lookup(SSL* ssl, struct worker* worker, uint8_t* nm,
return 0;
continue;
}
} else
break;
}
stub = hints_lookup_stub(ie->hints, nm, qinfo.qclass, dp);
if(stub) {
if(stub->noprime) {
if(!ssl_printf(ssl, "The noprime stub servers "
"are used:\n"))
return 0;
} else {
if(!ssl_printf(ssl, "The stub is primed "
"with servers:\n"))
return 0;
}
print_dp_main(ssl, stub->dp, NULL);
print_dp_details(ssl, worker, stub->dp);
} else {
print_dp_main(ssl, dp, msg);
print_dp_details(ssl, worker, dp);
}
break;
}
return 1;
+32 -2
View File
@@ -63,6 +63,15 @@ static int sig_record_quit = 0;
/** How many reload requests happened. */
static int sig_record_reload = 0;
#if HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS
/** cleaner ssl memory freeup */
static void* comp_meth = NULL;
#endif
#ifdef LEX_HAS_YYLEX_DESTROY
/** remove buffers for parsing and init */
void ub_c_lex_destroy(void);
#endif
/** used when no other sighandling happens, so we don't die
* when multiple signals in quick succession are sent to us.
* @param sig: signal number.
@@ -165,7 +174,17 @@ daemon_init()
checklock_start();
ERR_load_crypto_strings();
ERR_load_SSL_strings();
#ifdef HAVE_OPENSSL_CONFIG
OPENSSL_config("unbound");
#endif
#ifdef USE_GOST
(void)ldns_key_EVP_load_gost_id();
#endif
OpenSSL_add_all_algorithms();
#if HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS
/* grab the COMP method ptr because openssl leaks it */
comp_meth = (void*)SSL_COMP_get_compression_methods();
#endif
(void)SSL_library_init();
#ifdef HAVE_TZSET
/* init timezone info while we are not chrooted yet */
@@ -462,6 +481,7 @@ daemon_cleanup(struct daemon* daemon)
local_zones_delete(daemon->local_zones);
daemon->local_zones = NULL;
/* key cache is cleared by module desetup during next daemon_init() */
daemon_remote_clear(daemon->rc);
for(i=0; i<daemon->num; i++)
worker_delete(daemon->workers[i]);
free(daemon->workers);
@@ -476,6 +496,7 @@ daemon_delete(struct daemon* daemon)
if(!daemon)
return;
modstack_desetup(&daemon->mods, daemon->env);
daemon_remote_delete(daemon->rc);
listening_ports_free(daemon->ports);
listening_ports_free(daemon->rc_ports);
if(daemon->env) {
@@ -490,10 +511,19 @@ daemon_delete(struct daemon* daemon)
free(daemon->pidfile);
free(daemon->env);
free(daemon);
#ifdef LEX_HAS_YYLEX_DESTROY
/* lex cleanup */
ub_c_lex_destroy();
#endif
/* libcrypto cleanup */
/* CONF_modules_unload(1); */
#if HAVE_DECL_SSL_COMP_GET_COMPRESSION_METHODS
sk_SSL_COMP_free(comp_meth);
#endif
#ifdef HAVE_OPENSSL_CONFIG
EVP_cleanup();
/* ENGINE_cleanup(); */
ENGINE_cleanup();
CONF_modules_free();
#endif
CRYPTO_cleanup_all_ex_data(); /* safe, no more threads right now */
ERR_remove_state(0);
ERR_free_strings();
+4 -1
View File
@@ -57,6 +57,7 @@ struct rrset_cache;
struct acl_list;
struct local_zones;
struct ub_randstate;
struct daemon_remote;
/**
* Structure holding worker list.
@@ -73,10 +74,12 @@ struct daemon {
int listening_port;
/** listening ports, opened, to be shared by threads */
struct listen_port* ports;
/** port number fore remote that has ports opened. */
/** port number for remote that has ports opened. */
int rc_port;
/** listening ports for remote control */
struct listen_port* rc_ports;
/** remote control connections management (for first worker) */
struct daemon_remote* rc;
/** num threads allocated */
int num;
/** the worker entries */
+61 -49
View File
@@ -106,9 +106,9 @@ timeval_subtract(struct timeval* d, const struct timeval* end,
const struct timeval* start)
{
#ifndef S_SPLINT_S
time_t end_usec = end->tv_usec;;
time_t end_usec = end->tv_usec;
d->tv_sec = end->tv_sec - start->tv_sec;
while(end_usec < start->tv_usec) {
if(end_usec < start->tv_usec) {
end_usec += 1000000;
d->tv_sec--;
}
@@ -136,18 +136,16 @@ timeval_divide(struct timeval* avg, const struct timeval* sum, size_t d)
}
struct daemon_remote*
daemon_remote_create(struct worker* worker)
daemon_remote_create(struct config_file* cfg)
{
char* s_cert;
char* s_key;
struct config_file* cfg = worker->daemon->cfg;
struct daemon_remote* rc = (struct daemon_remote*)calloc(1,
sizeof(*rc));
if(!rc) {
log_err("out of memory in daemon_remote_create");
return NULL;
}
rc->worker = worker;
rc->max_active = 10;
if(!cfg->remote_control_enable) {
@@ -166,50 +164,51 @@ daemon_remote_create(struct worker* worker)
daemon_remote_delete(rc);
return NULL;
}
s_cert = cfg->server_cert_file;
s_key = cfg->server_key_file;
if(cfg->chrootdir && cfg->chrootdir[0]) {
if(strncmp(s_cert, cfg->chrootdir, strlen(cfg->chrootdir))==0)
s_cert += strlen(cfg->chrootdir);
if(strncmp(s_key, cfg->chrootdir, strlen(cfg->chrootdir))==0)
s_key += strlen(cfg->chrootdir);
s_cert = fname_after_chroot(cfg->server_cert_file, cfg, 1);
s_key = fname_after_chroot(cfg->server_key_file, cfg, 1);
if(!s_cert || !s_key) {
log_err("out of memory in remote control fname");
goto setup_error;
}
verbose(VERB_ALGO, "setup SSL certificates");
if (!SSL_CTX_use_certificate_file(rc->ctx,s_cert,SSL_FILETYPE_PEM)) {
log_err("Error for server-cert-file: %s", s_cert);
log_crypto_err("Error in SSL_CTX use_certificate_file");
daemon_remote_delete(rc);
return NULL;
goto setup_error;
}
if(!SSL_CTX_use_PrivateKey_file(rc->ctx,s_key,SSL_FILETYPE_PEM)) {
log_err("Error for server-key-file: %s", s_key);
log_crypto_err("Error in SSL_CTX use_PrivateKey_file");
daemon_remote_delete(rc);
return NULL;
goto setup_error;
}
if(!SSL_CTX_check_private_key(rc->ctx)) {
log_err("Error for server-key-file: %s", s_key);
log_crypto_err("Error in SSL_CTX check_private_key");
daemon_remote_delete(rc);
return NULL;
goto setup_error;
}
if(!SSL_CTX_load_verify_locations(rc->ctx, s_cert, NULL)) {
log_crypto_err("Error setting up SSL_CTX verify locations");
setup_error:
free(s_cert);
free(s_key);
daemon_remote_delete(rc);
return NULL;
}
SSL_CTX_set_client_CA_list(rc->ctx, SSL_load_client_CA_file(s_cert));
SSL_CTX_set_verify(rc->ctx, SSL_VERIFY_PEER, NULL);
free(s_cert);
free(s_key);
return rc;
}
void daemon_remote_delete(struct daemon_remote* rc)
void daemon_remote_clear(struct daemon_remote* rc)
{
struct rc_state* p, *np;
if(!rc) return;
/* but do not close the ports */
listen_list_delete(rc->accept_list);
rc->accept_list = NULL;
/* do close these sockets */
p = rc->busy_list;
while(p) {
@@ -220,6 +219,15 @@ void daemon_remote_delete(struct daemon_remote* rc)
free(p);
p = np;
}
rc->busy_list = NULL;
rc->active = 0;
rc->worker = NULL;
}
void daemon_remote_delete(struct daemon_remote* rc)
{
if(!rc) return;
daemon_remote_clear(rc);
if(rc->ctx) {
SSL_CTX_free(rc->ctx);
}
@@ -348,9 +356,10 @@ accept_open(struct daemon_remote* rc, int fd)
}
int daemon_remote_open_accept(struct daemon_remote* rc,
struct listen_port* ports)
struct listen_port* ports, struct worker* worker)
{
struct listen_port* p;
rc->worker = worker;
for(p = ports; p; p = p->next) {
if(!accept_open(rc, p->fd)) {
log_err("could not create accept comm point");
@@ -1034,6 +1043,22 @@ do_lookup(SSL* ssl, struct worker* worker, char* arg)
free(nm);
}
/** flush something from rrset and msg caches */
static void
do_cache_remove(struct worker* worker, uint8_t* nm, size_t nmlen,
uint16_t t, uint16_t c)
{
hashvalue_t h;
struct query_info k;
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen, t, c, 0);
k.qname = nm;
k.qname_len = nmlen;
k.qtype = t;
k.qclass = c;
h = query_info_hash(&k);
slabhash_remove(worker->env.msg_cache, h, &k);
}
/** flush a type */
static void
do_flush_type(SSL* ssl, struct worker* worker, char* arg)
@@ -1048,8 +1073,7 @@ do_flush_type(SSL* ssl, struct worker* worker, char* arg)
if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))
return;
t = ldns_get_rr_type_by_name(arg2);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
t, LDNS_RR_CLASS_IN, 0);
do_cache_remove(worker, nm, nmlen, t, LDNS_RR_CLASS_IN);
free(nm);
send_ok(ssl);
@@ -1144,7 +1168,6 @@ do_flush_zone(SSL* ssl, struct worker* worker, char* arg)
int nmlabs;
size_t nmlen;
struct del_info inf;
int idx;
if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))
return;
/* delete all RRs and key entries from zone */
@@ -1164,10 +1187,9 @@ do_flush_zone(SSL* ssl, struct worker* worker, char* arg)
slabhash_traverse(worker->env.msg_cache, 1, &zone_del_msg, &inf);
/* and validator cache */
idx = modstack_find(&worker->daemon->mods, "validator");
if(idx != -1) {
struct val_env* ve = (struct val_env*)worker->env.modinfo[idx];
slabhash_traverse(ve->kcache->slab, 1, &zone_del_kcache, &inf);
if(worker->env.key_cache) {
slabhash_traverse(worker->env.key_cache->slab, 1,
&zone_del_kcache, &inf);
}
free(nm);
@@ -1179,33 +1201,23 @@ do_flush_zone(SSL* ssl, struct worker* worker, char* arg)
/** remove name rrset from cache */
static void
do_flush_name(SSL* ssl, struct worker* worker, char* arg)
do_flush_name(SSL* ssl, struct worker* w, char* arg)
{
uint8_t* nm;
int nmlabs;
size_t nmlen;
if(!parse_arg_name(ssl, arg, &nm, &nmlen, &nmlabs))
return;
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_A, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_AAAA, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_NS, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_SOA, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_CNAME, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_DNAME, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_MX, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_PTR, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_SRV, LDNS_RR_CLASS_IN, 0);
rrset_cache_remove(worker->env.rrset_cache, nm, nmlen,
LDNS_RR_TYPE_NAPTR, LDNS_RR_CLASS_IN, 0);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_A, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_AAAA, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_NS, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_SOA, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_CNAME, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_DNAME, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_MX, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_PTR, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_SRV, LDNS_RR_CLASS_IN);
do_cache_remove(w, nm, nmlen, LDNS_RR_TYPE_NAPTR, LDNS_RR_CLASS_IN);
free(nm);
send_ok(ssl);
@@ -1268,7 +1280,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, 1)) {
if(!delegpt_add_addr(dp, region, &addr, addrlen, 0, 0, 1)) {
(void)ssl_printf(ssl, "error out of memory\n");
return NULL;
}
+11 -3
View File
@@ -96,10 +96,10 @@ struct daemon_remote {
/**
* Create new remote control state for the daemon.
* @param worker: worker with communication base. and links to command channels.
* @param cfg: config file with key file settings.
* @return new state, or NULL on failure.
*/
struct daemon_remote* daemon_remote_create(struct worker* worker);
struct daemon_remote* daemon_remote_create(struct config_file* cfg);
/**
* remote control state to delete.
@@ -107,6 +107,13 @@ struct daemon_remote* daemon_remote_create(struct worker* worker);
*/
void daemon_remote_delete(struct daemon_remote* rc);
/**
* remote control state to clear up. Busy and accept points are closed.
* Does not delete the rc itself, or the ssl context (with its keys).
* @param rc: state to clear.
*/
void daemon_remote_clear(struct daemon_remote* rc);
/**
* Open and create listening ports for remote control.
* @param cfg: config options.
@@ -119,10 +126,11 @@ struct listen_port* daemon_remote_open_ports(struct config_file* cfg);
* Setup comm points for accepting remote control connections.
* @param rc: state
* @param ports: already opened ports.
* @param worker: worker with communication base. and links to command channels.
* @return false on error.
*/
int daemon_remote_open_accept(struct daemon_remote* rc,
struct listen_port* ports);
struct listen_port* ports, struct worker* worker);
/**
* Handle nonthreaded remote cmd execution.
+1 -1
View File
@@ -58,7 +58,7 @@ timeval_add(struct timeval* d, const struct timeval* add)
#ifndef S_SPLINT_S
d->tv_sec += add->tv_sec;
d->tv_usec += add->tv_usec;
while(d->tv_usec > 1000000 ) {
if(d->tv_usec > 1000000) {
d->tv_usec -= 1000000;
d->tv_sec++;
}
+13
View File
@@ -43,6 +43,7 @@
#include "config.h"
#include "util/log.h"
#include "daemon/daemon.h"
#include "daemon/remote.h"
#include "util/config_file.h"
#include "util/storage/slabhash.h"
#include "services/listen_dnsport.h"
@@ -119,6 +120,14 @@ static void usage()
printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
}
#ifndef unbound_testbound
int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
{
log_assert(0);
return 0;
}
#endif
/** check file descriptor count */
static void
checkrlimits(struct config_file* cfg)
@@ -366,6 +375,10 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
* So, using a logfile, the user does not see errors unless -d is
* given to unbound on the commandline. */
/* read ssl keys while superuser and outside chroot */
if(!(daemon->rc = daemon_remote_create(cfg)))
fatal_exit("could not set up remote-control");
#ifdef HAVE_KILL
/* check old pid file before forking */
if(cfg->pidfile && cfg->pidfile[0]) {
+56 -48
View File
@@ -66,6 +66,7 @@
#include "util/fptr_wlist.h"
#include "util/tube.h"
#include "iterator/iter_fwd.h"
#include "validator/autotrust.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
@@ -496,43 +497,6 @@ answer_norec_from_cache(struct worker* worker, struct query_info* qinfo,
return 1;
}
/** check cname chain in cache reply */
static int
check_cache_chain(struct reply_info* rep) {
/* check only answer section rrs for matching cname chain.
* the cache may return changed rdata, but owner names are untouched.*/
size_t i;
uint8_t* sname = rep->rrsets[0]->rk.dname;
size_t snamelen = rep->rrsets[0]->rk.dname_len;
for(i=0; i<rep->an_numrrsets; i++) {
uint16_t t = ntohs(rep->rrsets[i]->rk.type);
if(t == LDNS_RR_TYPE_DNAME)
continue; /* skip dnames; note TTL 0 not cached */
/* verify that owner matches current sname */
if(query_dname_compare(sname, rep->rrsets[i]->rk.dname) != 0){
/* cname chain broken */
return 0;
}
/* if this is a cname; move on */
if(t == LDNS_RR_TYPE_CNAME) {
get_cname_target(rep->rrsets[i], &sname, &snamelen);
}
}
return 1;
}
/** check security status in cache reply */
static int
all_rrsets_secure(struct reply_info* rep) {
size_t i;
for(i=0; i<rep->rrset_count; i++) {
if( ((struct packed_rrset_data*)rep->rrsets[i]->entry.data)
->security != sec_status_secure )
return 0;
}
return 1;
}
/** answer query from the cache */
static int
answer_from_cache(struct worker* worker, struct query_info* qinfo,
@@ -558,7 +522,7 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
if(rep->an_numrrsets > 0 && (rep->rrsets[0]->rk.type ==
htons(LDNS_RR_TYPE_CNAME) || rep->rrsets[0]->rk.type ==
htons(LDNS_RR_TYPE_DNAME))) {
if(!check_cache_chain(rep)) {
if(!reply_check_cname_chain(rep)) {
/* cname chain invalid, redo iterator steps */
verbose(VERB_ALGO, "Cache reply: cname chain broken");
bail_out:
@@ -590,7 +554,7 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
"validation");
goto bail_out; /* need to validate cache entry first */
} else if(rep->security == sec_status_secure) {
if(all_rrsets_secure(rep))
if(reply_all_rrsets_secure(rep))
secure = 1;
else {
if(must_validate) {
@@ -842,6 +806,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
}
if(local_zones_answer(worker->daemon->local_zones, &qinfo, &edns,
c->buffer, worker->scratchpad)) {
regional_free_all(worker->scratchpad);
if(ldns_buffer_limit(c->buffer) == 0) {
comm_point_drop_reply(repinfo);
return 0;
@@ -958,8 +923,10 @@ worker_restart_timer(struct worker* worker)
{
if(worker->env.cfg->stat_interval > 0) {
struct timeval tv;
#ifndef S_SPLINT_S
tv.tv_sec = worker->env.cfg->stat_interval;
tv.tv_usec = 0;
#endif
comm_timer_set(worker->stat_timer, &tv);
}
}
@@ -977,6 +944,18 @@ void worker_stat_timer_cb(void* arg)
worker_restart_timer(worker);
}
void worker_probe_timer_cb(void* arg)
{
struct worker* worker = (struct worker*)arg;
struct timeval tv;
#ifndef S_SPLINT_S
tv.tv_sec = (time_t)autr_probe_timer(&worker->env);
tv.tv_usec = 0;
#endif
if(tv.tv_sec != 0)
comm_timer_set(worker->env.probe_timer, &tv);
}
struct worker*
worker_create(struct daemon* daemon, int id, int* ports, int n)
{
@@ -1038,12 +1017,8 @@ worker_init(struct worker* worker, struct config_file *cfg,
return 0;
}
#endif /* LIBEVENT_SIGNAL_PROBLEM */
if(!(worker->rc = daemon_remote_create(worker))) {
worker_delete(worker);
return 0;
}
if(!daemon_remote_open_accept(worker->rc,
worker->daemon->rc_ports)) {
if(!daemon_remote_open_accept(worker->daemon->rc,
worker->daemon->rc_ports, worker)) {
worker_delete(worker);
return 0;
}
@@ -1052,7 +1027,6 @@ worker_init(struct worker* worker, struct config_file *cfg,
#endif /* UB_ON_WINDOWS */
} else { /* !do_sigs */
worker->comsig = NULL;
worker->rc = NULL;
}
seed = (unsigned int)time(NULL) ^ (unsigned int)getpid() ^
(((unsigned int)worker->thread_num)<<17);
@@ -1078,7 +1052,8 @@ worker_init(struct worker* worker, struct config_file *cfg,
cfg->do_tcp?cfg->outgoing_num_tcp:0,
worker->daemon->env->infra_cache, worker->rndstate,
cfg->use_caps_bits_for_id, worker->ports, worker->numports,
cfg->unwanted_threshold, &worker_alloc_cleanup, worker);
cfg->unwanted_threshold, &worker_alloc_cleanup, worker,
cfg->do_udp);
if(!worker->back) {
log_err("could not create outgoing sockets");
worker_delete(worker);
@@ -1133,6 +1108,24 @@ worker_init(struct worker* worker, struct config_file *cfg,
worker_delete(worker);
return 0;
}
/* one probe timer per process -- if we have 5011 anchors */
if(autr_get_num_anchors(worker->env.anchors) > 0
#ifndef THREADS_DISABLED
&& worker->thread_num == 0
#endif
) {
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
worker->env.probe_timer = comm_timer_create(worker->base,
worker_probe_timer_cb, worker);
if(!worker->env.probe_timer) {
log_err("could not create 5011-probe timer");
} else {
/* let timer fire, then it can reset itself */
comm_timer_set(worker->env.probe_timer, &tv);
}
}
if(!worker->env.mesh || !worker->env.scratch_buffer) {
worker_delete(worker);
return 0;
@@ -1172,7 +1165,7 @@ worker_delete(struct worker* worker)
comm_signal_delete(worker->comsig);
tube_delete(worker->cmd);
comm_timer_delete(worker->stat_timer);
daemon_remote_delete(worker->rc);
comm_timer_delete(worker->env.probe_timer);
free(worker->ports);
if(worker->thread_num == 0) {
log_set_time(NULL);
@@ -1291,6 +1284,20 @@ void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
log_assert(0);
}
void libworker_fg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
char* ATTR_UNUSED(why_bogus))
{
log_assert(0);
}
void libworker_bg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
char* ATTR_UNUSED(why_bogus))
{
log_assert(0);
}
int context_query_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
{
log_assert(0);
@@ -1308,3 +1315,4 @@ int codeline_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
log_assert(0);
return 0;
}
+3 -2
View File
@@ -101,8 +101,6 @@ struct worker {
struct comm_point* cmd_com;
/** timer for statistics */
struct comm_timer* stat_timer;
/** remote control state (for first thread only) */
struct daemon_remote* rc;
/** number of requests that can be handled by this worker */
size_t request_size;
@@ -238,4 +236,7 @@ void worker_stats_clear(struct worker* worker);
/** statistics timer callback handler */
void worker_stat_timer_cb(void* arg);
/** probe timer callback handler */
void worker_probe_timer_cb(void* arg);
#endif /* DAEMON_WORKER_H */
+3
View File
@@ -14,4 +14,7 @@ Jakob Schlyter - for advice on secure settings, random numbers and blacklists.
Ondřej Surý - running coverity analysis tool on 0.9 dev version.
Alexander Gall - multihomed, anycast testing of unbound resolver server.
Zdenek Vasicek and Marek Vavrusa - python module.
cz.nic - sponsoring 'summer of code' development by Zdenek and Marek.
Brett Carr - windows beta testing.
Luca Bruno - patch for windows support in libunbound hosts and resolvconf().
Tom Hendrikx - contributed split-itar.sh a useful script to 5011-track ITAR.
+507
View File
@@ -1,8 +1,515 @@
17 December 2009: Wouter
- review comments.
- tag 1.4.1.
15 December 2009: Wouter
- Answer to qclass=ANY queries, with class IN contents.
Test that validation also works.
- updated ldns snapshot tarball with latest fixes (parsing records).
11 December 2009: Wouter
- on IPv4 UDP turn off DF flag.
10 December 2009: Wouter
- requirements.txt updated with design choice explanations.
- Reading fixes: fix to set unlame when child confirms parent glue,
and fix to avoid duplicate addresses in delegation point.
- verify_rrsig routine checks expiration last.
9 December 2009: Wouter
- Fix Bug#287(reopened): update of ldns tarball with fix for parse
errors generated for domain names like '.example.com'.
- Fix SOA excluded from negative DS responses. Reported by Hauke
Lampe. The negative cache did not include proper SOA records for
negative qtype DS responses which makes BIND barf on it, such
responses are now only used internally.
- Fix negative cache lookup of closestencloser check of DS type bit.
8 December 2009: Wouter
- Fix for lookup of parent-child disagreement domains, where the
parent-side glue works but it does not provide proper NS, A or AAAA
for itself, fixing domains such as motorcaravanners.eu.
- Feature: you can specify a port number in the interface: line, so
you can bind the same interface multiple times at different ports.
7 December 2009: Wouter
- Bug#287: Fix segfault when unbound-control remove nonexistent local
data. Added check to tests.
1 December 2009: Wouter
- Fix crash with module-config "iterator".
- Added unit test that has "iterator" module-config.
30 November 2009: Wouter
- bug#284: fix parse of # without end-of-line at end-of-file.
26 November 2009: Wouter
- updated ldns with release candidate for version 1.6.3.
- tag for 1.4.0 release.
- 1.4.1 version in trunk.
- Fixup major libtool version to 2 because of why_bogus change.
It was 1:5:0 but should have been 2:0:0.
23 November 2009: Wouter
- Patch from David Hubbard for libunbound manual page.
- Fixup endless spinning in unbound-control stats reported by
Attila Nagy. Probably caused by clock reversal.
20 November 2009: Wouter
- contrib/split-itar.sh contributed by Tom Hendrikx.
19 November 2009: Wouter
- better argument help for unbound-control.
- iana portlist updated.
17 November 2009: Wouter
- noted multiple entries for multiple domain names in example.conf.
- iana portlist updated.
16 November 2009: Wouter
- Fixed signer detection of CNAME responses without signatures.
- Fix#282 libunbound memleak on error condition by Eric Sesterhenn.
- Tests for CNAMEs to deeper trust anchors, secure and bogus.
- svn tag 1.4.0rc1 made.
13 November 2009: Wouter
- Fixed validation failure for CNAME to optout NSEC3 nodata answer.
- unbound-host does not fail on type ANY.
- Fixed wireparse failure to put RRSIGs together with data in some
long ANY mix cases, which fixes validation failures.
12 November 2009: Wouter
- iana portlist updated.
- fix manpage errors reported by debian lintian.
- review comments.
- fixup very long vallog2 level error strings.
11 November 2009: Wouter
- ldns tarball updated (to 1.6.2).
- review comments.
10 November 2009: Wouter
- Thanks to Surfnet found bug in new dnssec-retry code that failed
to combine well when combined with DLV and a particular failure.
- Fixed unbound-control -h output about argument optionality.
- review comments.
5 November 2009: Wouter
- lint fixes and portability tests.
- better error text for multiple domain keys in one autotrust file.
2 November 2009: Wouter
- Fix bug where autotrust does not work when started with a DS.
- Updated GOST unit tests for unofficial algorithm number 249
and DNSKEY-format changes in draft version -01.
29 October 2009: Wouter
- iana portlist updated.
- edns-buffer-size option, default 4096.
- fixed do-udp: no.
28 October 2009: Wouter
- removed abort on prealloc failure, error still printed but softfail.
- iana portlist updated.
- RFC 5702: RSASHA256 and RSASHA512 support enabled by default.
- ldns tarball updated (which also enables rsasha256 support).
27 October 2009: Wouter
- iana portlist updated.
8 October 2009: Wouter
- please doxygen
- add val-log-level print to corner case (nameserver.epost.bg).
- more detail to errors from insecure delegation checks.
- Fix double time subtraction in negative cache reported by
Amanda Constant and Hugh Mahon.
- Made new validator error string available from libunbound for
applications. It is in result->why_bogus, a zero-terminated string.
unbound-host prints it by default if a result is bogus.
Also the errinf is public in module_qstate (for other modules).
7 October 2009: Wouter
- retry for validation failure in DS and prime results. Less mem use.
unit test. Provisioning in other tests for requeries.
- retry for validation failure in DNSKEY in middle of chain of trust.
unit test.
- retry for empty non terminals in chain of trust and unit test.
- Fixed security bug where the signatures for NSEC3 records were not
checked when checking for absence of DS records. This could have
enabled the substitution of an insecure delegation.
- moved version number to 1.4.0 because of 1.3.4 release with only
the NSEC3 patch from the entry above.
- val-log-level: 2 shows extended error information for validation
failures, but still one (longish) line per failure. For example:
validation failure <example.com. DNSKEY IN>: signature expired from
192.0.2.4 for trust anchor example.com. while building chain of trust
validation failure <www.example.com. A IN>: no signatures from
192.0.2.6 for key example.com. while building chain of trust
6 October 2009: Wouter
- Test set updated to provide additional ns lookup result.
The retry would attempt to fetch the data from other nameservers
for bogus data, and this needed to be provisioned in the tests.
5 October 2009: Wouter
- first validation failure retry code. Retries for data failures.
And unit test.
2 October 2009: Wouter
- improve 5011 modularization.
- fix unbound-host so -d can be given before -C.
- iana portlist updated.
28 September 2009: Wouter
- autotrust-anchor-file can read multiline input and $ORIGIN.
- prevent integer overflow in holddown calculation. review fixes.
- fixed race condition in trust point revocation. review fix.
- review fixes to comments, removed unused code.
25 September 2009: Wouter
- so-rcvbuf: 4m option added. Set this on large busy servers to not
drop the occasional packet in spikes due to full socket buffers.
netstat -su keeps a counter of UDP dropped due to full buffers.
- review of validator/autotrust.c, small fixes and comments.
23 September 2009: Wouter
- 5011 query failed counts verification failures, not lookup failures.
- 5011 probe failure handling fixup.
- test unbound reading of original autotrust data.
The metadata per-key, such as key state (PENDING, MISSING, VALID) is
picked up, otherwise performs initial probe like usual.
22 September 2009: Wouter
- autotrust test with algorithm rollover, new ordering of checks
assists in orderly rollover.
- autotrust test with algorithm rollover to unknown algorithm.
checks if new keys are supported before adding them.
- autotrust test with trust point revocation, becomes unsigned.
- fix DNSSEC-missing-signature detection for minimal responses
for qtype DNSKEY (assumes DNSKEY occurs at zone apex).
18 September 2009: Wouter
- autotrust tests, fix trustpoint timer deletion code.
fix count of valid anchors during missing remove.
- autotrust: pick up REVOKE even if not signed with known other keys.
17 September 2009: Wouter
- fix compile of unbound-host when --enable-alloc-checks.
- Fix lookup problem reported by Koh-ichi Ito and Jaap Akkerhuis.
- Manual page fixes reported by Tony Finch.
16 September 2009: Wouter
- Fix memory leak reported by Tao Ma.
- Fix memstats test tool for log-time-ascii log format.
15 September 2009: Wouter
- iana portlist updated.
10 September 2009: Wouter
- increased MAXSYSLOGLEN so .bg key can be printed in debug output.
- use linebuffering for log-file: output, this can be significantly
faster than the previous fflush method and enable some class of
resolvers to use high verbosity (for short periods).
Not on windows, because line buffering does not work there.
9 September 2009: Wouter
- Fix bug where DNSSEC-bogus messages were marked with too high TTL.
The RRsets would still expire at the normal time, but this would
keep messages bogus in the cache for too long.
- regression test for that bug.
- documented that load_cache is meant for debugging.
8 September 2009: Wouter
- fixup printing errors when load_cache, they were printed to the
SSL connection which broke, now to the log.
- new ldns - with fixed parse of large SOA values.
7 September 2009: Wouter
- autotrust testbound scenarios.
- autotrust fix that failure count is written to file.
- autotrust fix that keys may become valid after add holddown time
alone, before the probe returns.
4 September 2009: Wouter
- Changes to make unbound work with libevent-2.0.3 alpha. (in
configure detection due to new ssl dependency in libevent)
- do not call sphinx for documentation when python is disabled.
- remove EV_PERSIST from libevent timeout code to make the code
compatible with the libevent-2.0. Works with older libevent too.
- fix memory leak in python code.
3 September 2009: Wouter
- Got a patch from Luca Bruno for libunbound support on windows to
pick up the system resolvconf nameservers and hosts there.
- included ldns updated (enum warning fixed).
- makefile fix for parallel makes.
- Patch from Zdenek Vasicek and Attila Nagy for using the source IP
from python scripts. See pythonmod/examples/resip.py.
- doxygen comment fixes.
2 September 2009: Wouter
- TRAFFIC keyword for testbound. Simplifies test generation.
${range lower val upper} to check probe timeout values.
- test with 5011-prepublish rollover and revocation.
- fix revocation of RR for autotrust, stray exclamation mark.
1 September 2009: Wouter
- testbound variable arithmetic.
- autotrust probe time is randomised.
- autotrust: the probe is active and does not fetch from cache.
31 August 2009: Wouter
- testbound variable processing.
28 August 2009: Wouter
- fixup unbound-control lookup to print forward and stub servers.
27 August 2009: Wouter
- autotrust: mesh answer callback is empty.
26 August 2009: Wouter
- autotrust probing.
- iana portlist updated.
25 August 2009: Wouter
- fixup memleak in trust anchor unsupported algorithm check.
- iana portlist updated.
- autotrust options: add-holddown, del-holddown, keep-missing.
- autotrust store revoked status of trust points.
- ctime_r compat definition.
- detect yylex_destroy() in configure.
- detect SSL_get_compression_methods declaration in configure.
- fixup DS lookup at anchor point with unsigned parent.
- fixup DLV lookup for DS queries to unsigned domains.
24 August 2009: Wouter
- cleaner memory allocation on exit. autotrust test routines.
- free all memory on program exit, fix for ssl and flex.
21 August 2009: Wouter
- autotrust: debug routines. Read,write and conversions work.
20 August 2009: Wouter
- autotrust: save and read trustpoint variables.
19 August 2009: Wouter
- autotrust: state table updates.
- iana portlist updated.
17 August 2009: Wouter
- autotrust: process events.
17 August 2009: Wouter
- Fix so that servers are only blacklisted if they fail to reply
to 16 queries in a row and the timeout gets above 2 minutes.
- autotrust work, split up DS verification of DNSKEYs.
14 August 2009: Wouter
- unbound-control lookup prints out infra cache information, like RTT.
- Fix bug in DLV lookup reported by Amanda from Secure64.
It could sometimes wrongly classify a domain as unsigned, which
does not give the AD bit on replies.
13 August 2009: Wouter
- autotrust read anchor files. locked trust anchors.
12 August 2009: Wouter
- autotrust import work.
11 August 2009: Wouter
- Check for openssl compatible with gost if enabled.
- updated unit test for GOST=211 code.
Nicer naming of test files.
- iana portlist updated.
7 August 2009: Wouter
- call OPENSSL_config() in unbound and unit test so that the
operator can use openssl.cnf for configuration options.
- removed small memory leak from config file reader.
6 August 2009: Wouter
- configure --enable-gost for GOST support, experimental
implementation of draft-dolmatov-dnsext-dnssec-gost-01.
- iana portlist updated.
- ldns tarball updated (with GOST support).
5 August 2009: Wouter
- trunk moved to 1.3.4.
4 August 2009: Wouter
- Added test that the examples from draft rsasha256-14 verify.
- iana portlist updated.
- tagged 1.3.3
3 August 2009: Wouter
- nicer warning when algorithm not supported, tells you to upgrade.
- iana portlist updated.
27 July 2009: Wouter
- Updated unbound-cacti contribution from Dmitriy Demidov, with
the queue statistics displayed in its own graph.
- iana portlist updated.
22 July 2009: Wouter
- Fix bug found by Michael Tokarev where unbound would try to
prime the root servers even though forwarders are configured for
the root.
- tagged 1.3.3rc1
21 July 2009: Wouter
- Fix server selection, so that it waits for open target queries when
faced with lameness.
20 July 2009: Wouter
- Ignore transient sendto errors, no route to host, and host, net down.
- contrib/update-anchor.sh has -r option for root-hints.
- feature val-log-level: 1 prints validation failures so you can
keep track of them during dnssec deployment.
16 July 2009: Wouter
- fix replacement malloc code. Used in crosscompile.
- makedist -w creates crosscompiled setup.exe on fedora11.
15 July 2009: Wouter
- dependencies for compat items, for crosscompile.
- mingw32 crosscompile changes, dependencies and zipfile creation.
and with System.dll from the windows NSIS you can make setup.exe.
- package libgcc_s_sjlj exception handler for NSISdl.dll.
14 July 2009: Wouter
- updated ldns tarball for solaris x64 compile assistance.
- no need to define RAND_MAX from config.h.
- iana portlist updated.
- configure changes and ldns update for mingw32 crosscompile.
13 July 2009: Wouter
- Fix for crash at start on windows.
- tag for release 1.3.2.
- trunk has version 1.3.3.
- Fix for ID bits on windows to use all 16. RAND_MAX was not
defined like you'd expect on mingw. Reported by Mees de Roo.
9 July 2009: Wouter
- tag for release 1.3.1.
- trunk has version 1.3.2.
7 July 2009: Wouter
- iana portlist updated.
6 July 2009: Wouter
- prettier error handling in SSL setup.
- makedist.sh uname fix (same as ldns).
- updated fedora spec file.
3 July 2009: Wouter
- fixup linking when ldnsdir is "".
30 June 2009: Wouter
- more lenient truncation checks.
29 June 2009: Wouter
- ldns trunk r2959 imported as tarball, because of solaris cc compile
support for c99. r2960 for better configure.
- better wrongly_truncated check.
- On Linux, fragment IPv6 datagrams to the IPv6 minimum MTU, to
avoid dropped packets at routers.
26 June 2009: Wouter
- Fix EDNS fallback when EDNS works for short answers but long answers
are dropped.
22 June 2009: Wouter
- fixup iter priv strict aliasing while preserving size of sockaddr.
- iana portlist updated. (one less port allocated, one more fraction
of a bit for security!)
- updated fedora specfile in contrib from Paul Wouters.
19 June 2009: Wouter
- Fixup strict aliasing warning in iter priv code.
and config_file code.
- iana portlist updated.
- harden-referral-path: handle cases where NS is in answer section.
18 June 2009: Wouter
- Fix of message parse bug where (specifically) an NSEC and RRSIG
in the wrong order would be parsed, but put wrongly into internal
structures so that later validation would fail.
- Extreme lenience for wrongly truncated replies where a positive
reply has an NS in the authority but no signatures. They are
turned into minimal responses with only the (secure) answer.
- autoconf 2.63 for configure.
- python warnings suppress. Keep python API away from header files.
17 June 2009: Wouter
- CREDITS entry for cz.nic, sponsoring a 'summer of code' that was
used for the python code in unbound. (http://www.nic.cz/vip/ in cz).
16 June 2009: Wouter
- Fixup opportunistic target query generation to it does not
generate queries that are known to fail.
- Touchup on munin total memory report.
- messages picked out of the cache by the iterator are checked
if their cname chain is still correct and if validation status
has to be reexamined.
15 June 2009: Wouter
- iana portlist updated.
14 June 2009: Wouter
- Fixed bug where cached responses would lose their security
status on second validation, which especially impacted dlv
lookups. Reported by Hauke Lampe.
13 June 2009: Wouter
- bug #254. removed random whitespace from example.conf.
12 June 2009: Wouter
- Fixup potential wrong NSEC picked out of the cache.
- If unfulfilled callbacks are deleted they are called with an error.
- fptr wlist checks for mesh callbacks.
- fwd above stub in configuration works.
11 June 2009: Wouter
- Fix queries for type DS when forward or stub zones are there.
They are performed to higherup domains, and thus treated as if
going to higher zones when looking up the right forward or stub
server. This makes a stub pointing to a local server that has
a local view of example.com signed with the same keys as are
publicly used work. Reported by Johan Ihren.
- Added build-unbound-localzone-from-hosts.pl to contrib, from
Dennis DeDonatis. It converts /etc/hosts into config statements.
- same thing fixed for forward-zone and DS, chain of trust from
public internet into the forward-zone works now. Added unit test.
9 June 2009: Wouter
- openssl key files are opened apache-style, when user is root and
before chrooting. This makes permissions on remote-control key
files easier to set up. Fixes bug #251.
- flush_type and flush_name remove msg cache entries.
- codereview - dp copy bogus setting fix.
8 June 2009: Wouter
- Removed RFC5011 REVOKE flag support. Partial 5011 support may cause
inadvertant behaviour.
- 1.3.0 tarball for release created.
- 1.3.1 development in svn trunk.
- iana portlist updated.
- fix lint from complaining on ldns/sha.h.
- help compiler figure out aliasing in priv_rrset_bad() routine.
- fail to configure with python if swig is not found.
- unbound_munin_ in contrib uses ps to show rss if sbrk does not work.
3 June 2009: Wouter
- fixup bad free() when wrongly encoded DSA signature is seen.
Reported by Paul Wouters.
- review comments from Matthijs.
2 June 2009: Wouter
- --enable-sha2 option. The draft rsasha256 changed its algorithm
numbers too often. Therefore it is more prudent to disable the
RSASHA256 and RSASHA512 support by default.
- ldns trunk included as new tarball.
- recreated the 1.3.0 tag in svn. rc1 tarball generated at this point.
29 May 2009: Wouter
- fixup doc bug in README reported by Matthew Dempsky.
+11 -2
View File
@@ -63,8 +63,10 @@ This software is under BSD license, see LICENSE for details.
Needs python-devel and swig development tools.
* --with-pythonmodule
Compile the python module that processes responses in the server.
* --enable-sha2
Enable draft support for RSASHA256 and RSASHA512.
* --disable-sha2
Disable support for RSASHA256 and RSASHA512 crypto.
* --enable-gost
Enable draft support for GOST crypto.
* 'make test' attempts to run a series of tests, depending on the support
programs that are installed.
@@ -91,6 +93,13 @@ 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...].
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
unbound daemon and unbound-control.
o Crosscompile seems to hang. You tried to install unbound under wine.
wine regedit and remove all the unbound entries from the registry or
delete .wine/drive_c.
Acknowledgements
----------------
+14 -1
View File
@@ -35,11 +35,15 @@ o overhaul outside-network servicedquery to merge with udpwait and tcpwait,
o check into rebinding ports for efficiency, configure time test.
o EVP hardware crypto support.
o option to ignore all inception and expiration dates for rrsigs.
o option to use builtin ldns explicitly. Or stop shipping builtin tarball.
o cleaner code; return and func statements on newline.
o memcached module that sits before validator module; checks for memcached
data (on local lan), stores recursion lookup. Provides one cache for multiple resolver machines, coherent reply content in anycast setup.
o no openssl_add_all_algorithms, but only the ones necessary, less space.
o listen to NOTIFY messages for zones and flush the cache for that zone
if received. Useful when also having a stub to that auth server.
Needs proper protection, TSIG, in place.
o winevent - do not go more than 64 fds (by polling with select one by
one), win95/98 have 100fd limit in the kernel, so this ruins w9x portability.
*** Features features, for later
* dTLS, TLS, look to need special port numbers, cert storage, recent libssl.
@@ -55,4 +59,13 @@ o on windows version, implement that OS ancillary data capabilities for
o local-zone directive with authority service, full authority server
is a non-goal.
o infra and lame cache: easier size config (in Mb), show usage in graphs.
- store time of dump in cachedumps, so that on a load the ttls can be
compared to the absolute time, and now-expired items can be dealt with.
later
- selective verbosity; ubcontrol trace example.com
- cache fork-dump, pre-load
- for fwds, send queries to N servers in fwd-list, use first reply.
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
+56 -28
View File
@@ -18,7 +18,7 @@ server:
# print statistics to the log (for every thread) every N seconds.
# Set to "" or 0 to disable. Default is disabled.
# statistics-interval: 0
# enable cumulative statistics, without clearing them after printing.
# statistics-cumulative: no
@@ -32,12 +32,13 @@ server:
# specify the interfaces to answer queries from by ip-address.
# The default is to listen to localhost (127.0.0.1 and ::1).
# specify 0.0.0.0 and ::0 to bind to all available interfaces.
# specify every interface on a new 'interface:' labelled line.
# specify every interface[@port] on a new 'interface:' labelled line.
# The listen interfaces are not changed on reload, only on restart.
# interface: 192.0.2.153
# interface: 192.0.2.154
# interface: 192.0.2.154@5003
# interface: 2001:DB8::5
# enable this feature to copy the source address of queries to reply.
# Socket options are not supported on all platforms. experimental.
# interface-automatic: no
@@ -55,7 +56,7 @@ server:
# number of ports to allocate per thread, determines the size of the
# port range that can be open simultaneously.
# outgoing-range: 256
# permit unbound to use this port number or port range for
# making outgoing queries, using an outgoing interface.
# outgoing-port-permit: 32768
@@ -72,7 +73,15 @@ server:
# number of incoming simultaneous tcp buffers to hold per thread.
# incoming-num-tcp: 10
# buffer size for UDP port 53 incoming (SO_RCVBUF socket option).
# 0 is system default. Use 4m to catch query spikes for busy servers.
# so-rcvbuf: 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
# buffer size for handling DNS data. No messages larger than this
# size can be sent or received, by UDP or TCP. In bytes.
# msg-buffer-size: 65552
@@ -191,7 +200,7 @@ server:
# the log file, "" means log to stderr.
# Use of this option sets use-syslog to "no".
# logfile: ""
# Log to syslog(3) if yes. The log facility LOG_DAEMON is used to
# log to, with identity "unbound". If yes, it overrides the logfile.
# use-syslog: yes
@@ -201,23 +210,23 @@ server:
# the pid file. Can be an absolute path outside of chroot/work dir.
# pidfile: "@UNBOUND_PIDFILE@"
# file to read root hints from.
# get one from ftp://FTP.INTERNIC.NET/domain/named.cache
# root-hints: ""
# enable to not answer id.server and hostname.bind queries.
# hide-identity: no
# enable to not answer version.server and version.bind queries.
# hide-version: no
# the identity to report. Leave "" or default to return hostname.
# identity: ""
# the version to report. Leave "" or default to return package version.
# version: ""
# the target fetch policy.
# series of integers describing the policy per dependency depth.
# The number of values in the list determines the maximum dependency
@@ -227,16 +236,16 @@ server:
# positive value: fetch that many targets opportunistically.
# Enclose the list of numbers between quotes ("").
# target-fetch-policy: "3 2 1 0 0"
# Harden against very small EDNS buffer sizes.
# harden-short-bufsize: no
# Harden against unseemly large queries.
# harden-large-queries: no
# Harden against out of zone rrsets, to avoid spoofing attempts.
# harden-glue: yes
# Harden against receiving dnssec-stripped data. If you turn it
# off, failing to validate dnskey data for a trustanchor will
# trigger insecure mode for that zone (like without a trustanchor).
@@ -252,7 +261,7 @@ server:
# Use 0x20-encoded random bits in the query to foil spoof attempts.
# This feature is an experimental implementation of draft dns-0x20.
# use-caps-for-id: no
# Enforce privacy of these addresses. Strips them away from answers.
# It may cause DNSSEC validation to additionally mark it as bogus.
# Protects against 'DNS Rebinding' (uses browser as network proxy).
@@ -268,7 +277,7 @@ server:
# Allow the domain (and its subdomains) to contain private addresses.
# local-data statements are allowed to contain private addresses too.
# private-domain: "example.com"
# If nonzero, unwanted replies are not only reported in statistics,
# but also a running total is kept per thread. If it reaches the
# threshold, a warning is printed and a defensive action is taken,
@@ -280,15 +289,15 @@ server:
# List one address per entry. List classless netblocks with /size,
# do-not-query-address: 127.0.0.1/8
# do-not-query-address: ::1
# if yes, the above default do-not-query-address entries are present.
# if no, localhost can be queried (for testing and debugging).
# do-not-query-localhost: yes
# module configuration of the server. A string with identifiers
# separated by spaces. "iterator" or "validator iterator"
# module-config: "validator iterator"
# 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
@@ -299,6 +308,11 @@ server:
# Zone file format, with DS and DNSKEY entries.
# 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.
# (These examples are from August 2007 and may not be valid anymore).
@@ -310,7 +324,7 @@ server:
# but has a different file format. Format is BIND-9 style format,
# the trusted-keys { name flag proto algo "key"; }; clauses are read.
# trusted-keys-file: ""
# Ignore chain of trust. Domain is treated as insecure.
# domain-insecure: "example.com"
@@ -318,35 +332,49 @@ server:
# Do not set this unless you are debugging signature inception
# and expiration. "" or "0" turns the feature off.
# val-override-date: ""
# The time to live for bogus data, rrsets and messages. This avoids
# some of the revalidation, until the time interval expires. in secs.
# 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.
# This leeway is capped with a minimum and a maximum. In seconds.
# val-sig-skew-min: 3600
# val-sig-skew-max: 86400
# Should additional section of secure message also be kept clean of
# unsecure data. Useful to shield the users of this validator from
# potential bogus data in the additional section. All unsigned data
# in the additional section is removed from secure messages.
# val-clean-additional: yes
# Turn permissive mode on to permit bogus messages. Thus, messages
# for which security checks failed will be returned to clients,
# instead of SERVFAIL. It still performs the security checks, which
# result in interesting log files and possibly the AD bit in
# replies if the message is found secure. The default is off.
# val-permissive-mode: no
# Have the validator log failed validations for your diagnosis.
# 0: off. 1: A line per failed user query.
# val-log-level: 0
# It is possible to configure NSEC3 maximum iteration counts per
# keysize. Keep this table very short, as linear search is done.
# A message with an NSEC3 with larger count is marked insecure.
# List in ascending order the keysize and count values.
# val-nsec3-keysize-iterations: "1024 150 2048 500 4096 2500"
# instruct the auto-trust-anchor-file probing to add anchors after ttl.
# add-holddown: 2592000 # 30 days
# instruct the auto-trust-anchor-file probing to del anchors after ttl.
# del-holddown: 2592000 # 30 days
# auto-trust-anchor-file probing removes missing anchors after ttl.
# If the value 0 is given, missing anchors are not removed.
# keep-missing: 31622400 # 366 days
# the amount of memory to use for the key cache.
# plain value in bytes or you can append k, m or G. default is "4Mb".
@@ -356,7 +384,7 @@ server:
# the number of slabs must be a power of 2.
# more slabs reduce lock contention, but fragment memory usage.
# key-cache-slabs: 4
# the amount of memory to use for the negative cache (used for DLV).
# plain value in bytes or you can append k, m or G. default is "1Mb".
# neg-cache-size: 1m
+10 -11
View File
@@ -100,9 +100,7 @@
\fIint\fR
\fBub_resolve\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR name,
.br
\fIint\fR rrtype, \fIint\fR rrclass, \fIint*\fR secure,
.br
\fIint*\fR data, \fIstruct ub_result**\fR result);
\fIint\fR rrtype, \fIint\fR rrclass, \fIstruct ub_result**\fR result);
.LP
\fIint\fR
\fBub_resolve_async\fR(\fIstruct ub_ctx*\fR ctx, \fIchar*\fR name,
@@ -201,14 +199,16 @@ Usually "/etc/resolv.conf". Uses those nameservers as caching proxies.
If they do not support DNSSEC, validation may fail.
Only nameservers are picked up, the searchdomain, ndots and other
settings from \fIresolv.conf\fR(5) are ignored.
If fname NULL is passed, "/etc/resolv.conf" is used.
If fname NULL is passed, "/etc/resolv.conf" is used (if on Windows,
the system\-wide configured nameserver is picked instead).
At this time it is only possible to set configuration before the
first resolve is done.
.TP
.B ub_ctx_hosts
Read list of hosts from the filename given.
Usually "/etc/hosts". When queried for, these addresses are not marked
DNSSEC secure. If fname NULL is passed, "/etc/hosts" is used.
DNSSEC secure. If fname NULL is passed, "/etc/hosts" is used
(if on Windows, etc/hosts from WINDIR is picked instead).
At this time it is only possible to set configuration before the
first resolve is done.
.TP
@@ -217,7 +217,7 @@ ub_ctx_add_ta
Add a trust anchor to the given context.
At this time it is only possible to add trusted keys before the
first resolve is done.
The format is a string, similar to the zone-file format,
The format is a string, similar to the zone\-file format,
[domainname] [type] [rdata contents]. Both DS and DNSKEY records are accepted.
.TP
.B ub_ctx_add_ta_file
@@ -228,13 +228,13 @@ first resolve is done.
.TP
.B ub_ctx_trustedkeys
Add trust anchors to the given context.
Pass the name of a bind-style config file with trusted-keys{}.
Pass the name of a bind\-style config file with trusted\-keys{}.
At this time it is only possible to add trusted keys before the
first resolve is done.
.TP
.B ub_ctx_debugout
Set debug and error log output to the given stream. Pass NULL to disable
output. Default is stderr. File-names or using syslog can be enabled
output. Default is stderr. File\-names or using syslog can be enabled
using config options, this routine is for using your own stream.
.TP
.B ub_ctx_debuglevel
@@ -281,8 +281,6 @@ Will perform necessary callbacks.
Perform resolution and validation of the target name.
The name is a domain name in a zero terminated text string.
The rrtype and rrclass are DNS type and class codes.
The value secure returns true if the answer validated securely.
The value data returns true if there was data.
The result structure is newly allocated with the resulting data.
.TP
.B ub_resolve_async
@@ -349,6 +347,7 @@ The result of the DNS resolution and validation is returned as
int nxdomain; /* true if nodata because name does not exist */
int secure; /* true if result is secure */
int bogus; /* true if a security failure happened */
char* why_bogus; /* string with error if bogus */
};
.fi
.P
@@ -366,7 +365,7 @@ returns NULL on an error (a malloc failure).
.B ub_poll
returns true if some information may be available, false otherwise.
.B ub_fd
returns a file descriptor or -1 on error.
returns a file descriptor or \-1 on error.
.SH "SEE ALSO"
\fIunbound.conf\fR(5),
\fIunbound\fR(8).
+24
View File
@@ -235,6 +235,9 @@ o EDNS fallback. Is done according to the EDNS RFC (and update draft-00).
It minimizes the chances of a dropped query making a (DNSSEC) EDNS server
falsely EDNS-nonsupporting, and thus DNSSEC-bogus, works well with
middleboxes, and can detect the occasional authority that drops EDNS.
For some boxes it is necessary to probe for every failing query, a
reassurance that the DNS server does EDNS does not mean that path can
take large DNS answers.
o 0x20 backoff.
The draft describes to back off to the next server, and go through all
@@ -257,3 +260,24 @@ o NXDOMAIN and SOA serial numbers.
updated more carefully. If one of the NSEC records in an NXDOMAIN is
updated from another query, the NXDOMAIN is dropped from the cache,
and queried for again, so that its proof can be checked again.
o SOA records in negative cached answers for DS queries.
The current unbound code uses a negative cache for queries for type DS.
This speeds up building chains of trust, and uses NSEC and NSEC3
(optout) information to speed up lookups. When used internally,
the bare NSEC(3) information is sufficient, probably picked up from
a referral. When answering to clients, a SOA record is needed for
the correct message format, a SOA record is picked from the cache
(and may not actually match the serial number of the SOA for which the
NSEC and NSEC3 records were obtained) if available otherwise network
queries are performed to get the data.
o Parent and child with different nameserver information.
A misconfiguration that sometimes happens is where the parent and child
have different NS, glue information. The child is authoritative, and
unbound will not trust information from the parent nameservers as the
final answer. To help lookups, unbound will however use the parent-side
version of the glue as a last resort lookup. This resolves lookups for
those misconfigured domains where the servers reported by the parent
are the only ones working, and servers reported by the child do not.
+4 -4
View File
@@ -9,16 +9,16 @@
.\"
.SH "NAME"
.LP
unbound-checkconf
unbound\-checkconf
\- Check unbound configuration file for errors.
.SH "SYNOPSIS"
.B unbound-checkconf
.B unbound\-checkconf
.RB [ \-h ]
.RB [ \-o
.IR option ]
.RI [ cfgfile ]
.SH "DESCRIPTION"
.B Unbound-checkconf
.B Unbound\-checkconf
checks the configuration file for the
\fIunbound\fR(8)
DNS resolver for syntax and other errors.
@@ -38,7 +38,7 @@ printed to stdout. For "" (disabled) options an empty line is printed.
The config file to read with settings for unbound. It is checked.
If omitted, the config file at the default location is checked.
.SH "EXIT CODE"
The unbound-checkconf program exits with status code 1 on error,
The unbound\-checkconf program exits with status code 1 on error,
0 for a correct config file.
.SH "FILES"
.TP
+13 -11
View File
@@ -9,10 +9,11 @@
.\"
.SH "NAME"
.LP
unbound-control
.B unbound\-control,
.B unbound\-control\-setup
\- Unbound remote server control utility.
.SH "SYNOPSIS"
.B unbound-control
.B unbound\-control
.RB [ \-h ]
.RB [ \-c
.IR cfgfile ]
@@ -20,7 +21,7 @@ unbound-control
.IR server ]
.IR command
.SH "DESCRIPTION"
.B Unbound-control
.B Unbound\-control
performs remote administration on the \fIunbound\fR(8) DNS server.
It reads the configuration file, contacts the unbound server over SSL
sends the command and displays the result.
@@ -98,7 +99,8 @@ redirect it to a file to store the cache in a file.
.B load_cache
The contents of the cache is loaded from stdin. Uses the same format as
dump_cache uses. Loading the cache with old, or wrong data can result
in old or wrong data returned to clients.
in old or wrong data returned to clients. Loading data into the cache
in this way is supported in order to aid with debugging.
.TP
.B lookup \fIname
Print to stdout the name servers that would be used to look up the
@@ -141,11 +143,11 @@ nameservers, should go to the internet root nameservers itself, or show
the current config. You could pass the nameservers after a DHCP update.
.IP
Without arguments the current list of addresses used to forward all queries
to is printed. On startup this is from the forward-zone "." configuration.
to is printed. On startup this is from the forward\-zone "." configuration.
Afterwards it shows the status. It prints off when no forwarding is used.
.IP
If \fIoff\fR is passed, forwarding is disabled and the root nameservers
are used. This can be used to avoid to avoid buggy or non-DNSSEC supporting
are used. This can be used to avoid to avoid buggy or non\-DNSSEC supporting
nameservers returned from DHCP. But may not work in hotels or hotspots.
.IP
If one or more IPv4 or IPv6 addresses are given, those are then used to forward
@@ -156,7 +158,7 @@ By default the forwarder information from the config file for the root "." is
used. The config file is not changed, so after a reload these changes are
gone. Other forward zones from the config file are not affected by this command.
.SH "EXIT CODE"
The unbound-control program exits with status code 1 on error, 0 on success.
The unbound\-control program exits with status code 1 on error, 0 on success.
.SH "SET UP"
The setup requires a self\-signed certificate and private keys for both
the server and client. The script \fIunbound\-control\-setup\fR generates
@@ -170,7 +172,7 @@ If you have not configured
a username in unbound.conf, the keys need read permission for the user
credentials under which the daemon is started.
The script preserves private keys present in the directory.
After running the script as root, turn on \fBcontrol-enable\fR in
After running the script as root, turn on \fBcontrol\-enable\fR in
\fIunbound.conf\fR.
.SH "STATISTIC COUNTERS"
The \fIstats\fR command shows a number of statistic counters.
@@ -284,13 +286,13 @@ Printed for the other query types as well, but only for the types for which
queries were received, thus =0 entries are omitted for brevity.
.TP
.I num.query.type.other
Number of queries with query types 256-65535.
Number of queries with query types 256\-65535.
.TP
.I num.query.class.IN
The total number of queries over all threads with query class IN (internet).
Also printed for other classes (such as CH (CHAOS) sometimes used for
debugging), or NONE, ANY, used by dynamic update.
num.query.class.other is printed for classes 256-65535.
num.query.class.other is printed for classes 256\-65535.
.TP
.I num.query.opcode.QUERY
The total number of queries over all threads with query opcode QUERY.
@@ -356,7 +358,7 @@ unbound configuration file.
.TP
.I @UNBOUND_RUN_DIR@
directory with private keys (unbound_server.key and unbound_control.key) and
self-signed certificates (unbound_server.pem and unbound_control.pem).
self\-signed certificates (unbound_server.pem and unbound_control.pem).
.SH "SEE ALSO"
\fIunbound.conf\fR(5),
\fIunbound\fR(8).
+88 -20
View File
@@ -52,8 +52,8 @@ server:
username: unbound
# make sure unbound can access entropy from inside the chroot.
# e.g. on linux the use these commands (on BSD, devfs(8) is used):
# mount --bind -n /dev/random /etc/unbound/dev/random
# and mount --bind -n /dev/log /etc/unbound/dev/log
# mount \-\-bind \-n /dev/random /etc/unbound/dev/random
# and mount \-\-bind \-n /dev/log /etc/unbound/dev/log
chroot: "/etc/unbound"
# logfile: "/etc/unbound/unbound.log" #uncomment to use logfile.
pidfile: "/etc/unbound/unbound.pid"
@@ -108,17 +108,20 @@ The number of threads to create to serve clients. Use 1 for no threading.
.B port: \fI<port number>
The port number, default 53, on which the server responds to queries.
.TP
.B interface: \fI<ip address>
.B interface: \fI<ip address[@port]>
Interface to use to connect to the network. This interface is listened to
for queries from clients, and answers to clients are given from it.
Can be given multiple times to work on several interfaces. If none are
given the default is to listen to localhost.
The interfaces are not changed on a reload (kill \-HUP) but only on restart.
A port number can be specified with @port (without spaces between
interface and port number), if not specified the default port (from
\fBport\fR) is used.
.TP
.B interface-automatic: \fI<yes or no>
.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).
(and its socket options) and IPv4 (and have source\-interface socket options).
Default value is no.
.TP
.B outgoing\-interface: \fI<ip address>
@@ -142,7 +145,7 @@ Permit unbound to open this port or range of ports for use to send queries.
A larger number of permitted outgoing ports increases resilience against
spoofing attempts. Make sure these ports are not needed by other daemons.
By default only ports above 1024 that have not been assigned by IANA are used.
Give a port number or a range of the form "low-high", without spaces.
Give a port number or a range of the form "low\-high", without spaces.
.IP
The \fBoutgoing\-port\-permit\fR and \fBoutgoing\-port\-avoid\fR statements
are processed in the line order of the config file, adding the permitted ports
@@ -155,7 +158,7 @@ Do not permit unbound to open this port or range of ports for use to send
queries. Use this to make sure unbound does not grab a port that another
daemon needs. The port is avoided on all outgoing interfaces, both IP4 and IP6.
By default only ports above 1024 that have not been assigned by IANA are used.
Give a port number or a range of the form "low-high", without spaces.
Give a port number or a range of the form "low\-high", without spaces.
.TP
.B outgoing\-num\-tcp: \fI<number>
Number of outgoing TCP buffers to allocate per thread. Default is 10. If set
@@ -165,6 +168,17 @@ to 0, or if do_tcp is "no", no TCP queries to authoritative servers are done.
Number of incoming TCP buffers to allocate per thread. Default is 10. If set
to 0, or if do_tcp is "no", no TCP queries from clients are accepted.
.TP
.B edns\-buffer\-size: \fI<number>
Number of bytes size to advertise as the EDNS reassembly buffer size.
This is the value put into datagrams over UDP towards peers. The actual
buffer size is determined by msg\-buffer\-size (both for TCP and UDP). Do
not set lower than that value. Default is 4096 which is RFC recommended.
If you have fragmentation reassembly problems, usually seen as timeouts,
then a value of 1480 can fix it. Setting to 512 bypasses even the most
stringent path MTU problems, but is seen as extreme, since the amount
of TCP fallback generated is excessive (probably also for this resolver,
consider tuning the outgoing tcp number).
.TP
.B msg\-buffer\-size: \fI<number>
Number of bytes size of the message buffers. Default is 65552 bytes, enough
for 64 Kb packets, the maximum DNS message size. No message larger than this
@@ -197,6 +211,17 @@ 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.
.TP
.B so\-rcvbuf: \fI<number>
If not 0, then set the SO_RCVBUF socket option to get more buffer
space on UDP port 53 incoming queries. So that short spikes on busy
servers do not drop packets (see counter in netstat \-su). Default is
0 (use system value). Otherwise, the number of bytes to ask for, try
"4m" on a 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.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 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
@@ -432,7 +457,7 @@ not RFC standard, and could lead to performance problems because of the
extra query load that is generated. Experimental option.
.TP
.B use\-caps\-for\-id: \fI<yes or no>
Use 0x20-encoded random bits in the query to foil spoof attempts.
Use 0x20\-encoded random bits in the query to foil spoof attempts.
This perturbs the lowercase and uppercase of query names sent to
authority servers and checks if the reply still has the correct casing.
Disabled by default.
@@ -443,7 +468,7 @@ Give IPv4 of IPv6 addresses or classless subnets. These are addresses
on your private network, and are not allowed to be returned for public
internet names. Any occurence of such addresses are removed from
DNS answers. Additionally, the DNSSEC validator may mark the answers
bogus. This protects against so-called DNS Rebinding, where a user browser
bogus. This protects against so\-called DNS Rebinding, where a user browser
is turned into a network proxy, allowing remote access through the browser
to other parts of your private network. Some names can be allowed to
contain your private addresses, by default all the \fBlocal\-data\fR
@@ -491,6 +516,13 @@ File with trusted keys for validation. Both DS and DNSKEY entries can appear
in the file. The format of the file is the standard DNS Zone file format.
Default is "", or no trust anchor file.
.TP
.B auto\-trust\-anchor\-file: \fI<filename>
File with trust anchor for one zone, which is tracked with RFC5011 probes.
The probes are several times per month, thus the machine must be online
frequently. The initial file can be one with contents as described in
\fBtrust\-anchor\-file\fR. The file is written to when the anchor is updated,
so the unbound user must have write permission.
.TP
.B trust\-anchor: \fI<"Resource Record">
A DS or DNSKEY RR for a key to use for validation. Multiple entries can be
given to specify multiple trusted keys, in addition to the trust\-anchor\-files.
@@ -563,6 +595,13 @@ indeterminate or unchecked are not affected. Default is yes. Use this setting
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.
.TP
.B val\-permissive\-mode: \fI<yes or no>
Instruct the validator to mark bogus messages as indeterminate. The security
checks are performed, but if the result is bogus (failed security), the
@@ -580,6 +619,26 @@ be in ascending order and have at least one entry. If you set it to
"1024 65535" there is no restriction to NSEC3 iteration values.
This table must be kept short; a very long list could cause slower operation.
.TP
.B add\-holddown: \fI<seconds>
Instruct the \fBauto\-trust\-anchor\-file\fR probe mechanism for RFC5011
autotrust updates to add new trust anchors only after they have been
visible for this time. Default is 30 days as per the RFC.
.TP
.B del\-holddown: \fI<seconds>
Instruct the \fBauto\-trust\-anchor\-file\fR probe mechanism for RFC5011
autotrust updates to remove revoked trust anchors after they have been
kept in the revoked list for this long. Default is 30 days as per
the RFC.
.TP
.B keep\-missing: \fI<seconds>
Instruct the \fBauto\-trust\-anchor\-file\fR probe mechanism for RFC5011
autotrust updates to remove missing trust anchors after they have been
unseen for this long. This cleans up the state file if the target zone
does not perform trust anchor revocation, so this makes the auto probe
mechanism work with zones that perform regular (non\-5011) rollovers.
The default is 366 days. The value 0 does not remove missing anchors,
as per the RFC.
.TP
.B key\-cache\-size: \fI<number>
Number of bytes size of the key cache. Default is 4 megabytes.
A plain number is in bytes, append 'k', 'm' or 'g' for kilobytes, megabytes
@@ -629,14 +688,16 @@ If no local\-zone is given local\-data causes a transparent zone
to be created by default.
.TP 10
\h'5'\fIredirect\fR
The query is answered from the local data for the zone name.
The query is answered from the local data for the zone name.
There may be no local data beneath the zone name.
This answers queries for the zone, and all subdomains of the zone
with the local data for the zone.
It can be used to redirect a domain to a different address, with
It can be used to redirect a domain to return a different address record
to the end user, with
local\-zone: "example.com." redirect and
local\-data: "example.com. A 127.0.0.1"
queries for www.example.com and www.foo.example.com are redirected.
queries for www.example.com and www.foo.example.com are redirected, so
that users with web browsers cannot access sites with suffix example.com.
.TP 10
\h'5'\fInodefault\fR
Used to turn off default contents for AS112 zones. The other types
@@ -718,7 +779,7 @@ Reverse data for zones 8.E.F.ip6.arpa to B.E.F.ip6.arpa.
Reverse data for zone 8.B.D.0.1.0.0.2.ip6.arpa. This zone is used for
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
local\-zone: 8.B.D.0.1.0.0.2.ip6.arpa. nodefault
.fi
This also works with the other default zones.
.\" End of local-zone listing.
@@ -748,7 +809,7 @@ enabled, the \fIunbound\-control\fR(8) utility can be used to send
commands to the running unbound server. The server uses these clauses
to setup SSLv3 / TLSv1 security for the connection. The
\fIunbound\-control\fR(8) utility also reads the \fBremote\-control\fR
section for options. To setup the correct self-signed certificates use the
section for options. To setup the correct self\-signed certificates use the
\fIunbound\-control\-setup\fR(8) utility.
.TP 5
.B control\-enable: \fI<yes or no>
@@ -792,6 +853,8 @@ There may be multiple
.B stub\-zone:
clauses. Each with a name: and zero or more hostnames or IP addresses.
For the stub zone this list of nameservers is used. Class IN is assumed.
The servers should be authority servers, not recursors; unbound performs
the recursive processing itself for stub zones.
.P
The stub zone can be used to configure authoritative data to be used
by the resolver that cannot be accessed using the public internet servers.
@@ -830,11 +893,16 @@ the resolver picks up a correct list online.
.LP
There may be multiple
.B forward\-zone:
clauses. Each with a name: and zero or more hostnames or IP addresses.
For the forward zone this list of nameservers is used to forward the queries
to. The servers have to handle further recursion for the query. Class IN is
assumed. A forward\-zone entry with name "." and a forward\-addr target will
forward all queries to that other server (unless it can answer from the cache).
clauses. Each with a \fBname:\fR and zero or more hostnames or IP
addresses. For the forward zone this list of nameservers is used to
forward the queries to. The servers listed as \fBforward\-host:\fR and
\fBforward\-addr:\fR have to handle further recursion for the query. Thus,
those servers are not authority servers, but are (just like unbound is)
recursive servers too; unbound does not perform recursion itself for the
forward zone, it lets the remote server do it. Class IN is assumed.
A forward\-zone entry with name "." and a forward\-addr target will
forward all queries to that other server (unless it can answer from
the cache).
.TP
.B name: \fI<domain name>
Name of the forward zone.
@@ -864,7 +932,7 @@ supported. Very large data and high TCP loads are exceptional for the DNS.
DNSSEC validation is enabled, just add trust anchors.
If you do not have to worry about programs using more than 3 Mb of memory,
the below example is not for you. Use the defaults to receive full service,
which on BSD-32bit tops out at 30-40 Mb after heavy usage.
which on BSD\-32bit tops out at 30\-40 Mb after heavy usage.
.P
.nf
# example settings that reduce memory usage
+1
View File
@@ -499,6 +499,7 @@ EXCLUDE = ./build \
pythonmod/interface.h \
pythonmod/examples/resgen.py \
pythonmod/examples/resmod.py \
pythonmod/examples/resip.py \
libunbound/python/unbound.py \
libunbound/python/libunbound_wrap.c \
./ldns-src
+468 -200
View File
@@ -1,251 +1,519 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
scriptversion=2006-12-25.00
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright 1991 by the Massachusetts Institute of Technology
# Copyright (C) 1994 X Consortium
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
true
doit_exec=$doit
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
posix_mkdir=
pathcomp=''
# Desired mode of installed file.
mode=0755
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
src=
dst=
dir_arg=
dst_arg=
pathcomp="${pathcomp}/"
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# If we're going to rename the final executable, determine the name now.
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
mkdir_mode=
fi
# don't allow the sed command to completely eliminate the filename
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
true
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
# Make a temp file name in the proper directory.
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
dsttmp=$dstdir/#inst.$$#
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Move or copy the file name to the temp name
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
$doit $instcmd $src $dsttmp &&
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap "rm -f ${dsttmp}" 0 &&
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
# Now rename the file to the real destination.
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
fi &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
+17 -12
View File
@@ -68,6 +68,7 @@ struct delegpt* delegpt_copy(struct delegpt* dp, struct regional* region)
return NULL;
if(!delegpt_set_name(copy, region, dp->name))
return NULL;
copy->bogus = dp->bogus;
for(ns = dp->nslist; ns; ns = ns->next) {
if(!delegpt_add_ns(copy, region, ns->name))
return NULL;
@@ -77,7 +78,7 @@ struct delegpt* delegpt_copy(struct delegpt* dp, struct regional* region)
}
for(a = dp->target_list; a; a = a->next_target) {
if(!delegpt_add_addr(copy, region, &a->addr, a->addrlen,
a->bogus, 0))
a->bogus, a->lame, 0))
return NULL;
}
return copy;
@@ -146,7 +147,7 @@ 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 nodup)
socklen_t addrlen, int bogus, int lame, int nodup)
{
struct delegpt_ns* ns = delegpt_find_ns(dp, name, namelen);
if(!ns) {
@@ -158,18 +159,21 @@ delegpt_add_target(struct delegpt* dp, struct regional* region,
else ns->got4 = 1;
if(ns->got4 && ns->got6)
ns->resolved = 1;
return delegpt_add_addr(dp, region, addr, addrlen, bogus, nodup);
return delegpt_add_addr(dp, region, addr, addrlen, bogus, lame, nodup);
}
int
delegpt_add_addr(struct delegpt* dp, struct regional* region,
struct sockaddr_storage* addr, socklen_t addrlen, int bogus, int nodup)
struct sockaddr_storage* addr, socklen_t addrlen, int bogus,
int lame, int nodup)
{
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;
}
}
@@ -187,6 +191,7 @@ delegpt_add_addr(struct delegpt* dp, struct regional* region,
a->addrlen = addrlen;
a->attempts = 0;
a->bogus = bogus;
a->lame = lame;
return 1;
}
@@ -331,10 +336,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))
if(!delegpt_add_rrset_A(dp, region, s, 0, 0))
return NULL;
} else if(ntohs(s->rk.type) == LDNS_RR_TYPE_AAAA) {
if(!delegpt_add_rrset_AAAA(dp, region, s, 0))
if(!delegpt_add_rrset_AAAA(dp, region, s, 0, 0))
return NULL;
}
}
@@ -364,7 +369,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 nodup)
struct ub_packed_rrset_key* ak, int lame, int nodup)
{
struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data;
size_t i;
@@ -379,7 +384,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), nodup))
len, (d->security==sec_status_bogus), lame, nodup))
return 0;
}
return 1;
@@ -387,7 +392,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 nodup)
struct ub_packed_rrset_key* ak, int lame, int nodup)
{
struct packed_rrset_data* d=(struct packed_rrset_data*)ak->entry.data;
size_t i;
@@ -402,7 +407,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), nodup))
len, (d->security==sec_status_bogus), lame, nodup))
return 0;
}
return 1;
@@ -417,9 +422,9 @@ delegpt_add_rrset(struct delegpt* dp, struct regional* region,
if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_NS)
return delegpt_rrset_add_ns(dp, region, rrset);
else if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_A)
return delegpt_add_rrset_A(dp, region, rrset, 0);
return delegpt_add_rrset_A(dp, region, rrset, 0, 1);
else if(ntohs(rrset->rk.type) == LDNS_RR_TYPE_AAAA)
return delegpt_add_rrset_AAAA(dp, region, rrset, 0);
return delegpt_add_rrset_AAAA(dp, region, rrset, 0, 1);
log_warn("Unknown rrset type added to delegpt");
return 1;
}
+11 -4
View File
@@ -121,6 +121,8 @@ struct delegpt_addr {
/** if true, the A or AAAA RR was bogus, so this address is bad.
* Also check the dp->bogus to see if everything is bogus. */
int bogus;
/** if true, this address is dispreferred: it is a lame IP address */
int lame;
};
/**
@@ -178,35 +180,38 @@ int delegpt_rrset_add_ns(struct delegpt* dp, struct regional* regional,
* @param addr: the address.
* @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 nodup);
socklen_t addrlen, int bogus, int lame, int nodup);
/**
* Add A RRset to delegpt.
* @param dp: delegation point.
* @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 nodup);
struct ub_packed_rrset_key* rrset, int lame, int nodup);
/**
* Add AAAA RRset to delegpt.
* @param dp: delegation point.
* @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 nodup);
struct ub_packed_rrset_key* rrset, int lame, int nodup);
/**
* Add any RRset to delegpt.
@@ -226,11 +231,13 @@ int delegpt_add_rrset(struct delegpt* dp, struct regional* regional,
* @param addr: the address.
* @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 nodup);
struct sockaddr_storage* addr, socklen_t addrlen, int bogus,
int lame, int nodup);
/**
* Find NS record in name list of delegation point.
+125 -6
View File
@@ -88,9 +88,10 @@ forwards_delete(struct iter_forwards* fwd)
free(fwd);
}
/** insert new info into forward structure */
/** insert info into forward structure */
static int
forwards_insert(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
forwards_insert_data(struct iter_forwards* fwd, uint16_t c, uint8_t* nm,
size_t nmlen, int nmlabs, struct delegpt* dp)
{
struct iter_forward_zone* node = regional_alloc(fwd->region,
sizeof(struct iter_forward_zone));
@@ -98,11 +99,11 @@ forwards_insert(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
return 0;
node->node.key = node;
node->dclass = c;
node->name = regional_alloc_init(fwd->region, dp->name, dp->namelen);
node->name = regional_alloc_init(fwd->region, nm, nmlen);
if(!node->name)
return 0;
node->namelen = dp->namelen;
node->namelabs = dp->namelabs;
node->namelen = nmlen;
node->namelabs = nmlabs;
node->dp = dp;
if(!rbtree_insert(fwd->tree, &node->node)) {
log_err("duplicate forward zone ignored.");
@@ -110,6 +111,14 @@ forwards_insert(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
return 1;
}
/** insert new info into forward structure given dp */
static int
forwards_insert(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
{
return forwards_insert_data(fwd, c, dp->name, dp->namelen,
dp->namelabs, dp);
}
/** initialise parent pointers in the tree */
static void
fwd_init_parents(struct iter_forwards* fwd)
@@ -203,7 +212,8 @@ 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, 1)) {
if(!delegpt_add_addr(dp, fwd->region, &addr, addrlen,
0, 0, 1)) {
log_err("out of memory");
return 0;
}
@@ -234,6 +244,56 @@ read_forwards(struct iter_forwards* fwd, struct config_file* cfg)
return 1;
}
/** see if zone needs to have a hole inserted */
static int
need_hole_insert(rbtree_t* tree, struct iter_forward_zone* zone)
{
struct iter_forward_zone k;
if(rbtree_search(tree, zone))
return 0; /* exact match exists */
k = *zone;
k.node.key = &k;
/* search up the tree */
do {
dname_remove_label(&k.name, &k.namelen);
k.namelabs --;
if(rbtree_search(tree, &k))
return 1; /* found an upper forward zone, need hole */
} while(k.namelabs > 1);
return 0; /* no forwards above, no holes needed */
}
/** make NULL entries for stubs */
static int
make_stub_holes(struct iter_forwards* fwd, struct config_file* cfg)
{
struct config_stub* s;
struct iter_forward_zone key;
key.node.key = &key;
key.dclass = LDNS_RR_CLASS_IN;
for(s = cfg->stubs; s; s = s->next) {
ldns_rdf* rdf = ldns_dname_new_frm_str(s->name);
if(!rdf) {
log_err("cannot parse stub name '%s'", s->name);
return 0;
}
key.name = ldns_rdf_data(rdf);
key.namelabs = dname_count_size_labels(key.name, &key.namelen);
if(!need_hole_insert(fwd->tree, &key)) {
ldns_rdf_deep_free(rdf);
continue;
}
if(!forwards_insert_data(fwd, key.dclass, key.name,
key.namelen, key.namelabs, NULL)) {
ldns_rdf_deep_free(rdf);
log_err("out of memory");
return 0;
}
ldns_rdf_deep_free(rdf);
}
return 1;
}
int
forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg)
{
@@ -246,6 +306,8 @@ forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg)
/* read forward zones */
if(!read_forwards(fwd, cfg))
return 0;
if(!make_stub_holes(fwd, cfg))
return 0;
fwd_init_parents(fwd);
return 1;
}
@@ -284,6 +346,63 @@ forwards_lookup(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
return NULL;
}
struct delegpt*
forwards_lookup_root(struct iter_forwards* fwd, uint16_t qclass)
{
uint8_t root = 0;
return forwards_lookup(fwd, &root, qclass);
}
int
forwards_next_root(struct iter_forwards* fwd, uint16_t* dclass)
{
struct iter_forward_zone key;
rbnode_t* n;
struct iter_forward_zone* p;
if(*dclass == 0) {
/* first root item is first item in tree */
n = rbtree_first(fwd->tree);
if(n == RBTREE_NULL)
return 0;
p = (struct iter_forward_zone*)n;
if(dname_is_root(p->name)) {
*dclass = p->dclass;
return 1;
}
/* root not first item? search for higher items */
*dclass = p->dclass + 1;
return forwards_next_root(fwd, dclass);
}
/* find class n in tree, we may get a direct hit, or if we don't
* this is the last item of the previous class so rbtree_next() takes
* us to the next root (if any) */
key.node.key = &key;
key.name = (uint8_t*)"\000";
key.namelen = 1;
key.namelabs = 0;
key.dclass = *dclass;
n = NULL;
if(rbtree_find_less_equal(fwd->tree, &key, &n)) {
/* exact */
return 1;
} else {
/* smaller element */
if(!n || n == RBTREE_NULL)
return 0; /* nothing found */
n = rbtree_next(n);
if(n == RBTREE_NULL)
return 0; /* no higher */
p = (struct iter_forward_zone*)n;
if(dname_is_root(p->name)) {
*dclass = p->dclass;
return 1;
}
/* not a root node, return next higher item */
*dclass = p->dclass+1;
return forwards_next_root(fwd, dclass);
}
}
size_t
forwards_get_mem(struct iter_forwards* fwd)
{
+21 -2
View File
@@ -55,7 +55,7 @@ struct iter_forwards {
struct regional* region;
/**
* Zones are stored in this tree. Sort order is specially chosen.
* first sorted on qtype. Then on dname in nsec-like order, so that
* first sorted on qclass. Then on dname in nsec-like order, so that
* a lookup on class, name will return an exact match or the closest
* match which gives the ancestor needed.
* contents of type iter_forward_zone.
@@ -75,7 +75,9 @@ struct iter_forward_zone {
size_t namelen;
/** number of labels in name */
int namelabs;
/** delegation point with forward server information for this zone. */
/** delegation point with forward server information for this zone.
* If NULL then this forward entry is used to indicate that a
* stub-zone with the same name exists, and should be used. */
struct delegpt* dp;
/** pointer to parent in tree (or NULL if none) */
struct iter_forward_zone* parent;
@@ -117,6 +119,23 @@ int forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg);
struct delegpt* forwards_lookup(struct iter_forwards* fwd,
uint8_t* qname, uint16_t qclass);
/**
* Same as forwards_lookup, but for the root only
* @param fwd: forward storage.
* @param qclass: The qclass of the query.
* @return: A delegation point if root forward exists, otherwise null.
*/
struct delegpt* forwards_lookup_root(struct iter_forwards* fwd,
uint16_t qclass);
/**
* Find next root item in forwards lookup tree.
* @param fwd: the forward storage
* @param qclass: class to look at next, or higher.
* @return false if none found, or if true stored in qclass.
*/
int forwards_next_root(struct iter_forwards* fwd, uint16_t* qclass);
/**
* Get memory in use by forward storage
* @param fwd: forward storage.
+10 -4
View File
@@ -86,7 +86,7 @@ ah(struct delegpt* dp, struct regional* r, const char* sv, const char* ip)
if(!delegpt_add_ns(dp, r, ldns_rdf_data(rdf)) ||
!extstrtoaddr(ip, &addr, &addrlen) ||
!delegpt_add_target(dp, r, ldns_rdf_data(rdf), ldns_rdf_size(rdf),
&addr, addrlen, 0, 1)) {
&addr, addrlen, 0, 0, 1)) {
ldns_rdf_deep_free(rdf);
return 0;
}
@@ -225,7 +225,8 @@ 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, 1)) {
if(!delegpt_add_addr(dp, hints->region, &addr, addrlen,
0, 0, 1)) {
log_err("out of memory");
return 0;
}
@@ -318,7 +319,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, 1)) {
0, 0, 1)) {
log_err("out of memory reading root hints");
goto stop_read;
}
@@ -334,7 +335,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, 1)) {
0, 0, 1)) {
log_err("out of memory reading root hints");
goto stop_read;
}
@@ -461,6 +462,11 @@ hints_lookup_stub(struct iter_hints* hints, uint8_t* qname,
return NULL;
}
int hints_next_root(struct iter_hints* hints, uint16_t* qclass)
{
return name_tree_next_root(&hints->tree, qclass);
}
size_t
hints_get_mem(struct iter_hints* hints)
{
+13 -1
View File
@@ -56,7 +56,7 @@ struct iter_hints {
struct regional* region;
/**
* Hints are stored in this tree. Sort order is specially chosen.
* first sorted on qtype. Then on dname in nsec-like order, so that
* first sorted on qclass. Then on dname in nsec-like order, so that
* a lookup on class, name will return an exact match or the closest
* match which gives the ancestor needed.
* contents of type iter_hints_stub. The class IN root is in here.
@@ -105,6 +105,18 @@ int hints_apply_cfg(struct iter_hints* hints, struct config_file* cfg);
*/
struct delegpt* hints_lookup_root(struct iter_hints* hints, uint16_t qclass);
/**
* Find next root hints (to cycle through all root hints).
* @param hints: hint storage
* @param qclass: class for which root hints are sought.
* 0 means give the first available root hints class.
* x means, give class x or a higher class if any.
* returns the found class in this variable.
* @return true if a root hint class is found.
* false if not root hint class is found (qclass may have been changed).
*/
int hints_next_root(struct iter_hints* hints, uint16_t* qclass);
/**
* Given a qname/qclass combination, and the delegation point from the cache
* for this qname/qclass, determine if this combination indicates that a
+21 -14
View File
@@ -210,43 +210,50 @@ size_t priv_get_mem(struct iter_priv* priv)
int priv_rrset_bad(struct iter_priv* priv, ldns_buffer* pkt,
struct rrset_parse* rrset)
{
if(priv->a.count == 0)
return 0; /* there are no blocked addresses */
/* see if it is a private name, that is allowed to have any */
if(priv_lookup_name(priv, pkt, rrset->dname, rrset->dname_len,
ntohs(rrset->rrset_class))) {
return 0;
} else {
/* so its a public name, check the address */
struct sockaddr_storage addr;
socklen_t len;
struct rr_parse* rr;
if(rrset->type == LDNS_RR_TYPE_A) {
struct sockaddr_in* sa = (struct sockaddr_in*)&addr;
len = (socklen_t)sizeof(*sa);
memset(sa, 0, len);
sa->sin_family = AF_INET;
sa->sin_port = (in_port_t)htons(UNBOUND_DNS_PORT);
struct sockaddr_storage addr;
struct sockaddr_in sa;
len = (socklen_t)sizeof(sa);
memset(&sa, 0, len);
sa.sin_family = AF_INET;
sa.sin_port = (in_port_t)htons(UNBOUND_DNS_PORT);
for(rr = rrset->rr_first; rr; rr = rr->next) {
if(ldns_read_uint16(rr->ttl_data+4)
!= INET_SIZE)
continue;
memmove(&sa->sin_addr, rr->ttl_data+4+2,
memmove(&sa.sin_addr, rr->ttl_data+4+2,
INET_SIZE);
memmove(&addr, &sa, len);
if(priv_lookup_addr(priv, &addr, len))
return 1;
}
} else if(rrset->type == LDNS_RR_TYPE_AAAA) {
struct sockaddr_in6* sa = (struct sockaddr_in6*)&addr;
len = (socklen_t)sizeof(*sa);
memset(sa, 0, len);
sa->sin6_family = AF_INET6;
sa->sin6_port = (in_port_t)htons(UNBOUND_DNS_PORT);
struct sockaddr_storage addr;
struct sockaddr_in6 sa;
len = (socklen_t)sizeof(sa);
memset(&sa, 0, len);
sa.sin6_family = AF_INET6;
sa.sin6_port = (in_port_t)htons(UNBOUND_DNS_PORT);
for(rr = rrset->rr_first; rr; rr = rr->next) {
if(ldns_read_uint16(rr->ttl_data+4)
!= INET6_SIZE)
continue;
memmove(&sa->sin6_addr, rr->ttl_data+4+2,
memmove(&sa.sin6_addr, rr->ttl_data+4+2,
INET6_SIZE);
if(priv_lookup_addr(priv, &addr, len))
memmove(&addr, &sa, len);
if(priv_lookup_addr(priv, &addr, len))
return 1;
}
}
+163 -15
View File
@@ -61,6 +61,11 @@
#include "util/fptr_wlist.h"
#include "validator/val_anchor.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)
/** fillup fetch policy array */
static void
fetch_fill(struct iter_env* ie, const char* str)
@@ -151,13 +156,17 @@ iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg)
* values 0 .. 49 are not used, unless that is changed.
* USEFUL_SERVER_TOP_TIMEOUT
* 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*2 ..
* 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.
*
* When a final value is chosen that is dnsseclame ; dnsseclameness checking
* is turned off (so we do not discard the reply).
@@ -170,7 +179,7 @@ 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;
int rtt, lame, reclame, dnsseclame, lost;
if(a->bogus)
return -1; /* address of server is bogus */
if(donotq_lookup(iter_env->donotq, &a->addr, a->addrlen)) {
@@ -182,7 +191,7 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
/* 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, now)) {
&rtt, &lost, now)) {
log_addr(VERB_ALGO, "servselect", &a->addr, a->addrlen);
verbose(VERB_ALGO, " rtt=%d%s%s%s", rtt,
lame?" LAME":"",
@@ -190,9 +199,14 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
reclame?" REC_LAME":"");
if(lame)
return -1; /* server is lame */
else if(rtt >= USEFUL_SERVER_TOP_TIMEOUT)
else if(rtt >= USEFUL_SERVER_TOP_TIMEOUT &&
lost >= USEFUL_SERVER_MAX_LOST)
/* server is unresponsive */
return USEFUL_SERVER_TOP_TIMEOUT;
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 )
@@ -200,6 +214,8 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
else return rtt;
}
/* no server information present */
if(a->lame)
return USEFUL_SERVER_TOP_TIMEOUT+1; /* nonpref */
return UNKNOWN_SERVER_NICENESS;
}
@@ -207,7 +223,7 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
static int
iter_fill_rtt(struct iter_env* iter_env, struct module_env* env,
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
struct delegpt* dp, int* best_rtt)
struct delegpt* dp, int* best_rtt, struct sock_list* blacklist)
{
int got_it = 0;
struct delegpt_addr* a;
@@ -217,6 +233,9 @@ iter_fill_rtt(struct iter_env* iter_env, struct module_env* env,
a->sel_rtt = iter_filter_unsuitable(iter_env, env,
name, namelen, qtype, now, a);
if(a->sel_rtt != -1) {
if(sock_list_find(blacklist, &a->addr, a->addrlen))
a->sel_rtt += BLACKLIST_PENALTY;
if(!got_it) {
*best_rtt = a->sel_rtt;
got_it = 1;
@@ -233,20 +252,23 @@ iter_fill_rtt(struct iter_env* iter_env, struct module_env* env,
static int
iter_filter_order(struct iter_env* iter_env, struct module_env* env,
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
struct delegpt* dp, int* selected_rtt)
struct delegpt* dp, int* selected_rtt, int open_target,
struct sock_list* blacklist)
{
int got_num = 0, low_rtt = 0, swap_to_front;
struct delegpt_addr* a, *n, *prev=NULL;
/* fillup sel_rtt and find best rtt in the bunch */
got_num = iter_fill_rtt(iter_env, env, name, namelen, qtype, now, dp,
&low_rtt);
&low_rtt, blacklist);
if(got_num == 0)
return 0;
if(low_rtt >= USEFUL_SERVER_TOP_TIMEOUT &&
delegpt_count_missing_targets(dp) > 0)
(delegpt_count_missing_targets(dp) > 0 || open_target > 0)) {
verbose(VERB_ALGO, "Bad choices, trying to get more choice");
return 0; /* we want more choice. The best choice is a bad one.
return 0 to force the caller to fetch more */
}
got_num = 0;
a = dp->result_list;
@@ -286,13 +308,13 @@ 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,
int* chase_to_rd)
int* chase_to_rd, int open_target, struct sock_list* blacklist)
{
int sel;
int selrtt;
struct delegpt_addr* a, *prev;
int num = iter_filter_order(iter_env, env, name, namelen, qtype,
*env->now, dp, &selrtt);
*env->now, dp, &selrtt, open_target, blacklist);
if(num == 0)
return NULL;
@@ -397,6 +419,54 @@ iter_ns_probability(struct ub_randstate* rnd, int n, int 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,
@@ -441,19 +511,19 @@ iter_dp_is_useless(struct query_info* qinfo, uint16_t qflags,
{
struct delegpt_ns* ns;
/* check:
* o RD qflag is off.
* o no addresses are provided.
* o all NS items are required glue.
* o no addresses are provided.
* o RD qflag is on.
* OR
* o RD qflag is off.
* o no addresses are provided.
* o RD qflag is on.
* o the query is for one of the nameservers in dp,
* and that nameserver is a glue-name for this dp.
*/
if(!(qflags&BIT_RD))
return 0;
/* either available or unused targets */
if(dp->usable_list || dp->result_list)
if(dp->usable_list || dp->result_list)
return 0;
/* see if query is for one of the nameservers, which is glue */
@@ -476,13 +546,16 @@ int
iter_indicates_dnssec(struct module_env* env, struct delegpt* dp,
struct dns_msg* msg, uint16_t dclass)
{
struct trust_anchor* a;
/* information not available, !env->anchors can be common */
if(!env || !env->anchors || !dp || !dp->name)
return 0;
/* a trust anchor exists with this name, RRSIGs expected */
if(anchor_find(env->anchors, dp->name, dp->namelabs, dp->namelen,
dclass))
if((a=anchor_find(env->anchors, dp->name, dp->namelabs, dp->namelen,
dclass))) {
lock_basic_unlock(&a->lock);
return 1;
}
/* see if DS rrset was given, in AUTH section */
if(msg && msg->rep &&
reply_find_rrset_section_ns(msg->rep, dp->name, dp->namelen,
@@ -546,6 +619,11 @@ int iter_msg_from_zone(struct dns_msg* msg, struct delegpt* dp,
reply_find_rrset_section_ns(msg->rep, dp->name, dp->namelen,
LDNS_RR_TYPE_NS, dclass))
return 1;
/* a DNSKEY set is expected at the zone apex as well */
/* this is for 'minimal responses' for DNSKEYs */
if(reply_find_rrset_section_an(msg->rep, dp->name, dp->namelen,
LDNS_RR_TYPE_DNSKEY, dclass))
return 1;
return 0;
}
@@ -605,3 +683,73 @@ reply_equal(struct reply_info* p, struct reply_info* q)
}
return 1;
}
void
iter_store_inzone_glue(struct module_env* env, struct query_info* qinfo,
struct reply_info* rep)
{
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");
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 */
(void)rrset_cache_update(env->rrset_cache, &ref, env->alloc, *env->now);
}
int
iter_lookup_inzone_glue(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,
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;
}
}
lock_rw_unlock(&akey->entry.lock);
}
return 1;
}
int
iter_get_next_root(struct iter_hints* hints, struct iter_forwards* fwd,
uint16_t* c)
{
uint16_t c1 = *c, c2 = *c;
int r1 = hints_next_root(hints, &c1);
int r2 = forwards_next_root(fwd, &c2);
if(!r1 && !r2) /* got none, end of list */
return 0;
else if(!r1) /* got one, return that */
*c = c2;
else if(!r2)
*c = c1;
else if(c1 < c2) /* got both take smallest */
*c = c1;
else *c = c2;
return 1;
}
+52 -1
View File
@@ -44,6 +44,8 @@
#define ITERATOR_ITER_UTILS_H
#include "iterator/iter_resptype.h"
struct iter_env;
struct iter_hints;
struct iter_forwards;
struct config_file;
struct module_env;
struct delegpt_addr;
@@ -54,6 +56,7 @@ struct ub_randstate;
struct query_info;
struct reply_info;
struct module_qstate;
struct sock_list;
/**
* Process config options and set iterator module state.
@@ -79,13 +82,16 @@ int iter_apply_cfg(struct iter_env* iter_env, struct config_file* cfg);
* 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.
* @param open_target: number of currently outstanding target queries.
* If we wait for these, perhaps more server addresses become available.
* @param blacklist: the IP blacklist to use.
* @return best target or NULL if no target.
* if not null, that target is removed from the result list in the dp.
*/
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,
int* chase_to_rd);
int* chase_to_rd, int open_target, struct sock_list* blacklist);
/**
* Allocate dns_msg from parsed msg, in regional.
@@ -135,6 +141,19 @@ 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.
*/
int iter_suspect_exists(struct query_info* qinfo, struct delegpt* dp,
struct module_env* env);
/**
* See if delegation is useful or offers immediately no targets for
* further recursion.
@@ -193,4 +212,36 @@ int iter_msg_from_zone(struct dns_msg* msg, struct delegpt* dp,
*/
int reply_equal(struct reply_info* p, struct reply_info* q);
/**
* Store in-zone glue 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.
*/
void iter_store_inzone_glue(struct module_env* env, struct query_info* qinfo,
struct reply_info* rep);
/**
* 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.
*/
int iter_lookup_inzone_glue(struct module_env* env, struct delegpt* dp,
struct regional* region, struct query_info* qinfo);
/**
* Lookup next root-hint or root-forward entry.
* @param hints: the hints.
* @param fwd: the forwards.
* @param c: the class to start searching at. 0 means find first one.
* @return false if no classes found, true if found and returned in c.
*/
int iter_get_next_root(struct iter_hints* hints, struct iter_forwards* fwd,
uint16_t* c);
#endif /* ITERATOR_ITER_UTILS_H */
+282 -31
View File
@@ -592,21 +592,27 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq,
* @param iq: iterator query state.
* @param ie: iterator global state.
* @param id: module id.
* @param qname: request name.
* @param qclass: the class to prime.
* @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.
*/
static int
prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
struct iter_env* ie, int id, uint8_t* qname, uint16_t qclass)
struct iter_env* ie, int id, struct query_info* q)
{
/* Lookup the stub hint. This will return null if the stub doesn't
* need to be re-primed. */
struct iter_hints_stub* stub = hints_lookup_stub(ie->hints,
qname, qclass, iq->dp);
struct iter_hints_stub* stub;
struct delegpt* stub_dp;
struct module_qstate* subq;
uint8_t* delname = q->qname;
size_t delnamelen = q->qname_len;
if(q->qtype == LDNS_RR_TYPE_DS && !dname_is_root(q->qname))
/* remove first label, but not for root */
dname_remove_label(&delname, &delnamelen);
stub = hints_lookup_stub(ie->hints, delname, q->qclass, iq->dp);
/* The stub (if there is one) does not need priming. */
if(!stub)
return 0;
@@ -623,18 +629,18 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq,
return 1; /* return 1 to make module stop, with error */
}
log_nametypeclass(VERB_DETAIL, "use stub", stub_dp->name,
LDNS_RR_TYPE_NS, qclass);
LDNS_RR_TYPE_NS, q->qclass);
return 0;
}
/* Otherwise, we need to (re)prime the stub. */
log_nametypeclass(VERB_DETAIL, "priming stub", stub_dp->name,
LDNS_RR_TYPE_NS, qclass);
LDNS_RR_TYPE_NS, q->qclass);
/* Stub priming events start at the QUERYTARGETS state to avoid the
* redundant INIT state processing. */
if(!generate_sub_request(stub_dp->name, stub_dp->namelen,
LDNS_RR_TYPE_NS, qclass, qstate, id, iq,
LDNS_RR_TYPE_NS, q->qclass, qstate, id, iq,
QUERYTARGETS_STATE, PRIME_RESP_STATE, &subq, 0)) {
verbose(VERB_ALGO, "could not prime stub");
(void)error_response(qstate, id, LDNS_RCODE_SERVFAIL);
@@ -781,8 +787,14 @@ generate_ns_check(struct module_qstate* qstate, struct iter_qstate* iq, int id)
static int
forward_request(struct module_qstate* qstate, struct iter_qstate* iq)
{
struct delegpt* dp = forwards_lookup(qstate->env->fwds,
iq->qchase.qname, iq->qchase.qclass);
struct delegpt* dp;
uint8_t* delname = iq->qchase.qname;
size_t delnamelen = iq->qchase.qname_len;
/* strip one label off of DS query to lookup higher for it */
if(iq->qchase.qtype == LDNS_RR_TYPE_DS
&& !dname_is_root(iq->qchase.qname))
dname_remove_label(&delname, &delnamelen);
dp = forwards_lookup(qstate->env->fwds, delname, iq->qchase.qclass);
if(!dp)
return 0;
/* send recursion desired to forward addr */
@@ -841,20 +853,34 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
}
/* If the request is qclass=ANY, setup to generate each class */
if(qstate->qinfo.qclass == LDNS_RR_CLASS_ANY) {
iq->qchase.qclass = 0;
return next_state(iq, COLLECT_CLASS_STATE);
}
/* Resolver Algorithm Step 1 -- Look for the answer in local data. */
/* This either results in a query restart (CNAME cache response), a
* terminating response (ANSWER), or a cache miss (null). */
msg = dns_cache_lookup(qstate->env, iq->qchase.qname,
iq->qchase.qname_len, iq->qchase.qtype,
iq->qchase.qclass, qstate->region, qstate->env->scratch);
if(!msg && qstate->env->neg_cache) {
/* lookup in negative cache; may result in
* NOERROR/NODATA or NXDOMAIN answers that need validation */
msg = val_neg_getmsg(qstate->env->neg_cache, &iq->qchase,
qstate->region, qstate->env->rrset_cache,
qstate->env->scratch_buffer, *qstate->env->now);
if(qstate->blacklist) {
/* if cache, or anything else, was blacklisted then
* getting older results from cache is a bad idea, no cache */
verbose(VERB_ALGO, "cache blacklisted, going to the network");
msg = NULL;
} else {
msg = dns_cache_lookup(qstate->env, iq->qchase.qname,
iq->qchase.qname_len, iq->qchase.qtype,
iq->qchase.qclass, qstate->region, qstate->env->scratch);
if(!msg && qstate->env->neg_cache) {
/* lookup in negative cache; may result in
* NOERROR/NODATA or NXDOMAIN answers that need validation */
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*/);
}
}
if(msg) {
/* handle positive cache response */
@@ -882,9 +908,13 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
iq->dp = NULL;
iq->refetch_glue = 0;
iq->query_restart_count++;
sock_list_insert(&qstate->reply_origin, NULL, 0, qstate->region);
return next_state(iq, INIT_REQUEST_STATE);
}
/* if from cache, NULL, else insert 'cache IP' len=0 */
if(qstate->reply_origin)
sock_list_insert(&qstate->reply_origin, NULL, 0, qstate->region);
/* it is an answer, response, to final state */
verbose(VERB_ALGO, "returning answer from cache.");
iq->response = msg;
@@ -922,23 +952,47 @@ 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)
&& !dname_is_root(delname)) {
/* do not adjust root label, remove first label from delname */
dname_remove_label(&delname, &delnamelen);
if(iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue) {
/* 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)
delname = NULL; /* go to root priming */
else dname_remove_label(&delname, &delnamelen);
iq->refetch_glue = 0; /* if CNAME causes restart, no refetch */
}
/* delname is the name to lookup a delegation for. If NULL rootprime */
while(1) {
/* Lookup the delegation in the cache. If null, then the
* cache needs to be primed for the qclass. */
iq->dp = dns_cache_find_delegation(qstate->env, delname,
if(delname)
iq->dp = dns_cache_find_delegation(qstate->env, delname,
delnamelen, iq->qchase.qtype, iq->qchase.qclass,
qstate->region, &iq->deleg_msg, *qstate->env->now);
else iq->dp = NULL;
/* If the cache has returned nothing, then we have a
* root priming situation. */
if(iq->dp == NULL) {
if(forwards_lookup_root(qstate->env->fwds,
iq->qchase.qclass)) {
/* forward zone root, no root prime needed */
/* fill in some dp - safety belt */
iq->dp = hints_lookup_root(ie->hints,
iq->qchase.qclass);
if(!iq->dp) {
log_err("internal error: no hints dp");
return error_response(qstate, id,
LDNS_RCODE_SERVFAIL);
}
iq->dp = delegpt_copy(iq->dp, qstate->region);
if(!iq->dp) {
log_err("out of memory in safety belt");
return error_response(qstate, id,
LDNS_RCODE_SERVFAIL);
}
return next_state(iq, INIT_REQUEST_2_STATE);
}
/* Note that the result of this will set a new
* DelegationPoint based on the result of priming. */
if(!prime_root(qstate, iq, ie, id, iq->qchase.qclass))
@@ -1030,8 +1084,7 @@ processInitRequest2(struct module_qstate* qstate, struct iter_qstate* iq,
&qstate->qinfo);
/* Check to see if we need to prime a stub zone. */
if(prime_stub(qstate, iq, ie, id, iq->qchase.qname,
iq->qchase.qclass)) {
if(prime_stub(qstate, iq, ie, id, &iq->qchase)) {
/* A priming sub request was made */
return 0;
}
@@ -1067,6 +1120,8 @@ processInitRequest3(struct module_qstate* qstate, struct iter_qstate* iq)
if(verbosity >= VERB_ALGO)
log_dns_msg("no RD requested, using delegation msg",
&iq->response->qinfo, iq->response->rep);
if(qstate->reply_origin)
sock_list_insert(&qstate->reply_origin, NULL, 0, qstate->region);
return final_state(iq);
}
@@ -1258,7 +1313,10 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
}
tf_policy = 0;
if(iq->depth <= ie->max_dependency_depth) {
/* < not <=, because although the array is large enough for <=, the
* generated query will immediately be discarded due to depth and
* that servfail is cached, which is not good as opportunism goes. */
if(iq->depth < ie->max_dependency_depth) {
tf_policy = ie->target_fetch_policy[iq->depth];
}
@@ -1312,7 +1370,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->dnssec_expected, &iq->chase_to_rd, iq->num_target_queries,
qstate->blacklist);
/* If no usable target was selected... */
if(!target) {
@@ -1343,6 +1402,17 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
/* 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
@@ -1370,6 +1440,7 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
}
/* 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);
@@ -1485,6 +1556,10 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
qstate->env->detach_subs));
(*qstate->env->detach_subs)(qstate);
iq->num_target_queries = 0;
if(qstate->reply)
sock_list_insert(&qstate->reply_origin,
&qstate->reply->addr, qstate->reply->addrlen,
qstate->region);
return final_state(iq);
} else if(type == RESPONSE_TYPE_REFERRAL) {
/* REFERRAL type responses get a reset of the
@@ -1499,9 +1574,14 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
/* we know that all other NS rrsets are scrubbed
* away, thus on referral only one is left.
* see if that equals the query name... */
&& reply_find_rrset_section_ns(iq->response->rep,
&& ( /* 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)
|| reply_find_rrset_section_an(iq->response->rep,
qstate->qinfo.qname, qstate->qinfo.qname_len,
LDNS_RR_TYPE_NS, qstate->qinfo.qclass)
)
)) {
/* Store the referral under the current query */
if(!iter_dns_store(qstate->env, &iq->response->qinfo,
@@ -1512,6 +1592,12 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
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);
}
/* Reset the event state, setting the current delegation
* point to the referral. */
@@ -1589,6 +1675,10 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
qstate->env->detach_subs));
(*qstate->env->detach_subs)(qstate);
iq->num_target_queries = 0;
if(qstate->reply)
sock_list_insert(&qstate->reply_origin,
&qstate->reply->addr, qstate->reply->addrlen,
qstate->region);
verbose(VERB_ALGO, "cleared outbound list for query restart");
/* go to INIT_REQUEST_STATE for new qname. */
return next_state(iq, INIT_REQUEST_STATE);
@@ -1771,8 +1861,10 @@ processTargetResponse(struct module_qstate* qstate, int id,
log_query_info(VERB_ALGO, "processTargetResponse super", &forq->qinfo);
/* check to see if parent event is still interested (in orig name). */
if(!foriq->dp)
if(!foriq->dp) {
verbose(VERB_ALGO, "subq: parent not interested, was reset");
return; /* not interested anymore */
}
dpns = delegpt_find_ns(foriq->dp, qstate->qinfo.qname,
qstate->qinfo.qname_len);
if(!dpns) {
@@ -1787,6 +1879,11 @@ 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");
/* This response is relevant to the current query, so we
* add (attempt to add, anyway) this target(s) and reactivate
* the original event.
@@ -1812,6 +1909,152 @@ processTargetResponse(struct module_qstate* qstate, int id,
}
}
/**
* Process response for qclass=ANY queries for a particular class.
* Append to result or error-exit.
*
* @param qstate: query state.
* @param id: module id.
* @param forq: super query state.
*/
static void
processClassResponse(struct module_qstate* qstate, int id,
struct module_qstate* forq)
{
struct iter_qstate* foriq = (struct iter_qstate*)forq->minfo[id];
struct dns_msg* from = qstate->return_msg;
log_query_info(VERB_ALGO, "processClassResponse", &qstate->qinfo);
log_query_info(VERB_ALGO, "processClassResponse super", &forq->qinfo);
if(qstate->return_rcode != LDNS_RCODE_NOERROR) {
/* cause servfail for qclass ANY query */
foriq->response = NULL;
foriq->state = FINISHED_STATE;
return;
}
/* append result */
if(!foriq->response) {
/* allocate the response: copy RCODE, sec_state */
foriq->response = dns_copy_msg(from, forq->region);
if(!foriq->response) {
log_err("malloc failed for qclass ANY response");
foriq->state = FINISHED_STATE;
return;
}
foriq->response->qinfo.qclass = forq->qinfo.qclass;
/* qclass ANY does not receive the AA flag on replies */
foriq->response->rep->authoritative = 0;
} else {
struct dns_msg* to = foriq->response;
/* add _from_ this response _to_ existing collection */
/* if there are records, copy RCODE */
/* lower sec_state if this message is lower */
if(from->rep->rrset_count != 0) {
size_t n = from->rep->rrset_count+to->rep->rrset_count;
struct ub_packed_rrset_key** dest, **d;
/* copy appropriate rcode */
to->rep->flags = from->rep->flags;
/* copy rrsets */
dest = regional_alloc(forq->region, sizeof(dest[0])*n);
if(!dest) {
log_err("malloc failed in collect ANY");
foriq->state = FINISHED_STATE;
return;
}
d = dest;
/* copy AN */
memcpy(dest, to->rep->rrsets, to->rep->an_numrrsets
* sizeof(dest[0]));
dest += to->rep->an_numrrsets;
memcpy(dest, from->rep->rrsets, from->rep->an_numrrsets
* sizeof(dest[0]));
dest += from->rep->an_numrrsets;
/* copy NS */
memcpy(dest, to->rep->rrsets+to->rep->an_numrrsets,
to->rep->ns_numrrsets * sizeof(dest[0]));
dest += to->rep->ns_numrrsets;
memcpy(dest, from->rep->rrsets+from->rep->an_numrrsets,
from->rep->ns_numrrsets * sizeof(dest[0]));
dest += from->rep->ns_numrrsets;
/* copy AR */
memcpy(dest, to->rep->rrsets+to->rep->an_numrrsets+
to->rep->ns_numrrsets,
to->rep->ar_numrrsets * sizeof(dest[0]));
dest += to->rep->ar_numrrsets;
memcpy(dest, from->rep->rrsets+from->rep->an_numrrsets+
from->rep->ns_numrrsets,
from->rep->ar_numrrsets * sizeof(dest[0]));
/* update counts */
to->rep->rrsets = d;
to->rep->an_numrrsets += from->rep->an_numrrsets;
to->rep->ns_numrrsets += from->rep->ns_numrrsets;
to->rep->ar_numrrsets += from->rep->ar_numrrsets;
to->rep->rrset_count = n;
}
if(from->rep->security < to->rep->security) /* lowest sec */
to->rep->security = from->rep->security;
if(from->rep->qdcount != 0) /* insert qd if appropriate */
to->rep->qdcount = from->rep->qdcount;
if(from->rep->ttl < to->rep->ttl) /* use smallest TTL */
to->rep->ttl = from->rep->ttl;
}
/* are we done? */
foriq->num_current_queries --;
if(foriq->num_current_queries == 0)
foriq->state = FINISHED_STATE;
}
/**
* Collect class ANY responses and make them into one response. This
* state is started and it creates queries for all classes (that have
* root hints). The answers are then collected.
*
* @param qstate: query state.
* @param id: module id.
* @return true if the event needs more immediate processing, false if not.
*/
static int
processCollectClass(struct module_qstate* qstate, int id)
{
struct iter_qstate* iq = (struct iter_qstate*)qstate->minfo[id];
struct iter_env* ie = (struct iter_env*)qstate->env->modinfo[id];
struct module_qstate* subq;
/* If qchase.qclass == 0 then send out queries for all classes.
* Otherwise, do nothing (wait for all answers to arrive and the
* processClassResponse to put them together, and that moves us
* towards the Finished state when done. */
if(iq->qchase.qclass == 0) {
uint16_t c = 0;
iq->qchase.qclass = LDNS_RR_CLASS_ANY;
while(iter_get_next_root(ie->hints, qstate->env->fwds, &c)) {
/* generate query for this class */
log_nametypeclass(VERB_ALGO, "spawn collect query",
qstate->qinfo.qname, qstate->qinfo.qtype, c);
if(!generate_sub_request(qstate->qinfo.qname,
qstate->qinfo.qname_len, qstate->qinfo.qtype,
c, qstate, id, iq, INIT_REQUEST_STATE,
FINISHED_STATE, &subq,
(int)!(qstate->query_flags&BIT_CD))) {
return error_response(qstate, id,
LDNS_RCODE_SERVFAIL);
}
/* ignore subq, no special init required */
iq->num_current_queries ++;
if(c == 0xffff)
break;
else c++;
}
/* if no roots are configured at all, return */
if(iq->num_current_queries == 0) {
verbose(VERB_ALGO, "No root hints or fwds, giving up "
"on qclass ANY");
return error_response(qstate, id, LDNS_RCODE_REFUSED);
}
/* return false, wait for queries to return */
}
/* if woke up here because of an answer, wait for more answers */
return 0;
}
/**
* This handles the final state for first-tier responses (i.e., responses to
* externally generated queries).
@@ -1888,7 +2131,9 @@ void
iter_inform_super(struct module_qstate* qstate, int id,
struct module_qstate* super)
{
if(qstate->return_rcode != LDNS_RCODE_NOERROR)
if(super->qinfo.qclass == LDNS_RR_CLASS_ANY)
processClassResponse(qstate, id, super);
else if(qstate->return_rcode != LDNS_RCODE_NOERROR)
error_supers(qstate, id, super);
else if(qstate->is_priming)
prime_supers(qstate, id, super);
@@ -1934,6 +2179,9 @@ iter_handle(struct module_qstate* qstate, struct iter_qstate* iq,
case PRIME_RESP_STATE:
cont = processPrimeResponse(qstate, id);
break;
case COLLECT_CLASS_STATE:
cont = processCollectClass(qstate, id);
break;
case FINISHED_STATE:
cont = processFinished(qstate, iq, id);
break;
@@ -2161,6 +2409,8 @@ iter_state_to_string(enum iter_state state)
return "QUERY TARGETS STATE";
case PRIME_RESP_STATE :
return "PRIME RESPONSE STATE";
case COLLECT_CLASS_STATE :
return "COLLECT CLASS STATE";
case QUERY_RESP_STATE :
return "QUERY RESPONSE STATE";
case FINISHED_STATE :
@@ -2178,6 +2428,7 @@ iter_state_is_responsestate(enum iter_state s)
case INIT_REQUEST_2_STATE :
case INIT_REQUEST_3_STATE :
case QUERYTARGETS_STATE :
case COLLECT_CLASS_STATE :
return 0;
default:
break;
+8
View File
@@ -65,6 +65,10 @@ struct iter_priv;
* Equals RTT_MAX_TIMEOUT
*/
#define USEFUL_SERVER_TOP_TIMEOUT 120000
/** Number of lost messages in a row that get a host blacklisted.
* With 16, a couple different queries have to time out and no working
* queries are happening */
#define USEFUL_SERVER_MAX_LOST 16
/** number of retries on outgoing queries */
#define OUTBOUND_MSG_RETRY 5
/** RTT band, within this amount from the best, servers are chosen randomly.
@@ -146,6 +150,10 @@ enum iter_state {
/** Responses to priming queries finish at this state. */
PRIME_RESP_STATE,
/** Collecting query class information, for qclass=ANY, when
* it spawns off queries for every class, it returns here. */
COLLECT_CLASS_STATE,
/** Responses that are to be returned upstream end at this state.
* As well as responses to target queries. */
FINISHED_STATE
BIN
View File
Binary file not shown.
+28 -6
View File
@@ -288,20 +288,27 @@ context_serialize_answer(struct ctx_query* q, int err, ldns_buffer* pkt,
* o uint32 id
* o uint32 error_code
* o uint32 msg_security
* o uint32 length of why_bogus string (+1 for eos); 0 absent.
* o why_bogus_string
* o the remainder is the answer msg from resolver lookup.
* remainder can be length 0.
*/
size_t pkt_len = pkt?ldns_buffer_remaining(pkt):0;
size_t wlen = (pkt&&q->res->why_bogus)?strlen(q->res->why_bogus)+1:0;
uint8_t* p;
*len = sizeof(uint32_t)*4 + pkt_len;
*len = sizeof(uint32_t)*5 + pkt_len + wlen;
p = (uint8_t*)malloc(*len);
if(!p) return NULL;
ldns_write_uint32(p, UB_LIBCMD_ANSWER);
ldns_write_uint32(p+sizeof(uint32_t), (uint32_t)q->querynum);
ldns_write_uint32(p+2*sizeof(uint32_t), (uint32_t)err);
ldns_write_uint32(p+3*sizeof(uint32_t), (uint32_t)q->msg_security);
ldns_write_uint32(p+4*sizeof(uint32_t), (uint32_t)wlen);
if(wlen > 0)
memmove(p+5*sizeof(uint32_t), q->res->why_bogus, wlen);
if(pkt_len > 0)
memmove(p+4*sizeof(uint32_t), ldns_buffer_begin(pkt), pkt_len);
memmove(p+5*sizeof(uint32_t)+wlen,
ldns_buffer_begin(pkt), pkt_len);
return p;
}
@@ -311,16 +318,31 @@ context_deserialize_answer(struct ub_ctx* ctx,
{
struct ctx_query* q = NULL ;
int id;
if(len < 4*sizeof(uint32_t)) return NULL;
size_t wlen;
if(len < 5*sizeof(uint32_t)) return NULL;
log_assert( ldns_read_uint32(p) == UB_LIBCMD_ANSWER);
id = (int)ldns_read_uint32(p+sizeof(uint32_t));
q = (struct ctx_query*)rbtree_search(&ctx->queries, &id);
if(!q) return NULL;
*err = (int)ldns_read_uint32(p+2*sizeof(uint32_t));
q->msg_security = ldns_read_uint32(p+3*sizeof(uint32_t));
if(len > 4*sizeof(uint32_t)) {
q->msg_len = len - 4*sizeof(uint32_t);
q->msg = (uint8_t*)memdup(p+4*sizeof(uint32_t), q->msg_len);
wlen = (size_t)ldns_read_uint32(p+4*sizeof(uint32_t));
if(len > 5*sizeof(uint32_t) && wlen > 0) {
if(len >= 5*sizeof(uint32_t)+wlen)
q->res->why_bogus = (char*)memdup(
p+5*sizeof(uint32_t), wlen);
if(!q->res->why_bogus) {
/* pass malloc failure to the user callback */
q->msg_len = 0;
*err = UB_NOMEM;
return q;
}
q->res->why_bogus[wlen-1] = 0; /* zero terminated for sure */
}
if(len > 5*sizeof(uint32_t)+wlen) {
q->msg_len = len - 5*sizeof(uint32_t) - wlen;
q->msg = (uint8_t*)memdup(p+5*sizeof(uint32_t)+wlen,
q->msg_len);
if(!q->msg) {
/* pass malloc failure to the user callback */
q->msg_len = 0;
+73 -2
View File
@@ -60,6 +60,11 @@
#include "services/cache/infra.h"
#include "services/cache/rrset.h"
#if defined(UB_ON_WINDOWS) && defined (HAVE_WINDOWS_H)
#include <windows.h>
#include <iphlpapi.h>
#endif /* UB_ON_WINDOWS */
struct ub_ctx*
ub_ctx_create()
{
@@ -262,6 +267,7 @@ ub_ctx_add_ta(struct ub_ctx* ctx, char* ta)
lock_basic_lock(&ctx->cfglock);
if(ctx->finalized) {
lock_basic_unlock(&ctx->cfglock);
free(dup);
return UB_AFTERFINAL;
}
if(!cfg_strlist_insert(&ctx->env->cfg->trust_anchor_list, dup)) {
@@ -281,6 +287,7 @@ ub_ctx_add_ta_file(struct ub_ctx* ctx, char* fname)
lock_basic_lock(&ctx->cfglock);
if(ctx->finalized) {
lock_basic_unlock(&ctx->cfglock);
free(dup);
return UB_AFTERFINAL;
}
if(!cfg_strlist_insert(&ctx->env->cfg->trust_anchor_file_list, dup)) {
@@ -300,6 +307,7 @@ ub_ctx_trustedkeys(struct ub_ctx* ctx, char* fname)
lock_basic_lock(&ctx->cfglock);
if(ctx->finalized) {
lock_basic_unlock(&ctx->cfglock);
free(dup);
return UB_AFTERFINAL;
}
if(!cfg_strlist_insert(&ctx->env->cfg->trusted_keys_file_list, dup)) {
@@ -686,6 +694,7 @@ ub_resolve_free(struct ub_result* result)
free(result->data);
free(result->len);
free(result->answer_packet);
free(result->why_bogus);
free(result);
}
@@ -788,8 +797,47 @@ ub_ctx_resolvconf(struct ub_ctx* ctx, char* fname)
char buf[1024];
char* parse, *addr;
int r;
if(fname == NULL)
if(fname == NULL) {
#if !defined(UB_ON_WINDOWS) || !defined(HAVE_WINDOWS_H)
fname = "/etc/resolv.conf";
#else
FIXED_INFO *info;
ULONG buflen = sizeof(*info);
IP_ADDR_STRING *ptr;
info = (FIXED_INFO *) malloc(sizeof (FIXED_INFO));
if (info == NULL)
return UB_READFILE;
if (GetNetworkParams(info, &buflen) == ERROR_BUFFER_OVERFLOW) {
free(info);
info = (FIXED_INFO *) malloc(buflen);
if (info == NULL)
return UB_READFILE;
}
if (GetNetworkParams(info, &buflen) == NO_ERROR) {
int retval=0;
ptr = &(info->DnsServerList);
while (ptr) {
numserv++;
if((retval=ub_ctx_set_fwd(ctx,
ptr->IpAddress.String)!=0)) {
free(info);
return retval;
}
ptr = ptr->Next;
}
free(info);
if (numserv==0)
return UB_READFILE;
return UB_NOERROR;
}
free(info);
return UB_READFILE;
#endif /* WINDOWS */
}
in = fopen(fname, "r");
if(!in) {
/* error in errno! perror(fname) */
@@ -840,8 +888,31 @@ ub_ctx_hosts(struct ub_ctx* ctx, char* fname)
return UB_AFTERFINAL;
}
lock_basic_unlock(&ctx->cfglock);
if(fname == NULL)
if(fname == NULL) {
#if defined(UB_ON_WINDOWS) && defined(HAVE_WINDOWS_H)
/*
* If this is Windows NT/XP/2K it's in
* %WINDIR%\system32\drivers\etc\hosts.
* If this is Windows 95/98/Me it's in %WINDIR%\hosts.
*/
name = getenv("WINDIR");
if (name != NULL) {
int retval=0;
snprintf(buf, sizeof(buf), "%s%s", name,
"\\system32\\drivers\\etc\\hosts");
if((retval=ub_ctx_hosts(ctx, buf)) !=0 ) {
snprintf(buf, sizeof(buf), "%s%s", name,
"\\hosts");
retval=ub_ctx_hosts(ctx, buf);
}
free(name);
return retval;
}
return UB_READFILE;
#else
fname = "/etc/hosts";
#endif /* WIN32 */
}
in = fopen(fname, "r");
if(!in) {
/* error in errno! perror(fname) */
+35 -15
View File
@@ -130,6 +130,7 @@ libworker_setup(struct ub_ctx* ctx, int is_bg)
return NULL;
}
w->env->worker = (struct worker*)w;
w->env->probe_timer = NULL;
seed = (unsigned int)time(NULL) ^ (unsigned int)getpid() ^
(((unsigned int)w->thread_num)<<17);
seed ^= (unsigned int)w->env->alloc->next_id;
@@ -168,7 +169,7 @@ libworker_setup(struct ub_ctx* ctx, int is_bg)
cfg->do_tcp?cfg->outgoing_num_tcp:0,
w->env->infra_cache, w->env->rnd, cfg->use_caps_bits_for_id,
ports, numports, cfg->unwanted_threshold,
&libworker_alloc_cleanup, w);
&libworker_alloc_cleanup, w, cfg->do_udp);
if(!w->is_bg || w->is_bg_thread) {
lock_basic_unlock(&ctx->cfglock);
}
@@ -437,8 +438,10 @@ libworker_enter_result(struct ub_result* res, ldns_buffer* buf,
/** fillup fg results */
static void
libworker_fillup_fg(struct ctx_query* q, int rcode, ldns_buffer* buf,
enum sec_status s)
enum sec_status s, char* why_bogus)
{
if(why_bogus)
q->res->why_bogus = strdup(why_bogus);
if(rcode != 0) {
q->res->rcode = rcode;
q->msg_security = s;
@@ -458,15 +461,15 @@ libworker_fillup_fg(struct ctx_query* q, int rcode, ldns_buffer* buf,
libworker_enter_result(q->res, buf, q->w->env->scratch, s);
}
/** callback with fg results */
static void
libworker_fg_done_cb(void* arg, int rcode, ldns_buffer* buf, enum sec_status s)
void
libworker_fg_done_cb(void* arg, int rcode, ldns_buffer* buf, enum sec_status s,
char* why_bogus)
{
struct ctx_query* q = (struct ctx_query*)arg;
/* fg query is done; exit comm base */
comm_base_exit(q->w->base);
libworker_fillup_fg(q, rcode, buf, s);
libworker_fillup_fg(q, rcode, buf, s, why_bogus);
}
/** setup qinfo and edns */
@@ -515,8 +518,9 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q)
ldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags);
if(local_zones_answer(ctx->local_zones, &qinfo, &edns,
w->back->udp_buff, w->env->scratch)) {
regional_free_all(w->env->scratch);
libworker_fillup_fg(q, LDNS_RCODE_NOERROR,
w->back->udp_buff, sec_status_insecure);
w->back->udp_buff, sec_status_insecure, NULL);
libworker_delete(w);
free(qinfo.qname);
return UB_NOERROR;
@@ -539,7 +543,7 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q)
/** add result to the bg worker result queue */
static void
add_bg_result(struct libworker* w, struct ctx_query* q, ldns_buffer* pkt,
int err)
int err, char* reason)
{
uint8_t* msg = NULL;
uint32_t len = 0;
@@ -547,6 +551,8 @@ add_bg_result(struct libworker* w, struct ctx_query* q, ldns_buffer* pkt,
/* serialize and delete unneeded q */
if(w->is_bg_thread) {
lock_basic_lock(&w->ctx->cfglock);
if(reason)
q->res->why_bogus = strdup(reason);
if(pkt) {
q->msg_len = ldns_buffer_remaining(pkt);
q->msg = memdup(ldns_buffer_begin(pkt), q->msg_len);
@@ -558,6 +564,8 @@ add_bg_result(struct libworker* w, struct ctx_query* q, ldns_buffer* pkt,
} else msg = context_serialize_answer(q, err, NULL, &len);
lock_basic_unlock(&w->ctx->cfglock);
} else {
if(reason)
q->res->why_bogus = strdup(reason);
msg = context_serialize_answer(q, err, pkt, &len);
(void)rbtree_delete(&w->ctx->queries, q->node.key);
w->ctx->num_async--;
@@ -574,9 +582,9 @@ add_bg_result(struct libworker* w, struct ctx_query* q, ldns_buffer* pkt,
}
}
/** callback with bg results */
static void
libworker_bg_done_cb(void* arg, int rcode, ldns_buffer* buf, enum sec_status s)
void
libworker_bg_done_cb(void* arg, int rcode, ldns_buffer* buf, enum sec_status s,
char* why_bogus)
{
struct ctx_query* q = (struct ctx_query*)arg;
@@ -597,7 +605,7 @@ libworker_bg_done_cb(void* arg, int rcode, ldns_buffer* buf, enum sec_status s)
if(rcode != 0) {
error_encode(buf, rcode, NULL, 0, BIT_RD, NULL);
}
add_bg_result(q->w, q, buf, UB_NOERROR);
add_bg_result(q->w, q, buf, UB_NOERROR, why_bogus);
}
@@ -622,7 +630,7 @@ handle_newq(struct libworker* w, uint8_t* buf, uint32_t len)
return;
}
if(!setup_qinfo_edns(w, q, &qinfo, &edns)) {
add_bg_result(w, q, NULL, UB_SYNTAX);
add_bg_result(w, q, NULL, UB_SYNTAX, NULL);
return;
}
qid = 0;
@@ -632,8 +640,9 @@ handle_newq(struct libworker* w, uint8_t* buf, uint32_t len)
ldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags);
if(local_zones_answer(w->ctx->local_zones, &qinfo, &edns,
w->back->udp_buff, w->env->scratch)) {
regional_free_all(w->env->scratch);
q->msg_security = sec_status_insecure;
add_bg_result(w, q, w->back->udp_buff, UB_NOERROR);
add_bg_result(w, q, w->back->udp_buff, UB_NOERROR, NULL);
free(qinfo.qname);
return;
}
@@ -641,7 +650,7 @@ handle_newq(struct libworker* w, uint8_t* buf, uint32_t len)
/* process new query */
if(!mesh_new_callback(w->env->mesh, &qinfo, qflags, &edns,
w->back->udp_buff, qid, libworker_bg_done_cb, q)) {
add_bg_result(w, q, NULL, UB_NOMEM);
add_bg_result(w, q, NULL, UB_NOMEM, NULL);
}
free(qinfo.qname);
}
@@ -835,6 +844,11 @@ void worker_stat_timer_cb(void* ATTR_UNUSED(arg))
log_assert(0);
}
void worker_probe_timer_cb(void* ATTR_UNUSED(arg))
{
log_assert(0);
}
int order_lock_cmp(const void* ATTR_UNUSED(e1), const void* ATTR_UNUSED(e2))
{
log_assert(0);
@@ -848,6 +862,12 @@ codeline_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
return 0;
}
int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
{
log_assert(0);
return 0;
}
#ifdef UB_ON_WINDOWS
void
worker_win_stop_cb(int ATTR_UNUSED(fd), short ATTR_UNUSED(ev), void*
+8
View File
@@ -156,6 +156,14 @@ void libworker_handle_control_cmd(struct tube* tube, uint8_t* msg, size_t len,
void libworker_handle_result_write(struct tube* tube, uint8_t* msg, size_t len,
int err, void* arg);
/** mesh callback with fg results */
void libworker_fg_done_cb(void* arg, int rcode, ldns_buffer* buf,
enum sec_status s, char* why_bogus);
/** mesh callback with bg results */
void libworker_bg_done_cb(void* arg, int rcode, ldns_buffer* buf,
enum sec_status s, char* why_bogus);
/**
* fill result from parsed message, on error fills servfail
* @param res: is clear at start, filled in at end.
+9 -8
View File
@@ -42,26 +42,27 @@ help:
.PHONY: testenv clean doc swig
_unbound.so: ../../Makefile
$(MAKE) -C ../..
#_unbound.so: ../../Makefile
#$(MAKE) -C ../..
../../.libs/libunbound.so.0: ../../Makefile
$(MAKE) -C ../..
#../../.libs/libunbound.so.0: ../../Makefile
#$(MAKE) -C ../..
../../ldns-src/lib/libldns.so: ../../ldns-src/Makefile
$(MAKE) -C ../../ldns-src
#../../ldns-src/lib/libldns.so: ../../ldns-src/Makefile
#$(MAKE) -C ../../ldns-src
clean:
rm -rdf examples/unbound
rm -f _unbound.so libunbound_wrap.o
$(MAKE) -C ../.. clean
testenv: ../../.libs/libunbound.so.0 ../../ldns-src/lib/libldns.so _unbound.so
testenv: ../../.libs/libunbound.so.1 ../../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 && 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
rm -rdf examples/unbound
rm -rdf examples/unbound examples/_unbound.so
doc: ../../.libs/libunbound.so.0 _unbound.so
$(MAKE) -C docs html
+8
View File
@@ -181,6 +181,14 @@ struct ub_result {
* This means the data is from a domain where data is not signed.
*/
int bogus;
/**
* If the result is bogus this contains a string (zero terminated)
* that describes the failure. There may be other errors as well
* as the one described, the description may not be perfectly accurate.
* Is NULL if the result is not bogus.
*/
char* why_bogus;
};
/**
+4988 -3512
View File
File diff suppressed because it is too large Load Diff
+77 -29
View File
@@ -107,6 +107,27 @@ replace_all () {
replace_text "$1" "@date@" "`date +'%b %e, %Y'`"
}
check_svn_root () {
# Check if SVNROOT is specified.
if [ -z "$SVNROOT" ]; then
if test -f .svn/entries; then
eval `svn info | grep 'URL:' | sed -e 's/URL: /url=/' | head -1`
SVNROOT="$url"
fi
if test -z "$SVNROOT"; then
error "SVNROOT must be specified (using -d)"
fi
fi
}
create_temp_dir () {
# Creating temp directory
info "Creating temporary working directory"
temp_dir=`mktemp -d unbound-dist-XXXXXX`
info "Directory '$temp_dir' created."
cd $temp_dir
}
SNAPSHOT="no"
RC="no"
@@ -147,6 +168,30 @@ while [ "$1" ]; do
done
if [ "$DOWIN" = "yes" ]; then
# detect crosscompile, from Fedora11 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
check_svn_root
create_temp_dir
info "Exporting source from SVN."
svn export "$SVNROOT" unbound || error_cleanup "SVN command failed"
cd unbound || error_cleanup "Unbound not exported correctly from SVN"
# on a re-configure the cache may no longer be valid...
if test -f mingw32-config.cache; then rm mingw32-config.cache; fi
else
cross="no" # mingw and msys
configure="./configure"
strip="strip"
makensis="c:/Program Files/NSIS/makensis.exe" # http://nsis.sf.net
fi
# version gets compiled into source, edit the configure to set it
version=`./configure --version | head -1 | awk '{ print $3 }'` \
|| error_cleanup "Cannot determine version number."
if [ "$RC" != "no" -o "$SNAPSHOT" != "no" ]; then
@@ -168,8 +213,8 @@ if [ "$DOWIN" = "yes" ]; then
# 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 '"$*"
$configure --enable-debug --enable-static-exe $* \
|| error_cleanup "Could not configure"
info "Calling make"
make || error_cleanup "Could not make"
@@ -180,13 +225,13 @@ if [ "$DOWIN" = "yes" ]; then
rm -f $file
info "Creating $file"
mkdir tmp.$$
strip unbound.exe
strip anchor-update.exe
strip unbound-control.exe
strip unbound-host.exe
strip unbound-checkconf.exe
strip unbound-service-install.exe
strip unbound-service-remove.exe
$strip unbound.exe
$strip anchor-update.exe
$strip unbound-control.exe
$strip unbound-host.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 .
@@ -198,28 +243,23 @@ if [ "$DOWIN" = "yes" ]; then
info "Creating installer"
quadversion=`cat ../config.h | grep RSRC_PACKAGE_VERSION | sed -e 's/#define RSRC_PACKAGE_VERSION //' -e 's/,/\\./g'`
cat ../winrc/setup.nsi | sed -e 's/define VERSION.*$/define VERSION "'$version'"/' -e 's/define QUADVERSION.*$/define QUADVERSION "'$quadversion'"/' > ../winrc/setup_ed.nsi
# get tool from http://nsis.sf.net
c:/Program\ Files/NSIS/makensis.exe ../winrc/setup_ed.nsi
"$makensis" ../winrc/setup_ed.nsi
info "Created installer"
cd ..
rm -rf tmp.$$
mv winrc/unbound_setup_$version.exe .
if test "$cross" = "yes"; then
mv unbound_setup_$version.exe $cwd/.
mv unbound-$version.zip $cwd/.
cleanup
fi
ls -lG unbound_setup_$version.exe
ls -lG unbound-$version.zip
info "Done"
exit 0
fi
# Check if SVNROOT is specified.
if [ -z "$SVNROOT" ]; then
if test -f .svn/entries; then
eval `svn info | grep 'URL:' | sed -e 's/URL: /url=/' | head -1`
SVNROOT="$url"
fi
if test -z "$SVNROOT"; then
error "SVNROOT must be specified (using -d)"
fi
fi
check_svn_root
# Check if LDNSDIR is specified.
if test -z "$LDNSDIR"; then
# try to autodetect from Makefile (if present)
@@ -237,12 +277,7 @@ info "SNAPSHOT is $SNAPSHOT"
#question "Do you wish to continue with these settings?" || error "User abort."
# Creating temp directory
info "Creating temporary working directory"
temp_dir=`mktemp -d unbound-dist-XXXXXX`
info "Directory '$temp_dir' created."
cd $temp_dir
create_temp_dir
info "Exporting source from SVN."
svn export "$SVNROOT" unbound || error_cleanup "SVN command failed"
@@ -346,8 +381,21 @@ case $OSTYPE in
sha256=`sha256 unbound-$version.tar.gz | awk '{ print $5 }'`
;;
*)
sha=`sha1sum unbound-$version.tar.gz | awk '{ print $1 }'`
sha256=`sha256sum unbound-$version.tar.gz | awk '{ print $1 }'`
# in case $OSTYPE is gone.
case `uname` in
Linux*)
sha=`sha1sum unbound-$version.tar.gz | awk '{ print $1 }'`
sha256=`sha256sum unbound-$version.tar.gz | awk '{ print $1 }'`
;;
FreeBSD*)
sha=`sha1 unbound-$version.tar.gz | awk '{ print $5 }'`
sha256=`sha256 unbound-$version.tar.gz | awk '{ print $5 }'`
;;
*)
sha=`sha1sum unbound-$version.tar.gz | awk '{ print $1 }'`
sha256=`sha256sum unbound-$version.tar.gz | awk '{ print $1 }'`
;;
esac
;;
esac
echo $sha > unbound-$version.tar.gz.sha1
+1 -1
View File
@@ -34,7 +34,7 @@
SUEXEC = sudo
UNBOUND = ../unbound
SCRIPT = ./test-dict.conf
SCRIPT = ./test-resip.conf
UNBOUND_OPTS = -dv -c $(SCRIPT)
+96
View File
@@ -0,0 +1,96 @@
'''
resip.py: This example shows how to generate authoritative response
and how to find out the IP address of a client
Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
Marek Vavrusa (xvavru00 AT stud.fit.vutbr.cz)
This software is open source.
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 the organization 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 REGENTS 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.
Usage:
dig @127.0.0.1 -t TXT what.is.my.ip.
'''
def init(id, cfg): return True
def deinit(id): return True
def inform_super(id, qstate, superqstate, qdata): return True
def operate(id, event, qstate, qdata):
print "Operate", event,"state:",qstate
# Please note that if this module blocks, by moving to the validator
# to validate or iterator to lookup or spawn a subquery to look up,
# then, other incoming queries are queued up onto this module and
# all of them receive the same reply.
# You can inspect the cache.
if (event == MODULE_EVENT_NEW) or (event == MODULE_EVENT_PASS):
if (qstate.qinfo.qname_str.endswith("what.is.my.ip.")): #query name ends with localdomain
#create instance of DNS message (packet) with given parameters
msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_TXT, RR_CLASS_IN, PKT_QR | PKT_RA | PKT_AA)
#append RR
if (qstate.qinfo.qtype == RR_TYPE_TXT) or (qstate.qinfo.qtype == RR_TYPE_ANY):
rl = qstate.mesh_info.reply_list
while (rl):
if rl.query_reply:
q = rl.query_reply
# The TTL of 0 is mandatory, otherwise it ends up in
# the cache, and is returned to other IP addresses.
msg.answer.append("%s 0 IN TXT \"%s %d (%s)\"" % (qstate.qinfo.qname_str, q.addr,q.port,q.family))
rl = rl.next
#set qstate.return_msg
if not msg.set_return_msg(qstate):
qstate.ext_state[id] = MODULE_ERROR
return True
#we don't need validation, result is valid
qstate.return_msg.rep.security = 2
qstate.return_rcode = RCODE_NOERROR
qstate.ext_state[id] = MODULE_FINISHED
return True
else:
#pass the query to validator
qstate.ext_state[id] = MODULE_WAIT_MODULE
return True
if event == MODULE_EVENT_MODDONE:
log_info("pythonmod: iterator module done")
qstate.ext_state[id] = MODULE_FINISHED
return True
log_err("pythonmod: bad event")
qstate.ext_state[id] = MODULE_ERROR
return True
+78 -10
View File
@@ -17,6 +17,7 @@
#include "config.h"
#include "util/log.h"
#include "util/module.h"
#include "util/netevent.h"
#include "util/regional.h"
#include "util/config_file.h"
#include "util/data/msgreply.h"
@@ -24,6 +25,7 @@
#include "util/data/dname.h"
#include "util/storage/lruhash.h"
#include "services/cache/dns.h"
#include "services/mesh.h"
%}
%include "stdint.i" // uint_16_t can be known type now
@@ -408,6 +410,68 @@ struct dns_msg {
%}
}
/* ************************************************************************************ *
Structure mesh_state
* ************************************************************************************ */
struct mesh_state {
struct mesh_reply* reply_list;
};
struct mesh_reply {
struct mesh_reply* next;
struct comm_reply query_reply;
};
struct comm_reply {
};
%inline %{
PyObject* _comm_reply_addr_get(struct comm_reply* reply) {
char dest[64];
reply_addr2str(reply, dest, 64);
if (dest[0] == 0)
return Py_None;
return PyString_FromString(dest);
}
PyObject* _comm_reply_family_get(struct comm_reply* reply) {
int af = (int)((struct sockaddr_in*) &(reply->addr))->sin_family;
switch(af) {
case AF_INET: return PyString_FromString("ip4");
case AF_INET6: return PyString_FromString("ip6");
case AF_UNIX: return PyString_FromString("unix");
}
return Py_None;
}
PyObject* _comm_reply_port_get(struct comm_reply* reply) {
uint16_t port;
port = ntohs(((struct sockaddr_in*)&(reply->addr))->sin_port);
return PyInt_FromLong(port);
}
%}
%extend comm_reply {
%pythoncode %{
def _addr_get(self): return _comm_reply_addr_get(self)
__swig_getmethods__["addr"] = _addr_get
if _newclass:addr = _swig_property(_addr_get)
def _port_get(self): return _comm_reply_port_get(self)
__swig_getmethods__["port"] = _port_get
if _newclass:port = _swig_property(_port_get)
def _family_get(self): return _comm_reply_family_get(self)
__swig_getmethods__["family"] = _family_get
if _newclass:family = _swig_property(_family_get)
%}
}
/* ************************************************************************************ *
Structure module_qstate
* ************************************************************************************ */
@@ -715,7 +779,7 @@ int set_return_msg(struct module_qstate* qstate,
{
ldns_pkt* pkt = 0;
ldns_status status;
ldns_rr_list* rr_list1 = 0,*rr_list2 = 0,*rr_list3 = 0,*rr_list4 = 0;
ldns_rr_list* rr_list = 0;
ldns_buffer *qb = 0;
int res = 1;
@@ -726,14 +790,18 @@ int set_return_msg(struct module_qstate* qstate,
if ((status != LDNS_STATUS_OK) || (pkt == 0))
return 0;
rr_list1 = createRRList(question, default_ttl);
if ((rr_list1) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_QUESTION, rr_list1);
rr_list2 = createRRList(answer, default_ttl);
if ((rr_list2) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ANSWER, rr_list2);
rr_list3 = createRRList(authority, default_ttl);
if ((rr_list3) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_AUTHORITY, rr_list3);
rr_list4 = createRRList(additional, default_ttl);
if ((rr_list4) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ADDITIONAL, rr_list4);
rr_list = createRRList(question, default_ttl);
if ((rr_list) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_QUESTION, rr_list);
ldns_rr_list_free(rr_list);
rr_list = createRRList(answer, default_ttl);
if ((rr_list) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ANSWER, rr_list);
ldns_rr_list_free(rr_list);
rr_list = createRRList(authority, default_ttl);
if ((rr_list) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_AUTHORITY, rr_list);
ldns_rr_list_free(rr_list);
rr_list = createRRList(additional, default_ttl);
if ((rr_list) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ADDITIONAL, rr_list);
ldns_rr_list_free(rr_list);
if ((res) && ((qb = ldns_buffer_new(LDNS_MIN_BUFLEN)) == 0)) res = 0;
if ((res) && (ldns_pkt2buffer_wire(qb, pkt) != LDNS_STATUS_OK)) res = 0;
@@ -742,7 +810,7 @@ int set_return_msg(struct module_qstate* qstate,
if (qb) ldns_buffer_free(qb);
ldns_pkt_free(pkt); //this function dealocates pkt as well as rr_lists
ldns_pkt_free(pkt); //this function dealocates pkt as well as rrs
return res;
}
%}
+50 -1
View File
@@ -44,11 +44,58 @@
#endif
#include "config.h"
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
#include <Python.h>
#include "pythonmod/pythonmod.h"
#include "util/module.h"
#include "util/config_file.h"
#include "pythonmod_utils.h"
#include <Python.h>
#ifdef S_SPLINT_S
typedef struct PyObject PyObject;
#endif
/**
* Global state for the module.
*/
struct pythonmod_env {
/** Python script filename. */
const char* fname;
/** Python module. */
PyObject* module;
/** Module init function */
PyObject* func_init;
/** Module deinit function */
PyObject* func_deinit;
/** Module operate function */
PyObject* func_operate;
/** Module super_inform function */
PyObject* func_inform;
/** Python dictionary. */
PyObject* dict;
/** Module data. */
PyObject* data;
/** Module qstate. */
struct module_qstate* qstate;
};
/**
* Per query state for the iterator module.
*/
struct pythonmod_qstate {
/** Module per query data. */
PyObject* data;
};
/* Generated */
#ifndef S_SPLINT_S
@@ -198,6 +245,8 @@ void pythonmod_deinit(struct module_env* env, int id)
Py_Finalize();
}
pe->fname = NULL;
free(pe);
/* Module is deallocated in Python */
env->modinfo[id] = NULL;
-45
View File
@@ -41,51 +41,6 @@
#define PYTHONMOD_H
#include "util/module.h"
#include "services/outbound_list.h"
#include <Python.h>
struct PyObject;
#if S_SPLINT_S
typedef struct PyObject PyObject;
#endif
/**
* Global state for the module.
*/
struct pythonmod_env {
/** Python script filename. */
const char* fname;
/** Python module. */
PyObject* module;
/** Module init function */
PyObject* func_init;
/** Module deinit function */
PyObject* func_deinit;
/** Module operate function */
PyObject* func_operate;
/** Module super_inform function */
PyObject* func_inform;
/** Python dictionary. */
PyObject* dict;
/** Module data. */
PyObject* data;
/** Module qstate. */
struct module_qstate* qstate;
};
/**
* Per query state for the iterator module.
*/
struct pythonmod_qstate {
/** Module per query data. */
PyObject* data;
};
/**
* Get the module function block.
+41 -22
View File
@@ -40,6 +40,7 @@
*/
#include "config.h"
#include "util/module.h"
#include "util/netevent.h"
#include "util/net_help.h"
#include "services/cache/dns.h"
#include "services/cache/rrset.h"
@@ -47,15 +48,18 @@
#include "util/data/msgreply.h"
#include "util/storage/slabhash.h"
#include "util/regional.h"
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE
#include <Python.h>
/** Store the reply_info and query_info pair in message cache (qstate->msg_cache) */
/* Store the reply_info and query_info pair in message cache (qstate->msg_cache) */
int storeQueryInCache(struct module_qstate* qstate, struct query_info* qinfo, struct reply_info* msgrep, int is_referral)
{
if (!msgrep)
return 0;
if (msgrep->authoritative) //authoritative answer can't be stored in cache
if (msgrep->authoritative) /*authoritative answer can't be stored in cache*/
{
PyErr_SetString(PyExc_ValueError, "Authoritative answer can't be stored");
return 0;
@@ -64,7 +68,7 @@ int storeQueryInCache(struct module_qstate* qstate, struct query_info* qinfo, st
return dns_cache_store(qstate->env, qinfo, msgrep, is_referral);
}
/** Invalidate the message associated with query_info stored in message cache */
/* Invalidate the message associated with query_info stored in message cache */
void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qinfo)
{
hashvalue_t h;
@@ -75,10 +79,10 @@ void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qin
h = query_info_hash(qinfo);
if ((e=slabhash_lookup(qstate->env->msg_cache, h, qinfo, 0)))
{
r = (struct reply_info*)(e->data);
if (r)
{
r->ttl = 0;
r = (struct reply_info*)(e->data);
if (r)
{
r->ttl = 0;
if(rrset_array_lock(r->ref, r->rrset_count, *qstate->env->now)) {
for(i=0; i< r->rrset_count; i++)
{
@@ -93,14 +97,14 @@ void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qin
}
rrset_array_unlock(r->ref, r->rrset_count);
}
}
lock_rw_unlock(&e->lock);
}
lock_rw_unlock(&e->lock);
} else {
log_info("invalidateQueryInCache: qinfo is not in cache");
log_info("invalidateQueryInCache: qinfo is not in cache");
}
}
/** Create response according to the ldns packet content */
/* Create response according to the ldns packet content */
int createResponse(struct module_qstate* qstate, ldns_buffer* pkt)
{
struct msg_parse* prs;
@@ -109,8 +113,8 @@ int createResponse(struct module_qstate* qstate, ldns_buffer* pkt)
/* parse message */
prs = (struct msg_parse*) regional_alloc(qstate->env->scratch, sizeof(struct msg_parse));
if (!prs) {
log_err("storeResponse: out of memory on incoming message");
return 0;
log_err("storeResponse: out of memory on incoming message");
return 0;
}
memset(prs, 0, sizeof(*prs));
@@ -118,12 +122,12 @@ int createResponse(struct module_qstate* qstate, ldns_buffer* pkt)
ldns_buffer_set_position(pkt, 0);
if (parse_packet(pkt, prs, qstate->env->scratch) != LDNS_RCODE_NOERROR) {
verbose(VERB_ALGO, "storeResponse: parse error on reply packet");
return 0;
verbose(VERB_ALGO, "storeResponse: parse error on reply packet");
return 0;
}
/* edns is not examined, but removed from message to help cache */
if(parse_extract_edns(prs, &edns) != LDNS_RCODE_NOERROR)
return 0;
return 0;
/* remove CD-bit, we asked for in case we handle validation ourself */
prs->flags &= ~BIT_CD;
@@ -135,23 +139,38 @@ int createResponse(struct module_qstate* qstate, ldns_buffer* pkt)
memset(qstate->return_msg, 0, sizeof(*qstate->return_msg));
if(!parse_create_msg(pkt, prs, NULL, &(qstate->return_msg)->qinfo, &(qstate->return_msg)->rep, qstate->region)) {
log_err("storeResponse: malloc failure: allocating incoming dns_msg");
return 0;
log_err("storeResponse: malloc failure: allocating incoming dns_msg");
return 0;
}
/* Make sure that the RA flag is set (since the presence of
* this module means that recursion is available) */
//qstate->return_msg->rep->flags |= BIT_RA;
/* qstate->return_msg->rep->flags |= BIT_RA; */
/* Clear the AA flag */
/* FIXME: does this action go here or in some other module? */
//qstate->return_msg->rep->flags &= ~BIT_AA;
/*qstate->return_msg->rep->flags &= ~BIT_AA; */
/* make sure QR flag is on */
//qstate->return_msg->rep->flags |= BIT_QR;
/*qstate->return_msg->rep->flags |= BIT_QR; */
if(verbosity >= VERB_ALGO)
log_dns_msg("storeResponse: packet:", &qstate->return_msg->qinfo, qstate->return_msg->rep);
log_dns_msg("storeResponse: packet:", &qstate->return_msg->qinfo, qstate->return_msg->rep);
return 1;
}
/* Convert reply->addr to string */
void reply_addr2str(struct comm_reply* reply, char* dest, int maxlen)
{
int af = (int)((struct sockaddr_in*) &(reply->addr))->sin_family;
void* sinaddr = &((struct sockaddr_in*) &(reply->addr))->sin_addr;
if(af == AF_INET6)
sinaddr = &((struct sockaddr_in6*)&(reply->addr))->sin6_addr;
dest[0] = 0;
if (inet_ntop(af, sinaddr, dest, (socklen_t)maxlen) == 0)
return;
dest[maxlen-1] = 0;
}
+8
View File
@@ -77,4 +77,12 @@ void invalidateQueryInCache(struct module_qstate* qstate, struct query_info* qin
*/
int createResponse(struct module_qstate* qstate, ldns_buffer* pkt);
/**
* Convert reply->addr to string
* @param reply: comm reply with address in it.
* @param dest: destination string.
* @param maxlen: length of string buffer.
*/
void reply_addr2str(struct comm_reply* reply, char* dest, int maxlen);
#endif /* PYTHONMOD_UTILS_H */
+18
View File
@@ -0,0 +1,18 @@
# Example configuration file for resip.py
server:
verbosity: 1
#interface: 0.0.0.0
do-daemonize: no
#access-control: 0.0.0.0/0 allow
chroot: ""
username: ""
directory: ""
logfile: ""
pidfile: "unbound.pid"
module-config: "validator python iterator"
# Python config section
python:
# Script file to load
python-script: "./examples/resip.py"
+65 -4
View File
@@ -40,6 +40,7 @@
*/
#include "config.h"
#include "iterator/iter_delegpt.h"
#include "validator/val_nsec.h"
#include "services/cache/dns.h"
#include "services/cache/rrset.h"
#include "util/data/msgreply.h"
@@ -179,7 +180,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)) {
if(!delegpt_add_rrset_A(dp, region, akey, 0, 0)) {
lock_rw_unlock(&akey->entry.lock);
return 0;
}
@@ -197,7 +198,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)) {
if(!delegpt_add_rrset_AAAA(dp, region, akey, 0, 0)) {
lock_rw_unlock(&akey->entry.lock);
return 0;
}
@@ -212,6 +213,27 @@ 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;
}
@@ -231,7 +253,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_A, qclass, 0, now, 0);
if(akey) {
if(!delegpt_add_rrset_A(dp, region, akey, 1)) {
if(!delegpt_add_rrset_A(dp, region, akey, 0, 1)) {
lock_rw_unlock(&akey->entry.lock);
return 0;
}
@@ -249,7 +271,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, 1)) {
if(!delegpt_add_rrset_AAAA(dp, region, akey, 0, 1)) {
lock_rw_unlock(&akey->entry.lock);
return 0;
}
@@ -264,6 +286,27 @@ 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;
}
@@ -286,6 +329,10 @@ find_add_ds(struct module_env* env, struct regional* region,
/* Note: the PACKED_RRSET_NSEC_AT_APEX flag is not used.
* since this is a referral, we need the NSEC at the parent
* side of the zone cut, not the NSEC at apex side. */
if(rrset && nsec_has_type(rrset, LDNS_RR_TYPE_DS)) {
lock_rw_unlock(&rrset->entry.lock);
rrset = NULL; /* discard wrong NSEC */
}
}
if(rrset) {
/* add it to auth section. This is the second rrset. */
@@ -435,6 +482,18 @@ tomsg(struct module_env* env, struct msgreply_entry* e, struct reply_info* r,
msg->rep->authoritative = r->authoritative;
if(!rrset_array_lock(r->ref, r->rrset_count, now))
return NULL;
if(r->an_numrrsets > 0 && (r->rrsets[0]->rk.type == htons(
LDNS_RR_TYPE_CNAME) || r->rrsets[0]->rk.type == htons(
LDNS_RR_TYPE_DNAME)) && !reply_check_cname_chain(r)) {
/* cname chain is now invalid, reconstruct msg */
rrset_array_unlock(r->ref, r->rrset_count);
return NULL;
}
if(r->security == sec_status_secure && !reply_all_rrsets_secure(r)) {
/* message rrsets have changed status, revalidate */
rrset_array_unlock(r->ref, r->rrset_count);
return NULL;
}
for(i=0; i<msg->rep->rrset_count; i++) {
msg->rep->rrsets[i] = packed_rrset_copy_region(r->rrsets[i],
region, now);
@@ -656,6 +715,8 @@ dns_cache_store(struct module_env* env, struct query_info* msgqinf,
rep = reply_info_copy(msgrep, env->alloc, NULL);
if(!rep)
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. */
if(is_referral) {
/* store rrsets */
+11 -3
View File
@@ -219,6 +219,7 @@ new_host_entry(struct infra_cache* infra, struct sockaddr_storage* addr,
data->lameness = NULL;
data->edns_version = 0;
data->edns_lame_known = 0;
data->num_timeouts = 0;
rtt_init(&data->rtt);
return &key->entry;
}
@@ -471,9 +472,14 @@ infra_rtt_update(struct infra_cache* infra,
/* have an entry, update the rtt, and the ttl */
data = (struct infra_host_data*)e->data;
data->ttl = timenow + infra->host_ttl;
if(roundtrip == -1)
if(roundtrip == -1) {
rtt_lost(&data->rtt, orig_rtt);
else rtt_update(&data->rtt, roundtrip);
if(data->num_timeouts<255)
data->num_timeouts++;
} else {
rtt_update(&data->rtt, roundtrip);
data->num_timeouts = 0;
}
if(data->rtt.rto > 0)
rto = data->rtt.rto;
@@ -513,7 +519,8 @@ 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, uint32_t timenow)
int* lame, int* dnsseclame, int* reclame, int* rtt, int* lost,
uint32_t timenow)
{
struct infra_host_data* host;
struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr,
@@ -523,6 +530,7 @@ 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;
/* check lameness first, if so, ttl on host does not matter anymore */
if(infra_lookup_lame(host, name, namelen, timenow,
&dlm, &rlm, &alm, &olm)) {
+6 -1
View File
@@ -74,6 +74,8 @@ 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;
};
/**
@@ -270,13 +272,16 @@ 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, uint32_t timenow);
int* lame, int* dnsseclame, int* reclame, int* rtt, int* lost,
uint32_t timenow);
/**
* Get memory used by the infra cache.
+161 -23
View File
@@ -89,14 +89,21 @@ 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)
socklen_t addrlen, int v6only, int* inuse, int* noproto, int rcv)
{
int s;
# if defined(IPV6_USE_MIN_MTU)
#if defined(IPV6_USE_MIN_MTU)
int on=1;
# else
#endif
#ifdef IPV6_MTU
int mtu = IPV6_MIN_MTU;
#endif
#if !defined(SO_RCVBUFFORCE) && !defined(SO_RCVBUF)
(void)rcv;
#endif
#ifndef IPV6_V6ONLY
(void)v6only;
# endif
#endif
if((s = socket(family, socktype, 0)) == -1) {
*inuse = 0;
#ifndef USE_WINSOCK
@@ -117,6 +124,64 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
*noproto = 0;
return -1;
}
if(rcv) {
#ifdef SO_RCVBUF
int got;
socklen_t slen = (socklen_t)sizeof(got);
# ifdef SO_RCVBUFFORCE
/* Linux specific: try to use root permission to override
* system limits on rcvbuf. The limit is stored in
* /proc/sys/net/core/rmem_max or sysctl net.core.rmem_max */
if(setsockopt(s, SOL_SOCKET, SO_RCVBUFFORCE, (void*)&rcv,
(socklen_t)sizeof(rcv)) < 0) {
if(errno != EPERM) {
# ifndef USE_WINSOCK
log_err("setsockopt(..., SO_RCVBUFFORCE, "
"...) failed: %s", strerror(errno));
close(s);
# else
log_err("setsockopt(..., SO_RCVBUFFORCE, "
"...) failed: %s",
wsa_strerror(WSAGetLastError()));
closesocket(s);
# endif
*noproto = 0;
*inuse = 0;
return -1;
}
# endif /* SO_RCVBUFFORCE */
if(setsockopt(s, SOL_SOCKET, SO_RCVBUF, (void*)&rcv,
(socklen_t)sizeof(rcv)) < 0) {
# ifndef USE_WINSOCK
log_err("setsockopt(..., SO_RCVBUF, "
"...) failed: %s", strerror(errno));
close(s);
# else
log_err("setsockopt(..., SO_RCVBUF, "
"...) 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_RCVBUF, (void*)&got,
&slen) >= 0 && got < rcv/2) {
log_warn("so-rcvbuf %u was not granted. "
"Got %u. To fix: start with "
"root permissions(linux) or sysctl "
"bigger net.core.rmem_max(linux) or "
"kern.ipc.maxsockbuf(bsd) values.",
(unsigned)rcv, (unsigned)got);
}
# ifdef SO_RCVBUFFORCE
}
# endif
#endif /* SO_RCVBUF */
}
if(family == AF_INET6) {
# if defined(IPV6_V6ONLY)
if(v6only) {
@@ -150,21 +215,61 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
*/
if (setsockopt(s, IPPROTO_IPV6, IPV6_USE_MIN_MTU,
(void*)&on, (socklen_t)sizeof(on)) < 0) {
#ifndef USE_WINSOCK
# ifndef USE_WINSOCK
log_err("setsockopt(..., IPV6_USE_MIN_MTU, "
"...) failed: %s", strerror(errno));
close(s);
#else
# else
log_err("setsockopt(..., IPV6_USE_MIN_MTU, "
"...) failed: %s",
wsa_strerror(WSAGetLastError()));
closesocket(s);
#endif
# endif
*noproto = 0;
*inuse = 0;
return -1;
}
# endif
# elif defined(IPV6_MTU)
/*
* On Linux, to send no larger than 1280, the PMTUD is
* disabled by default for datagrams anyway, so we set
* the MTU to use.
*/
if (setsockopt(s, IPPROTO_IPV6, IPV6_MTU,
(void*)&mtu, (socklen_t)sizeof(mtu)) < 0) {
# ifndef USE_WINSOCK
log_err("setsockopt(..., IPV6_MTU, ...) failed: %s",
strerror(errno));
close(s);
# else
log_err("setsockopt(..., IPV6_MTU, ...) failed: %s",
wsa_strerror(WSAGetLastError()));
closesocket(s);
# endif
*noproto = 0;
*inuse = 0;
return -1;
}
# endif /* IPv6 MTU */
} else if(family == AF_INET) {
# if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT)
int action = IP_PMTUDISC_DONT;
if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER,
&action, (socklen_t)sizeof(action)) < 0) {
log_err("setsockopt(..., IP_MTU_DISCOVER, "
"IP_PMTUDISC_DONT...) failed: %s",
strerror(errno));
return -1;
}
# elif defined(IP_DONTFRAG)
int off = 0;
if (setsockopt(s, IPPROTO_IP, IP_DONTFRAG,
&off, (socklen_t)sizeof(off)) < 0) {
log_err("setsockopt(..., IP_DONTFRAG, ...) failed: %s",
strerror(errno));
return -1;
}
# endif /* IPv4 MTU */
}
if(bind(s, (struct sockaddr*)addr, addrlen) != 0) {
*noproto = 0;
@@ -176,7 +281,7 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
*noproto = 1;
else if(errno != EADDRINUSE)
log_err("can't bind socket: %s", strerror(errno));
#endif
#endif /* EADDRINUSE */
close(s);
#else /* USE_WINSOCK */
if(WSAGetLastError() != WSAEADDRINUSE &&
@@ -288,7 +393,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)
struct addrinfo *hints, int v6only, int* noip6, size_t rcv)
{
struct addrinfo *res = NULL;
int r, s, inuse, noproto;
@@ -314,8 +419,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);
(struct sockaddr*)res->ai_addr,
res->ai_addrlen, v6only, &inuse, &noproto, (int)rcv);
if(s == -1 && inuse) {
log_err("bind: address already in use");
} else if(s == -1 && noproto && hints->ai_family == AF_INET6){
@@ -331,6 +436,35 @@ make_sock(int stype, const char* ifname, const char* port,
return s;
}
/** 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)
{
char* s = strchr(ifname, '@');
if(s) {
/* override port with ifspec@port */
char p[16];
char newif[128];
if((size_t)(s-ifname) >= sizeof(newif)) {
log_err("ifname too long: %s", ifname);
*noip6 = 0;
return -1;
}
if(strlen(s+1) >= sizeof(p)) {
log_err("portnumber too long: %s", ifname);
*noip6 = 0;
return -1;
}
strncpy(newif, ifname, sizeof(newif));
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, ifname, port, hints, v6only, noip6, rcv);
}
/**
* Add port to open ports list.
* @param list: list head. changed.
@@ -417,18 +551,20 @@ set_recvpktinfo(int s, int family)
* @param hints: for getaddrinfo. family and flags have to be set by caller.
* @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
* @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)
struct addrinfo *hints, const char* port, struct listen_port** list,
size_t rcv)
{
int s, noip6=0;
if(!do_udp && !do_tcp)
return 0;
if(do_auto) {
if((s = make_sock(SOCK_DGRAM, ifname, port, hints, 1,
&noip6)) == -1) {
if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1,
&noip6, rcv)) == -1) {
if(noip6) {
log_warn("IPv6 protocol not available");
return 1;
@@ -448,8 +584,8 @@ 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(SOCK_DGRAM, ifname, port, hints, 1,
&noip6)) == -1) {
if((s = make_sock_port(SOCK_DGRAM, ifname, port, hints, 1,
&noip6, rcv)) == -1) {
if(noip6) {
log_warn("IPv6 protocol not available");
return 1;
@@ -466,8 +602,8 @@ ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp,
}
}
if(do_tcp) {
if((s = make_sock(SOCK_STREAM, ifname, port, hints, 1,
&noip6)) == -1) {
if((s = make_sock_port(SOCK_STREAM, ifname, port, hints, 1,
&noip6, 0)) == -1) {
if(noip6) {
/*log_warn("IPv6 protocol not available");*/
return 1;
@@ -643,7 +779,7 @@ listening_ports_open(struct config_file* cfg)
hints.ai_family = AF_INET6;
if(!ports_create_if(do_auto?"::0":"::1",
do_auto, cfg->do_udp, do_tcp,
&hints, portbuf, &list)) {
&hints, portbuf, &list, cfg->socket_rcvbuf)) {
listening_ports_free(list);
return NULL;
}
@@ -652,7 +788,7 @@ 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)) {
&hints, portbuf, &list, cfg->socket_rcvbuf)) {
listening_ports_free(list);
return NULL;
}
@@ -663,7 +799,8 @@ listening_ports_open(struct config_file* cfg)
continue;
hints.ai_family = AF_INET6;
if(!ports_create_if(cfg->ifs[i], 0, cfg->do_udp,
do_tcp, &hints, portbuf, &list)) {
do_tcp, &hints, portbuf, &list,
cfg->socket_rcvbuf)) {
listening_ports_free(list);
return NULL;
}
@@ -672,7 +809,8 @@ listening_ports_open(struct config_file* cfg)
continue;
hints.ai_family = AF_INET;
if(!ports_create_if(cfg->ifs[i], 0, cfg->do_udp,
do_tcp, &hints, portbuf, &list)) {
do_tcp, &hints, portbuf, &list,
cfg->socket_rcvbuf)) {
listening_ports_free(list);
return NULL;
}
+2 -1
View File
@@ -180,10 +180,11 @@ size_t listen_get_mem(struct listen_dnsport* listen);
* @param inuse: on error, this is set true if the port was in use.
* @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.
* @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);
socklen_t addrlen, int v6only, int* inuse, int* noproto, int rcv);
/**
* Create and bind TCP listening socket
+9 -7
View File
@@ -1309,14 +1309,16 @@ void local_zones_del_data(struct local_zones* zones,
/* find the domain */
d = lz_find_node(z, name, len, labs);
/* no memory recycling for zone deletions ... */
d->rrsets = NULL;
/* did we delete the soa record ? */
if(query_dname_compare(d->name, z->name) == 0)
z->soa = NULL;
if(d) {
/* no memory recycling for zone deletions ... */
d->rrsets = NULL;
/* did we delete the soa record ? */
if(query_dname_compare(d->name, z->name) == 0)
z->soa = NULL;
/* cleanup the empty nonterminals for this name */
del_empty_term(z, d, name, len, labs);
/* cleanup the empty nonterminals for this name */
del_empty_term(z, d, name, len, labs);
}
lock_rw_unlock(&z->lock);
}
+32 -8
View File
@@ -61,9 +61,9 @@ static void
timeval_subtract(struct timeval* d, const struct timeval* end, const struct timeval* start)
{
#ifndef S_SPLINT_S
time_t end_usec = end->tv_usec;;
time_t end_usec = end->tv_usec;
d->tv_sec = end->tv_sec - start->tv_sec;
while(end_usec < start->tv_usec) {
if(end_usec < start->tv_usec) {
end_usec += 1000000;
d->tv_sec--;
}
@@ -78,7 +78,7 @@ timeval_add(struct timeval* d, const struct timeval* add)
#ifndef S_SPLINT_S
d->tv_sec += add->tv_sec;
d->tv_usec += add->tv_usec;
while(d->tv_usec > 1000000 ) {
if(d->tv_usec > 1000000 ) {
d->tv_usec -= 1000000;
d->tv_sec++;
}
@@ -465,9 +465,15 @@ mesh_state_cleanup(struct mesh_state* mstate)
/* 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);
}
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);
}
}
/* de-init modules */
@@ -609,6 +615,7 @@ mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep,
struct mesh_cb* r)
{
int secure;
char* reason = NULL;
/* bogus messages are not made into servfail, sec_status passed
* to the callback function */
if(rep && rep->security == sec_status_secure)
@@ -616,9 +623,14 @@ mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep,
else secure = 0;
if(!rep && rcode == LDNS_RCODE_NOERROR)
rcode = LDNS_RCODE_SERVFAIL;
if(!rcode && rep->security == sec_status_bogus) {
if(!(reason = errinf_to_str(&m->s)))
rcode = LDNS_RCODE_SERVFAIL;
}
/* send the reply */
if(rcode) {
(*r->cb)(r->cb_arg, rcode, r->buf, sec_status_unchecked);
fptr_ok(fptr_whitelist_mesh_cb(r->cb));
(*r->cb)(r->cb_arg, rcode, r->buf, sec_status_unchecked, NULL);
} else {
size_t udp_size = r->edns.udp_size;
ldns_buffer_clear(r->buf);
@@ -631,12 +643,16 @@ mesh_do_callback(struct mesh_state* m, int rcode, struct reply_info* rep,
m->s.env->scratch, udp_size, &r->edns,
(int)(r->edns.bits & EDNS_DO), secure))
{
fptr_ok(fptr_whitelist_mesh_cb(r->cb));
(*r->cb)(r->cb_arg, LDNS_RCODE_SERVFAIL, r->buf,
sec_status_unchecked);
sec_status_unchecked, NULL);
} else {
fptr_ok(fptr_whitelist_mesh_cb(r->cb));
(*r->cb)(r->cb_arg, LDNS_RCODE_NOERROR, r->buf,
rep->security, reason);
}
else (*r->cb)(r->cb_arg, LDNS_RCODE_NOERROR, r->buf,
rep->security);
}
free(reason);
m->s.env->mesh->num_reply_addrs--;
}
@@ -780,6 +796,7 @@ int mesh_state_add_cb(struct mesh_state* s, struct edns_data* edns,
if(!r)
return 0;
r->buf = buf;
log_assert(fptr_whitelist_mesh_cb(cb)); /* early failure ifmissing*/
r->cb = cb;
r->cb_arg = cb_arg;
r->edns = *edns;
@@ -840,7 +857,7 @@ mesh_continue(struct mesh_area* mesh, struct mesh_state* mstate,
&mstate->s.qinfo);
s = module_error;
}
if(s == module_wait_module) {
if(s == module_wait_module || s == module_restart_next) {
/* start next module */
mstate->s.curmod++;
if(mesh->mods.num == mstate->s.curmod) {
@@ -850,6 +867,13 @@ mesh_continue(struct mesh_area* mesh, struct mesh_state* mstate,
mstate->s.curmod--;
return mesh_continue(mesh, mstate, module_error, ev);
}
if(s == module_restart_next) {
fptr_ok(fptr_whitelist_mod_clear(
mesh->mods.mod[mstate->s.curmod]->clear));
(*mesh->mods.mod[mstate->s.curmod]->clear)
(&mstate->s, mstate->s.curmod);
mstate->s.minfo[mstate->s.curmod] = NULL;
}
*ev = module_event_pass;
return 1;
}
+5 -4
View File
@@ -206,9 +206,10 @@ struct mesh_reply {
/**
* Mesh result callback func.
* called as func(cb_arg, rcode, buffer_with_reply, security);
* */
typedef void (*mesh_cb_func_t)(void*, int, ldns_buffer*, enum sec_status);
* called as func(cb_arg, rcode, buffer_with_reply, security, why_bogus);
*/
typedef void (*mesh_cb_func_t)(void*, int, ldns_buffer*, enum sec_status,
char*);
/**
* Callback to result routine
@@ -226,7 +227,7 @@ struct mesh_cb {
ldns_buffer* buf;
/** callback routine for results. if rcode != 0 buf has message.
* called as cb(cb_arg, rcode, buf);
* called as cb(cb_arg, rcode, buf, sec_state);
*/
mesh_cb_func_t cb;
/** user arg for callback */
+48 -11
View File
@@ -470,7 +470,7 @@ outside_network_create(struct comm_base *base, size_t bufsize,
int do_ip6, size_t num_tcp, struct infra_cache* infra,
struct ub_randstate* rnd, int use_caps_for_id, int* availports,
int numavailports, size_t unwanted_threshold,
void (*unwanted_action)(void*), void* unwanted_param)
void (*unwanted_action)(void*), void* unwanted_param, int do_udp)
{
struct outside_network* outnet = (struct outside_network*)
calloc(1, sizeof(struct outside_network));
@@ -490,6 +490,7 @@ outside_network_create(struct comm_base *base, size_t bufsize,
outnet->unwanted_action = unwanted_action;
outnet->unwanted_param = unwanted_param;
outnet->use_caps_for_id = use_caps_for_id;
outnet->do_udp = do_udp;
if(numavailports == 0) {
log_err("no outgoing ports available");
outside_network_delete(outnet);
@@ -754,12 +755,12 @@ 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);
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto, 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);
(struct sockaddr*)addr, addrlen, 1, inuse, &noproto, 0);
}
return fd;
}
@@ -892,8 +893,10 @@ randomize_and_send_udp(struct outside_network* outnet, struct pending* pend,
/* system calls to set timeout after sending UDP to make roundtrip
smaller. */
#ifndef S_SPLINT_S
tv.tv_sec = timeout/1000;
tv.tv_usec = (timeout%1000)*1000;
#endif
comm_timer_set(pend->timer, &tv);
return 1;
}
@@ -1009,8 +1012,10 @@ pending_tcp_query(struct outside_network* outnet, ldns_buffer* packet,
w->outnet = outnet;
w->cb = callback;
w->cb_arg = callback_arg;
#ifndef S_SPLINT_S
tv.tv_sec = timeout;
tv.tv_usec = 0;
#endif
comm_timer_set(w->timer, &tv);
if(pend) {
/* we have a buffer available right now */
@@ -1234,7 +1239,8 @@ serviced_udp_send(struct serviced_query* sq, ldns_buffer* buff)
&edns_lame_known, &rtt))
return 0;
if(sq->status == serviced_initial) {
if(edns_lame_known == 0 && rtt > 5000) {
if((vs != -1 || 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 "
@@ -1424,6 +1430,8 @@ static void
serviced_tcp_initiate(struct outside_network* outnet,
struct serviced_query* sq, ldns_buffer* buff)
{
verbose(VERB_ALGO, "initiate TCP query %s",
sq->status==serviced_query_TCP_EDNS?"EDNS":"");
serviced_encode(sq, buff, sq->status == serviced_query_TCP_EDNS);
sq->pending = pending_tcp_query(outnet, buff, &sq->addr,
sq->addrlen, TCP_AUTH_QUERY_TIMEOUT, serviced_tcp_callback,
@@ -1436,6 +1444,25 @@ serviced_tcp_initiate(struct outside_network* outnet,
}
}
/** Send serviced query over TCP return false on initial failure */
static int
serviced_tcp_send(struct serviced_query* sq, ldns_buffer* buff)
{
int vs, rtt;
uint8_t edns_lame_known;
if(!infra_host(sq->outnet->infra, &sq->addr, sq->addrlen,
*sq->outnet->now_secs, &vs, &edns_lame_known, &rtt))
return 0;
if(vs != -1)
sq->status = serviced_query_TCP_EDNS;
else sq->status = serviced_query_TCP;
serviced_encode(sq, buff, sq->status == serviced_query_TCP_EDNS);
sq->pending = pending_tcp_query(sq->outnet, buff, &sq->addr,
sq->addrlen, TCP_AUTH_QUERY_TIMEOUT, serviced_tcp_callback,
sq);
return sq->pending != NULL;
}
int
serviced_udp_callback(struct comm_point* c, void* arg, int error,
struct comm_reply* rep)
@@ -1526,7 +1553,7 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
(now.tv_sec == sq->last_sent_time.tv_sec &&
now.tv_usec > sq->last_sent_time.tv_usec)) {
/* convert from microseconds to milliseconds */
int roundtime = (now.tv_sec - sq->last_sent_time.tv_sec)*1000
int roundtime = ((int)now.tv_sec - (int)sq->last_sent_time.tv_sec)*1000
+ ((int)now.tv_usec - (int)sq->last_sent_time.tv_usec)/1000;
verbose(VERB_ALGO, "measured roundtrip at %d msec", roundtime);
log_assert(roundtime >= 0);
@@ -1579,12 +1606,22 @@ outnet_serviced_query(struct outside_network* outnet,
return NULL;
}
/* perform first network action */
if(!serviced_udp_send(sq, buff)) {
(void)rbtree_delete(outnet->serviced, sq);
free(sq->qbuf);
free(sq);
free(cb);
return NULL;
if(outnet->do_udp) {
if(!serviced_udp_send(sq, buff)) {
(void)rbtree_delete(outnet->serviced, sq);
free(sq->qbuf);
free(sq);
free(cb);
return NULL;
}
} else {
if(!serviced_tcp_send(sq, buff)) {
(void)rbtree_delete(outnet->serviced, sq);
free(sq->qbuf);
free(sq);
free(cb);
return NULL;
}
}
}
/* add callback to list of callbacks */
+4 -1
View File
@@ -92,6 +92,8 @@ struct outside_network {
/** linked list of available commpoints, unused file descriptors,
* for use as outgoing UDP ports. cp.fd=-1 in them. */
struct port_comm* unused_fds;
/** if udp is done */
int do_udp;
/** array of outgoing IP4 interfaces */
struct port_if* ip4_ifs;
@@ -347,6 +349,7 @@ struct serviced_query {
* @param unwanted_threshold: when to take defensive action.
* @param unwanted_action: the action to take.
* @param unwanted_param: user parameter to action.
* @param do_udp: if udp is done.
* @return: the new structure (with no pending answers) or NULL on error.
*/
struct outside_network* outside_network_create(struct comm_base* base,
@@ -354,7 +357,7 @@ struct outside_network* outside_network_create(struct comm_base* base,
int do_ip4, int do_ip6, size_t num_tcp, struct infra_cache* infra,
struct ub_randstate* rnd, int use_caps_for_id, int* availports,
int numavailports, size_t unwanted_threshold,
void (*unwanted_action)(void*), void* unwanted_param);
void (*unwanted_action)(void*), void* unwanted_param, int do_udp);
/**
* Delete outside_network structure.
+10
View File
@@ -135,11 +135,13 @@ print_option(struct config_file* cfg, const char* opt)
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)
@@ -175,8 +177,12 @@ print_option(struct config_file* cfg, const char* opt)
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)
@@ -191,6 +197,7 @@ print_option(struct config_file* cfg, const char* opt)
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)
@@ -436,6 +443,9 @@ morechecks(struct config_file* cfg, const char* fname)
fatal_exit("ip4 and ip6 are both disabled, pointless");
if(!cfg->do_udp && !cfg->do_tcp)
fatal_exit("udp and tcp are both disabled, pointless");
if(cfg->edns_buffer_size > cfg->msg_buffer_size)
fatal_exit("edns-buffer-size larger than msg-buffer-size, "
"answers will not fit in processing buffer");
if(cfg->chrootdir && cfg->chrootdir[0] &&
cfg->chrootdir[strlen(cfg->chrootdir)-1] == '/')
+9 -9
View File
@@ -65,20 +65,20 @@ usage()
printf(" stats print statistics\n");
printf(" stats_noreset peek at statistics\n");
printf(" status display status of server\n");
printf(" verbosity [number] change logging detail\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");
printf(" verbosity <number> change logging detail\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");
printf(" local_data www.example.com A 192.0.2.1\n");
printf(" local_data_remove [name] remove local RR data from name\n");
printf(" local_data_remove <name> remove local RR data from name\n");
printf(" dump_cache print cache to stdout\n");
printf(" load_cache load cache from stdin\n");
printf(" lookup [name] print nameservers for name\n");
printf(" flush [name] flushes common types for name from cache\n");
printf(" lookup <name> print nameservers for name\n");
printf(" flush <name> flushes common types for name from cache\n");
printf(" types: A, AAAA, MX, PTR, NS,\n");
printf(" SOA, CNAME, DNAME, SRV, NAPTR\n");
printf(" flush_type [name] [type] flush name, type from cache\n");
printf(" flush_zone [name] flush everything at or under name\n");
printf(" flush_type <name> <type> flush name, type from cache\n");
printf(" flush_zone <name> flush everything at or under name\n");
printf(" from rr and dnssec caches\n");
printf(" flush_stats flush statistics, make zero\n");
printf(" flush_requestlist drop queries that are worked on\n");
+41 -14
View File
@@ -41,6 +41,13 @@
*/
#include "config.h"
/* remove alloc checks, not in this part of the code */
#ifdef UNBOUND_ALLOC_STATS
#undef malloc
#undef calloc
#undef free
#undef realloc
#endif
#include "libunbound/unbound.h"
#include <ldns/ldns.h>
@@ -193,24 +200,18 @@ secure_str(struct ub_result* result)
static void
pretty_type(char* s, size_t len, int t)
{
const ldns_rr_descriptor *d = ldns_rr_descript((uint16_t)t);
if(d) {
snprintf(s, len, "%s", d->_name);
} else {
snprintf(s, len, "TYPE%d", t);
}
char* d = ldns_rr_type2str(t);
snprintf(s, len, "%s", d);
free(d);
}
/** nice string for class */
static void
pretty_class(char* s, size_t len, int c)
{
ldns_lookup_table *cl = ldns_lookup_by_id(ldns_rr_classes, c);
if(cl) {
snprintf(s, len, "%s", cl->name);
} else {
snprintf(s, len, "CLASS%d", c);
}
char* d = ldns_rr_class2str(c);
snprintf(s, len, "%s", d);
free(d);
}
/** nice string for rcode */
@@ -297,6 +298,8 @@ pretty_output(char* q, int t, int c, struct ub_result* result, int docname)
if(verb > 0)
printf(" %s", secstatus);
printf("\n");
if(result->bogus && result->why_bogus)
printf("%s\n", result->why_bogus);
return;
}
if(docname && result->canonname &&
@@ -324,10 +327,31 @@ pretty_output(char* q, int t, int c, struct ub_result* result, int docname)
printf(" has no domain name ptr");
else if(t == LDNS_RR_TYPE_MX)
printf(" has no mail handler record");
else printf(" has no %s record", tstr);
else if(t == LDNS_RR_TYPE_ANY) {
ldns_pkt* p = NULL;
if(ldns_wire2pkt(&p, result->answer_packet,
(size_t)result->answer_len)==LDNS_STATUS_OK){
if(ldns_rr_list_rr_count(
ldns_pkt_answer(p)) == 0)
printf(" has no records\n");
else {
printf(" ANY:\n");
ldns_rr_list_print(stdout,
ldns_pkt_answer(p));
}
} else {
fprintf(stderr, "could not parse "
"reply packet to ANY query\n");
exit(1);
}
ldns_pkt_free(p);
} else printf(" has no %s record", tstr);
printf(" %s\n", secstatus);
}
/* else: emptiness to indicate no data */
if(result->bogus && result->why_bogus)
printf("%s\n", result->why_bogus);
return;
}
i=0;
@@ -339,6 +363,8 @@ pretty_output(char* q, int t, int c, struct ub_result* result, int docname)
(size_t)result->len[i]);
i++;
}
if(result->bogus && result->why_bogus)
printf("%s\n", result->why_bogus);
}
/** perform a lookup and printout return if domain existed */
@@ -433,7 +459,6 @@ int main(int argc, char* argv[])
debuglevel++;
if(debuglevel < 2)
debuglevel = 2; /* at least VERB_DETAIL */
check_ub_res(ub_ctx_debuglevel(ctx, debuglevel));
break;
case 'r':
check_ub_res(ub_ctx_resolvconf(ctx, "/etc/resolv.conf"));
@@ -459,6 +484,8 @@ int main(int argc, char* argv[])
usage();
}
}
if(debuglevel != 0) /* set after possible -C options */
check_ub_res(ub_ctx_debuglevel(ctx, debuglevel));
argc -= optind;
argv += optind;
if(argc != 1)
+26
View File
@@ -42,6 +42,7 @@
*/
#include "config.h"
#include "util/log.h"
#include "services/mesh.h"
struct comm_reply;
struct comm_point;
struct module_qstate;
@@ -180,6 +181,20 @@ void libworker_handle_control_cmd(struct tube* ATTR_UNUSED(tube),
log_assert(0);
}
void libworker_fg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
char* ATTR_UNUSED(why_bogus))
{
log_assert(0);
}
void libworker_bg_done_cb(void* ATTR_UNUSED(arg), int ATTR_UNUSED(rcode),
ldns_buffer* ATTR_UNUSED(buf), enum sec_status ATTR_UNUSED(s),
char* ATTR_UNUSED(why_bogus))
{
log_assert(0);
}
int context_query_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
{
log_assert(0);
@@ -191,6 +206,11 @@ void worker_stat_timer_cb(void* ATTR_UNUSED(arg))
log_assert(0);
}
void worker_probe_timer_cb(void* ATTR_UNUSED(arg))
{
log_assert(0);
}
/** keep track of lock id in lock-verify application */
struct order_id {
/** the thread id that created it */
@@ -215,3 +235,9 @@ codeline_cmp(const void* a, const void* b)
{
return strcmp((const char*)a, (const char*)b);
}
int replay_var_compare(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
{
log_assert(0);
return 0;
}
+8 -6
View File
@@ -360,7 +360,7 @@ service_send(struct ringbuf* ring, struct timeval* now, ldns_buffer* pkt,
(unsigned)tv.tv_sec, (unsigned)tv.tv_usec);
log_addr(1, "from client", &p->addr, p->addr_len);
/* send it */
sent = sendto(p->s, ldns_buffer_begin(pkt),
sent = sendto(p->s, (void*)ldns_buffer_begin(pkt),
ldns_buffer_limit(pkt), 0,
(struct sockaddr*)srv_addr, srv_len);
if(sent == -1) {
@@ -384,7 +384,7 @@ do_proxy(struct proxy* p, int retsock, ldns_buffer* pkt)
int i;
ssize_t r;
for(i=0; i<TRIES_PER_SELECT; i++) {
r = recv(p->s, ldns_buffer_begin(pkt),
r = recv(p->s, (void*)ldns_buffer_begin(pkt),
ldns_buffer_capacity(pkt), 0);
if(r == -1) {
#ifndef USE_WINSOCK
@@ -403,8 +403,8 @@ do_proxy(struct proxy* p, int retsock, ldns_buffer* pkt)
log_addr(1, "return reply to client", &p->addr, p->addr_len);
/* send reply back to the real client */
p->numreturn++;
r = sendto(retsock, ldns_buffer_begin(pkt), (size_t)r, 0,
(struct sockaddr*)&p->addr, p->addr_len);
r = sendto(retsock, (void*)ldns_buffer_begin(pkt), (size_t)r,
0, (struct sockaddr*)&p->addr, p->addr_len);
if(r == -1) {
#ifndef USE_WINSOCK
log_err("sendto: %s", strerror(errno));
@@ -492,7 +492,7 @@ service_recv(int s, struct ringbuf* ring, ldns_buffer* pkt,
struct proxy* p;
for(i=0; i<TRIES_PER_SELECT; i++) {
from_len = (socklen_t)sizeof(from);
len = recvfrom(s, ldns_buffer_begin(pkt),
len = recvfrom(s, (void*)ldns_buffer_begin(pkt),
ldns_buffer_capacity(pkt), 0,
(struct sockaddr*)&from, &from_len);
if(len < 0) {
@@ -636,7 +636,7 @@ tcp_relay_read(int s, struct tcp_send_list** first,
struct timeval* delay, ldns_buffer* pkt)
{
struct tcp_send_list* item;
ssize_t r = recv(s, ldns_buffer_begin(pkt),
ssize_t r = recv(s, (void*)ldns_buffer_begin(pkt),
ldns_buffer_capacity(pkt), 0);
if(r == -1) {
#ifndef USE_WINSOCK
@@ -991,8 +991,10 @@ service(const char* bind_str, int bindport, const char* serv_str,
struct timeval delay, reuse;
ldns_buffer* pkt;
int i, s, listen_s;
#ifndef S_SPLINT_S
delay.tv_sec = delay_msec / 1000;
delay.tv_usec = (delay_msec % 1000)*1000;
#endif
reuse = delay; /* reuse is max(4*delay, 1 second) */
dl_tv_add(&reuse, &delay);
dl_tv_add(&reuse, &delay);
+173 -13
View File
@@ -51,11 +51,13 @@
#include "util/data/msgparse.h"
#include "util/data/msgreply.h"
#include "util/data/msgencode.h"
#include "util/config_file.h"
#include "services/listen_dnsport.h"
#include "services/outside_network.h"
#include "testcode/replay.h"
#include "testcode/ldns-testpkts.h"
#include "util/log.h"
#include "util/fptr_wlist.h"
#include <signal.h>
struct worker;
@@ -69,13 +71,25 @@ timeval_add(struct timeval* d, const struct timeval* add)
#ifndef S_SPLINT_S
d->tv_sec += add->tv_sec;
d->tv_usec += add->tv_usec;
while(d->tv_usec > 1000000 ) {
if(d->tv_usec > 1000000) {
d->tv_usec -= 1000000;
d->tv_sec++;
}
#endif
}
void
fake_temp_file(const char* adj, const char* id, char* buf, size_t len)
{
#ifdef USE_WINSOCK
snprintf(buf, len, "testbound_%u%s%s.tmp",
(unsigned)getpid(), adj, id);
#else
snprintf(buf, len, "/tmp/testbound_%u%s%s.tmp",
(unsigned)getpid(), adj, id);
#endif
}
void
fake_event_init(struct replay_scenario* scen)
{
@@ -116,7 +130,10 @@ repevt_string(enum replay_event_type t)
case repevt_time_passes: return "TIME_PASSES";
case repevt_back_reply: return "REPLY";
case repevt_back_query: return "CHECK_OUT_QUERY";
case repevt_autotrust_check: return "CHECK_AUTOTRUST";
case repevt_error: return "ERROR";
case repevt_assign: return "ASSIGN";
case repevt_traffic: return "TRAFFIC";
default: return "UNKNOWN";
}
}
@@ -424,17 +441,106 @@ fake_pending_callback(struct replay_runtime* runtime,
ldns_buffer_free(c.buffer);
}
/** pass time */
static void
moment_assign(struct replay_runtime* runtime, struct replay_moment* mom)
{
char* value = macro_process(runtime->vars, runtime, mom->string);
if(!value)
fatal_exit("could not process macro step %d", mom->time_step);
log_info("assign %s = %s", mom->variable, value);
if(!macro_assign(runtime->vars, mom->variable, value))
fatal_exit("out of memory storing macro");
free(value);
if(verbosity >= VERB_ALGO)
macro_print_debug(runtime->vars);
}
/** pass time */
static void
time_passes(struct replay_runtime* runtime, struct replay_moment* mom)
{
timeval_add(&runtime->now_tv, &mom->elapse);
struct fake_timer *t;
struct timeval tv = mom->elapse;
if(mom->string) {
char* xp = macro_process(runtime->vars, runtime, mom->string);
double sec;
if(!xp) fatal_exit("could not macro expand %s", mom->string);
verbose(VERB_ALGO, "EVAL %s", mom->string);
sec = atof(xp);
free(xp);
#ifndef S_SPLINT_S
tv.tv_sec = sec;
tv.tv_usec = (int)((sec - (double)tv.tv_sec) *1000000. + 0.5);
#endif
}
timeval_add(&runtime->now_tv, &tv);
runtime->now_secs = (uint32_t)runtime->now_tv.tv_sec;
#ifndef S_SPLINT_S
log_info("elapsed %d.%6.6d now %d.%6.6d",
(int)mom->elapse.tv_sec, (int)mom->elapse.tv_usec,
(int)tv.tv_sec, (int)tv.tv_usec,
(int)runtime->now_tv.tv_sec, (int)runtime->now_tv.tv_usec);
#endif
/* see if any timers have fired; and run them */
while( (t=replay_get_oldest_timer(runtime)) ) {
t->enabled = 0;
log_info("fake_timer callback");
fptr_ok(fptr_whitelist_comm_timer(t->cb));
(*t->cb)(t->cb_arg);
}
}
/** check autotrust file contents */
static void
autotrust_check(struct replay_runtime* runtime, struct replay_moment* mom)
{
char name[1024], line[1024];
FILE *in;
int lineno = 0, oke=1;
char* expanded;
struct config_strlist* p;
line[sizeof(line)-1] = 0;
log_assert(mom->autotrust_id);
fake_temp_file("_auto_", mom->autotrust_id, name, sizeof(name));
in = fopen(name, "r");
if(!in) fatal_exit("could not open %s: %s", name, strerror(errno));
for(p=mom->file_content; p; p=p->next) {
lineno++;
if(!fgets(line, (int)sizeof(line)-1, in)) {
log_err("autotrust check failed, could not read line");
log_err("file %s, line %d", name, lineno);
log_err("should be: %s", p->str);
fatal_exit("autotrust_check failed");
}
if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
expanded = macro_process(runtime->vars, runtime, p->str);
if(!expanded)
fatal_exit("could not expand macro line %d", lineno);
if(verbosity >= 7 && strcmp(p->str, expanded) != 0)
log_info("expanded '%s' to '%s'", p->str, expanded);
if(strcmp(expanded, line) != 0) {
log_err("mismatch in file %s, line %d", name, lineno);
log_err("file has : %s", line);
log_err("should be: %s", expanded);
free(expanded);
oke = 0;
continue;
}
free(expanded);
fprintf(stderr, "%s:%2d ok : %s\n", name, lineno, line);
}
if(fgets(line, (int)sizeof(line)-1, in)) {
log_err("autotrust check failed, extra lines in %s after %d",
name, lineno);
do {
fprintf(stderr, "file has: %s", line);
} while(fgets(line, (int)sizeof(line)-1, in));
oke = 0;
}
fclose(in);
if(!oke)
fatal_exit("autotrust_check STEP %d failed", mom->time_step);
log_info("autotrust %s is OK", mom->autotrust_id);
}
/**
@@ -504,6 +610,17 @@ do_moment_and_advance(struct replay_runtime* runtime)
time_passes(runtime, runtime->now);
advance_moment(runtime);
break;
case repevt_autotrust_check:
autotrust_check(runtime, runtime->now);
advance_moment(runtime);
break;
case repevt_assign:
moment_assign(runtime, runtime->now);
advance_moment(runtime);
break;
case repevt_traffic:
advance_moment(runtime);
break;
default:
fatal_exit("testbound: unknown event type %d",
runtime->now->evt_type);
@@ -516,7 +633,7 @@ run_scenario(struct replay_runtime* runtime)
{
struct entry* entry = NULL;
struct fake_pending* pending = NULL;
int max_rounds = 50;
int max_rounds = 5000;
int rounds = 0;
runtime->now = runtime->scenario->mom_first;
log_info("testbound: entering fake runloop");
@@ -602,6 +719,8 @@ comm_base_create(int ATTR_UNUSED(sigs))
struct replay_runtime* runtime = (struct replay_runtime*)
calloc(1, sizeof(struct replay_runtime));
runtime->scenario = saved_scenario;
runtime->vars = macro_store_create();
if(!runtime->vars) fatal_exit("out of memory");
return (struct comm_base*)runtime;
}
@@ -611,6 +730,7 @@ comm_base_delete(struct comm_base* b)
struct replay_runtime* runtime = (struct replay_runtime*)b;
struct fake_pending* p, *np;
struct replay_answer* a, *na;
struct fake_timer* t, *nt;
if(!runtime)
return;
runtime->scenario= NULL;
@@ -626,6 +746,13 @@ comm_base_delete(struct comm_base* b)
delete_replay_answer(a);
a = na;
}
t = runtime->timer_list;
while(t) {
nt = t->next;
free(t);
t = nt;
}
macro_store_delete(runtime->vars);
free(runtime);
}
@@ -726,7 +853,8 @@ outside_network_create(struct comm_base* base, size_t bufsize,
struct ub_randstate* ATTR_UNUSED(rnd),
int ATTR_UNUSED(use_caps_for_id), int* ATTR_UNUSED(availports),
int ATTR_UNUSED(numavailports), size_t ATTR_UNUSED(unwanted_threshold),
void (*unwanted_action)(void*), void* ATTR_UNUSED(unwanted_param))
void (*unwanted_action)(void*), void* ATTR_UNUSED(unwanted_param),
int ATTR_UNUSED(do_udp))
{
struct outside_network* outnet = calloc(1,
sizeof(struct outside_network));
@@ -1138,25 +1266,57 @@ int serviced_cmp(const void* ATTR_UNUSED(a), const void* ATTR_UNUSED(b))
return 0;
}
/* no statistics timers in testbound */
struct comm_timer* comm_timer_create(struct comm_base* ATTR_UNUSED(base),
void (*cb)(void*), void* ATTR_UNUSED(cb_arg))
/* timers in testbound for autotrust. statistics tested in tpkg. */
struct comm_timer* comm_timer_create(struct comm_base* base,
void (*cb)(void*), void* cb_arg)
{
(void)cb;
return malloc(1);
struct replay_runtime* runtime = (struct replay_runtime*)base;
struct fake_timer* t = (struct fake_timer*)calloc(1, sizeof(*t));
t->cb = cb;
t->cb_arg = cb_arg;
fptr_ok(fptr_whitelist_comm_timer(t->cb)); /* check in advance */
t->runtime = runtime;
t->next = runtime->timer_list;
runtime->timer_list = t;
return (struct comm_timer*)t;
}
void comm_timer_disable(struct comm_timer* ATTR_UNUSED(timer))
void comm_timer_disable(struct comm_timer* timer)
{
struct fake_timer* t = (struct fake_timer*)timer;
log_info("fake timer disabled");
t->enabled = 0;
}
void comm_timer_set(struct comm_timer* ATTR_UNUSED(timer),
struct timeval* ATTR_UNUSED(tv))
void comm_timer_set(struct comm_timer* timer, struct timeval* tv)
{
struct fake_timer* t = (struct fake_timer*)timer;
t->enabled = 1;
t->tv = *tv;
log_info("fake timer set %d.%6.6d",
(int)t->tv.tv_sec, (int)t->tv.tv_usec);
timeval_add(&t->tv, &t->runtime->now_tv);
}
void comm_timer_delete(struct comm_timer* timer)
{
struct fake_timer* t = (struct fake_timer*)timer;
struct fake_timer** pp, *p;
if(!t) return;
/* remove from linked list */
pp = &t->runtime->timer_list;
p = t->runtime->timer_list;
while(p) {
if(p == t) {
/* snip from list */
*pp = p->next;
break;
}
pp = &p->next;
p = p->next;
}
free(timer);
}
+9
View File
@@ -63,4 +63,13 @@ void fake_event_init(struct replay_scenario* scen);
*/
void fake_event_cleanup();
/**
* Get filename to store temporary config stuff. The pid is added. in /tmp.
* @param adj: adjective, like "_cfg_", "_auto_"
* @param id: identifier, like "example.com".
* @param buf: where to store.
* @param len: length of buf.
*/
void fake_temp_file(const char* adj, const char* id, char* buf, size_t len);
#endif /* TESTCODE_FAKE_EVENT_H */
+19 -15
View File
@@ -80,16 +80,18 @@ match(char* line)
/* f.e.:
* [1187340064] unbound[24604:0] info: ul/rb.c:81 r_create malloc(12)
* 0123456789 123456789 123456789 123456789
* But now also:
* Sep 16 15:18:20 unbound[1:0] info: ul/nh.c:143 memdup malloc(11)
*/
if(strlen(line) < 36) /* up to 'info: ' */
if(strlen(line) < 32) /* up to 'info: ' */
return 0;
if(strncmp(line+30, "info: ", 6) != 0)
if(!strstr(line, " info: "))
return 0;
if(strncmp(line+36, "stat ", 5) == 0)
if(strstr(line, "info: stat "))
return 0; /* skip the hex dumps */
if(strstr(line+36, "malloc("))
if(strstr(line+30, "malloc("))
return 1;
else if(strstr(line+36, "calloc("))
else if(strstr(line+30, "calloc("))
return 1;
/* skip reallocs */
return 0;
@@ -123,12 +125,13 @@ read_malloc_stat(char* line, rbtree_t* tree)
int skip = 0;
long num = 0;
struct codeline* cl = 0;
if(sscanf(line+36, "%s %s %n", codeline, name, &skip) != 2) {
printf("%s\n%s\n", line, line+36);
line = strstr(line, "info: ")+6;
if(sscanf(line, "%s %s %n", codeline, name, &skip) != 2) {
printf("%s\n", line);
fatal_exit("unhandled malloc");
}
if(sscanf(line+36+skip+7, "%ld", &num) != 1) {
printf("%s\n%s\n", line, line+36+skip+7);
if(sscanf(line+skip+7, "%ld", &num) != 1) {
printf("%s\n%s\n", line, line+skip+7);
fatal_exit("unhandled malloc");
}
cl = get_codeline(tree, codeline, name);
@@ -147,12 +150,13 @@ read_calloc_stat(char* line, rbtree_t* tree)
int skip = 0;
long num = 0, sz = 0;
struct codeline* cl = 0;
if(sscanf(line+36, "%s %s %n", codeline, name, &skip) != 2) {
printf("%s\n%s\n", line, line+36);
line = strstr(line, "info: ")+6;
if(sscanf(line, "%s %s %n", codeline, name, &skip) != 2) {
printf("%s\n", line);
fatal_exit("unhandled calloc");
}
if(sscanf(line+36+skip+7, "%ld, %ld", &num, &sz) != 2) {
printf("%s\n%s\n", line, line+36+skip+7);
if(sscanf(line+skip+7, "%ld, %ld", &num, &sz) != 2) {
printf("%s\n%s\n", line, line+skip+7);
fatal_exit("unhandled calloc");
}
@@ -197,9 +201,9 @@ readfile(rbtree_t* tree, const char* fname)
if(!match(buf))
continue;
else if(strstr(buf+36, "malloc("))
else if(strstr(buf+30, "malloc("))
read_malloc_stat(buf, tree);
else if(strstr(buf+36, "calloc("))
else if(strstr(buf+30, "calloc("))
read_calloc_stat(buf, tree);
else {
printf("%s\n", buf);
+2 -2
View File
@@ -272,7 +272,7 @@ static void
perfsend(struct perfinfo* info, size_t n, struct timeval* now)
{
ssize_t r;
r = sendto(info->io[n].fd, info->qlist_data[info->qlist_idx],
r = sendto(info->io[n].fd, (void*)info->qlist_data[info->qlist_idx],
info->qlist_len[info->qlist_idx], 0,
(struct sockaddr*)&info->dest, info->destlen);
/*log_hex("send", info->qlist_data[info->qlist_idx],
@@ -299,7 +299,7 @@ static void
perfreply(struct perfinfo* info, size_t n, struct timeval* now)
{
ssize_t r;
r = recv(info->io[n].fd, ldns_buffer_begin(info->buf),
r = recv(info->io[n].fd, (void*)ldns_buffer_begin(info->buf),
ldns_buffer_capacity(info->buf), 0);
if(r == -1) {
#ifndef USE_WINSOCK
+612
View File
@@ -42,12 +42,41 @@
#include "config.h"
#include "util/log.h"
#include "util/net_help.h"
#include "util/config_file.h"
#include "testcode/replay.h"
#include "testcode/ldns-testpkts.h"
#include "testcode/fake_event.h"
/** max length of lines in file */
#define MAX_LINE_LEN 10240
/**
* Expand a macro
* @param store: value storage
* @param runtime: replay runtime for other stuff.
* @param text: the macro text, after the ${, Updated to after the } when
* done (successfully).
* @return expanded text, malloced. NULL on failure.
*/
static char* macro_expand(rbtree_t* store,
struct replay_runtime* runtime, char** text);
/** compare of time values */
static int
timeval_smaller(const struct timeval* x, const struct timeval* y)
{
#ifndef S_SPLINT_S
if(x->tv_sec < y->tv_sec)
return 1;
else if(x->tv_sec == y->tv_sec) {
if(x->tv_usec <= y->tv_usec)
return 1;
else return 0;
}
else return 0;
#endif
}
/** parse keyword in string.
* @param line: if found, the line is advanced to after the keyword.
* @param keyword: string.
@@ -73,6 +102,10 @@ replay_moment_delete(struct replay_moment* mom)
if(mom->match) {
delete_entry(mom->match);
}
free(mom->autotrust_id);
free(mom->string);
free(mom->variable);
config_delstrlist(mom->file_content);
free(mom);
}
@@ -173,6 +206,51 @@ replay_range_read(char* remain, FILE* in, const char* name, int* lineno,
return NULL;
}
/** Read FILE match content */
static void
read_file_content(FILE* in, int* lineno, struct replay_moment* mom)
{
char line[MAX_LINE_LEN];
char* remain = line;
struct config_strlist** last = &mom->file_content;
line[MAX_LINE_LEN-1]=0;
if(!fgets(line, MAX_LINE_LEN-1, in))
fatal_exit("FILE_BEGIN expected at line %d", *lineno);
if(!parse_keyword(&remain, "FILE_BEGIN"))
fatal_exit("FILE_BEGIN expected at line %d", *lineno);
while(fgets(line, MAX_LINE_LEN-1, in)) {
(*lineno)++;
if(strncmp(line, "FILE_END", 8) == 0) {
return;
}
if(line[0]) line[strlen(line)-1] = 0; /* remove newline */
if(!cfg_strlist_insert(last, strdup(line)))
fatal_exit("malloc failure");
last = &( (*last)->next );
}
fatal_exit("no FILE_END in input file");
}
/** read assign step info */
static void
read_assign_step(char* remain, struct replay_moment* mom)
{
char buf[1024];
char eq;
int skip;
buf[sizeof(buf)-1]=0;
if(sscanf(remain, " %1023s %c %n", buf, &eq, &skip) != 2)
fatal_exit("cannot parse assign: %s", remain);
mom->variable = strdup(buf);
if(eq != '=')
fatal_exit("no '=' in assign: %s", remain);
remain += skip;
if(remain[0]) remain[strlen(remain)-1]=0; /* remove newline */
mom->string = strdup(remain);
if(!mom->variable || !mom->string)
fatal_exit("out of memory");
}
/**
* Read a replay moment 'STEP' from file.
* @param remain: Rest of line (after STEP keyword).
@@ -223,8 +301,33 @@ replay_moment_read(char* remain, FILE* in, const char* name, int* lineno,
mom->evt_type = repevt_timeout;
} else if(parse_keyword(&remain, "TIME_PASSES")) {
mom->evt_type = repevt_time_passes;
while(isspace((int)*remain))
remain++;
if(parse_keyword(&remain, "EVAL")) {
while(isspace((int)*remain))
remain++;
mom->string = strdup(remain);
if(!mom->string) fatal_exit("out of memory");
if(strlen(mom->string)>0)
mom->string[strlen(mom->string)-1]=0;
remain += strlen(mom->string);
}
} else if(parse_keyword(&remain, "CHECK_AUTOTRUST")) {
mom->evt_type = repevt_autotrust_check;
while(isspace((int)*remain))
remain++;
if(strlen(remain)>0 && remain[strlen(remain)-1]=='\n')
remain[strlen(remain)-1] = 0;
mom->autotrust_id = strdup(remain);
if(!mom->autotrust_id) fatal_exit("out of memory");
read_file_content(in, lineno, mom);
} else if(parse_keyword(&remain, "ERROR")) {
mom->evt_type = repevt_error;
} else if(parse_keyword(&remain, "TRAFFIC")) {
mom->evt_type = repevt_traffic;
} else if(parse_keyword(&remain, "ASSIGN")) {
mom->evt_type = repevt_assign;
read_assign_step(remain, mom);
} else {
log_err("%d: unknown event type %s", *lineno, remain);
free(mom);
@@ -384,3 +487,512 @@ replay_scenario_delete(struct replay_scenario* scen)
}
free(scen);
}
/** fetch oldest timer in list that is enabled */
static struct fake_timer*
first_timer(struct replay_runtime* runtime)
{
struct fake_timer* p, *res = NULL;
for(p=runtime->timer_list; p; p=p->next) {
if(!p->enabled)
continue;
if(!res)
res = p;
else if(timeval_smaller(&p->tv, &res->tv))
res = p;
}
return res;
}
struct fake_timer*
replay_get_oldest_timer(struct replay_runtime* runtime)
{
struct fake_timer* t = first_timer(runtime);
if(t && timeval_smaller(&t->tv, &runtime->now_tv))
return t;
return NULL;
}
int
replay_var_compare(const void* a, const void* b)
{
struct replay_var* x = (struct replay_var*)a;
struct replay_var* y = (struct replay_var*)b;
return strcmp(x->name, y->name);
}
rbtree_t*
macro_store_create(void)
{
return rbtree_create(&replay_var_compare);
}
/** helper function to delete macro values */
static void
del_macro(rbnode_t* x, void* ATTR_UNUSED(arg))
{
struct replay_var* v = (struct replay_var*)x;
free(v->name);
free(v->value);
free(v);
}
void
macro_store_delete(rbtree_t* store)
{
if(!store)
return;
traverse_postorder(store, del_macro, NULL);
free(store);
}
/** return length of macro */
static size_t
macro_length(char* text)
{
/* we are after ${, looking for } */
int depth = 0;
size_t len = 0;
while(*text) {
len++;
if(*text == '}') {
if(depth == 0)
break;
depth--;
} else if(text[0] == '$' && text[1] == '{') {
depth++;
}
text++;
}
return len;
}
/** insert new stuff at start of buffer */
static int
do_buf_insert(char* buf, size_t remain, char* after, char* inserted)
{
char* save = strdup(after);
size_t len;
if(!save) return 0;
if(strlen(inserted) > remain) {
free(save);
return 0;
}
len = strlcpy(buf, inserted, remain);
buf += len;
remain -= len;
(void)strlcpy(buf, save, remain);
free(save);
return 1;
}
/** do macro recursion */
static char*
do_macro_recursion(rbtree_t* store, struct replay_runtime* runtime,
char* at, size_t remain)
{
char* after = at+2;
char* expand = macro_expand(store, runtime, &after);
if(!expand)
return NULL; /* expansion failed */
if(!do_buf_insert(at, remain, after, expand)) {
free(expand);
return NULL;
}
free(expand);
return at; /* and parse over the expanded text to see if again */
}
/** get var from store */
struct replay_var*
macro_getvar(rbtree_t* store, char* name)
{
struct replay_var k;
k.node.key = &k;
k.name = name;
return (struct replay_var*)rbtree_search(store, &k);
}
/** do macro variable */
static char*
do_macro_variable(rbtree_t* store, char* buf, size_t remain)
{
struct replay_var* v;
char* at = buf+1;
char* name = at;
char sv;
if(at[0]==0)
return NULL; /* no variable name after $ */
while(*at && (isalnum((int)*at) || *at=='_')) {
at++;
}
/* terminator, we are working in macro_expand() buffer */
sv = *at;
*at = 0;
v = macro_getvar(store, name);
*at = sv;
if(!v) {
log_err("variable is not defined: $%s", name);
return NULL; /* variable undefined is error for now */
}
/* insert the variable contents */
if(!do_buf_insert(buf, remain, at, v->value))
return NULL;
return buf; /* and expand the variable contents */
}
/** do ctime macro on argument */
static char*
do_macro_ctime(char* arg)
{
char buf[32];
time_t tt = (time_t)atoi(arg);
if(tt == 0 && strcmp(arg, "0") != 0) {
log_err("macro ctime: expected number, not: %s", arg);
return NULL;
}
ctime_r(&tt, buf);
if(buf[0]) buf[strlen(buf)-1]=0; /* remove trailing newline */
return strdup(buf);
}
/** perform arithmetic operator */
static double
perform_arith(double x, char op, double y, double* res)
{
switch(op) {
case '+':
*res = x+y;
break;
case '-':
*res = x-y;
break;
case '/':
*res = x/y;
break;
case '*':
*res = x*y;
break;
default:
return 0;
}
return 1;
}
/** do macro arithmetic on two numbers and operand */
static char*
do_macro_arith(char* orig, size_t remain, char** arithstart)
{
double x, y, result;
char operator;
int skip;
char buf[32];
char* at;
/* not yet done? we want number operand number expanded first. */
if(!*arithstart) {
/* remember start pos of expr, skip the first number */
at = orig;
*arithstart = at;
while(*at && (isdigit((int)*at) || *at == '.'))
at++;
return at;
}
/* move back to start */
remain += (size_t)(orig - *arithstart);
at = *arithstart;
/* parse operands */
if(sscanf(at, " %lf %c %lf%n", &x, &operator, &y, &skip) != 3) {
*arithstart = NULL;
return do_macro_arith(orig, remain, arithstart);
}
if(isdigit((int)operator)) {
*arithstart = orig;
return at+skip; /* do nothing, but setup for later number */
}
/* calculate result */
if(!perform_arith(x, operator, y, &result)) {
log_err("unknown operator: %s", at);
return NULL;
}
/* put result back in buffer */
snprintf(buf, sizeof(buf), "%.12g", result);
if(!do_buf_insert(at, remain, at+skip, buf))
return NULL;
/* the result can be part of another expression, restart that */
*arithstart = NULL;
return at;
}
/** Do range macro on expanded buffer */
static char*
do_macro_range(char* buf)
{
double x, y, z;
if(sscanf(buf, " %lf %lf %lf", &x, &y, &z) != 3) {
log_err("range func requires 3 args: %s", buf);
return NULL;
}
if(x <= y && y <= z) {
char res[1024];
snprintf(res, sizeof(res), "%.24g", y);
return strdup(res);
}
fatal_exit("value %.24g not in range [%.24g, %.24g]", y, x, z);
return NULL;
}
static char*
macro_expand(rbtree_t* store, struct replay_runtime* runtime, char** text)
{
char buf[10240];
char* at = *text;
size_t len = macro_length(at);
int dofunc = 0;
char* arithstart = NULL;
if(len >= sizeof(buf))
return NULL; /* too long */
buf[0] = 0;
(void)strlcpy(buf, at, len+1-1); /* do not copy last '}' character */
at = buf;
/* check for functions */
if(strcmp(buf, "time") == 0) {
snprintf(buf, sizeof(buf), "%u", (unsigned)runtime->now_secs);
*text += len;
return strdup(buf);
} else if(strcmp(buf, "timeout") == 0) {
uint32_t res = 0;
struct fake_timer* t = first_timer(runtime);
if(t && (uint32_t)t->tv.tv_sec >= runtime->now_secs)
res = (uint32_t)t->tv.tv_sec - runtime->now_secs;
snprintf(buf, sizeof(buf), "%u", (unsigned)res);
*text += len;
return strdup(buf);
} else if(strncmp(buf, "ctime ", 6) == 0 ||
strncmp(buf, "ctime\t", 6) == 0) {
at += 6;
dofunc = 1;
} else if(strncmp(buf, "range ", 6) == 0 ||
strncmp(buf, "range\t", 6) == 0) {
at += 6;
dofunc = 1;
}
/* actual macro text expansion */
while(*at) {
size_t remain = sizeof(buf)-strlen(buf);
if(strncmp(at, "${", 2) == 0) {
at = do_macro_recursion(store, runtime, at, remain);
} else if(*at == '$') {
at = do_macro_variable(store, at, remain);
} else if(isdigit((int)*at)) {
at = do_macro_arith(at, remain, &arithstart);
} else {
/* copy until whitespace or operator */
if(*at && (isalnum((int)*at) || *at=='_')) {
at++;
while(*at && (isalnum((int)*at) || *at=='_'))
at++;
} else at++;
}
if(!at) return NULL; /* failure */
}
*text += len;
if(dofunc) {
/* post process functions, buf has the argument(s) */
if(strncmp(buf, "ctime", 5) == 0) {
return do_macro_ctime(buf+6);
} else if(strncmp(buf, "range", 5) == 0) {
return do_macro_range(buf+6);
}
}
return strdup(buf);
}
char*
macro_process(rbtree_t* store, struct replay_runtime* runtime, char* text)
{
char buf[10240];
char* next, *expand;
char* at = text;
if(!strstr(text, "${"))
return strdup(text); /* no macros */
buf[0] = 0;
buf[sizeof(buf)-1]=0;
while( (next=strstr(at, "${")) ) {
/* copy text before next macro */
if((size_t)(next-at) >= sizeof(buf)-strlen(buf))
return NULL; /* string too long */
(void)strlcpy(buf+strlen(buf), at, (size_t)(next-at+1));
/* process the macro itself */
next += 2;
expand = macro_expand(store, runtime, &next);
if(!expand) return NULL; /* expansion failed */
(void)strlcpy(buf+strlen(buf), expand, sizeof(buf)-strlen(buf));
free(expand);
at = next;
}
/* copy remainder fixed text */
(void)strlcpy(buf+strlen(buf), at, sizeof(buf)-strlen(buf));
return strdup(buf);
}
char*
macro_lookup(rbtree_t* store, char* name)
{
struct replay_var* x = macro_getvar(store, name);
if(!x) return strdup("");
return strdup(x->value);
}
void macro_print_debug(rbtree_t* store)
{
struct replay_var* x;
RBTREE_FOR(x, struct replay_var*, store) {
log_info("%s = %s", x->name, x->value);
}
}
int
macro_assign(rbtree_t* store, char* name, char* value)
{
struct replay_var* x = macro_getvar(store, name);
if(x) {
free(x->value);
} else {
x = (struct replay_var*)malloc(sizeof(*x));
if(!x) return 0;
x->node.key = x;
x->name = strdup(name);
if(!x->name) {
free(x);
return 0;
}
(void)rbtree_insert(store, &x->node);
}
x->value = strdup(value);
return x->value != NULL;
}
void testbound_selftest(void)
{
/* test the macro store */
rbtree_t* store = macro_store_create();
char* v;
int r;
log_assert(store);
v = macro_lookup(store, "bla");
log_assert(strcmp(v, "") == 0);
free(v);
v = macro_lookup(store, "vlerk");
log_assert(strcmp(v, "") == 0);
free(v);
r = macro_assign(store, "bla", "waarde1");
log_assert(r);
v = macro_lookup(store, "vlerk");
log_assert(strcmp(v, "") == 0);
free(v);
v = macro_lookup(store, "bla");
log_assert(strcmp(v, "waarde1") == 0);
free(v);
r = macro_assign(store, "vlerk", "kanteel");
log_assert(r);
v = macro_lookup(store, "bla");
log_assert(strcmp(v, "waarde1") == 0);
free(v);
v = macro_lookup(store, "vlerk");
log_assert(strcmp(v, "kanteel") == 0);
free(v);
r = macro_assign(store, "bla", "ww");
log_assert(r);
v = macro_lookup(store, "bla");
log_assert(strcmp(v, "ww") == 0);
free(v);
log_assert( macro_length("}") == 1);
log_assert( macro_length("blabla}") == 7);
log_assert( macro_length("bla${zoink}bla}") == 7+8);
log_assert( macro_length("bla${zoink}${bla}bla}") == 7+8+6);
v = macro_process(store, NULL, "");
log_assert( v && strcmp(v, "") == 0);
free(v);
v = macro_process(store, NULL, "${}");
log_assert( v && strcmp(v, "") == 0);
free(v);
v = macro_process(store, NULL, "blabla ${} dinges");
log_assert( v && strcmp(v, "blabla dinges") == 0);
free(v);
v = macro_process(store, NULL, "1${$bla}2${$bla}3");
log_assert( v && strcmp(v, "1ww2ww3") == 0);
free(v);
v = macro_process(store, NULL, "it is ${ctime 123456}");
log_assert( v && strcmp(v, "it is Fri Jan 2 11:17:36 1970") == 0);
free(v);
r = macro_assign(store, "t1", "123456");
log_assert(r);
v = macro_process(store, NULL, "it is ${ctime ${$t1}}");
log_assert( v && strcmp(v, "it is Fri Jan 2 11:17:36 1970") == 0);
free(v);
v = macro_process(store, NULL, "it is ${ctime $t1}");
log_assert( v && strcmp(v, "it is Fri Jan 2 11:17:36 1970") == 0);
free(v);
r = macro_assign(store, "x", "1");
log_assert(r);
r = macro_assign(store, "y", "2");
log_assert(r);
v = macro_process(store, NULL, "${$x + $x}");
log_assert( v && strcmp(v, "2") == 0);
free(v);
v = macro_process(store, NULL, "${$x - $x}");
log_assert( v && strcmp(v, "0") == 0);
free(v);
v = macro_process(store, NULL, "${$y * $y}");
log_assert( v && strcmp(v, "4") == 0);
free(v);
v = macro_process(store, NULL, "${32 / $y + $x + $y}");
log_assert( v && strcmp(v, "19") == 0);
free(v);
v = macro_process(store, NULL, "${32 / ${$y+$y} + ${${100*3}/3}}");
log_assert( v && strcmp(v, "108") == 0);
free(v);
v = macro_process(store, NULL, "${1 2 33 2 1}");
log_assert( v && strcmp(v, "1 2 33 2 1") == 0);
free(v);
v = macro_process(store, NULL, "${123 3 + 5}");
log_assert( v && strcmp(v, "123 8") == 0);
free(v);
v = macro_process(store, NULL, "${123 glug 3 + 5}");
log_assert( v && strcmp(v, "123 glug 8") == 0);
free(v);
macro_store_delete(store);
}
+141 -1
View File
@@ -41,6 +41,15 @@
* <pre>
* File format for replay files.
*
* ; unbound.conf options.
* ; ...
* ; additional commandline options to pass to unbound
* COMMANDLINE cmdline_option
* ; autotrust key file contents, also adds auto-trust-anchor-file: "x" to cfg
* AUTOTRUST_FILE id
* ; contents of that file
* AUTOTRUST_END
* CONFIG_END
* ; comment line.
* SCENARIO_BEGIN name_of_scenario
* RANGE_BEGIN start_time end_time
@@ -60,11 +69,33 @@
* o TIMEOUT
* o TIME_PASSES ELAPSE [seconds] - increase 'now' time counter, can be
* a floating point number.
* TIME_PASSES EVAL [macro] - expanded for seconds to move time.
* o TRAFFIC - like CHECK_ANSWER, causes traffic to flow.
* actually the traffic flows before this step is taken.
* the step waits for traffic to stop.
* o CHECK_AUTOTRUST [id] - followed by FILE_BEGIN [to match] FILE_END.
* The file contents is macro expanded before match.
* o ERROR
* ; following entry starts on the next line, ENTRY_BEGIN.
* ; more STEP items
* SCENARIO_END
*
* Calculations, a macro-like system: ${$myvar + 3600}
* STEP 10 ASSIGN myvar = 3600
* ; ASSIGN event. '=' is syntactic sugar here. 3600 is some expression.
* ${..} is macro expanded from its expression. Text substitution.
* o $var replaced with its value. var is identifier [azAZ09_]*
* o number is that number.
* o ${variables and arithmetic }
* o +, -, / and *. Note, evaluated left-to-right. Use ${} for brackets.
* So again, no precedence rules, so 2+3*4 == ${2+3}*4 = 20.
* Do 2+${3*4} to get 24.
* o ${function params}
* o ${time} is the current time for the simulated unbound.
* o ${ctime value} is the text ctime(value), Fri 3 Aug 2009, ...
* o ${timeout} is the time until next timeout in comm_timer list.
* o ${range lower value upper} checks if lower<=value<=upper
* returns value if check succeeds.
*
* ; Example file
* SCENARIO_BEGIN Example scenario
@@ -98,10 +129,13 @@
#define TESTCODE_REPLAY_H
#include "util/netevent.h"
#include "testcode/ldns-testpkts.h"
#include "util/rbtree.h"
struct replay_answer;
struct replay_moment;
struct replay_range;
struct fake_pending;
struct fake_timer;
struct replay_var;
/**
* A replay scenario.
@@ -156,8 +190,14 @@ struct replay_moment {
repevt_back_reply,
/** test fails if query to the network does not match */
repevt_back_query,
/** check autotrust key file */
repevt_autotrust_check,
/** an error happens to outbound query */
repevt_error
repevt_error,
/** assignment to a variable */
repevt_assign,
/** cause traffic to flow */
repevt_traffic
}
/** variable with what is to happen this moment */
evt_type;
@@ -178,6 +218,16 @@ struct replay_moment {
* Unused at this time.
*/
ldns_rr* qname;
/** macro name, for assign. */
char* variable;
/** string argument, for assign. */
char* string;
/** the autotrust file id to check */
char* autotrust_id;
/** file contents to match, one string per line */
struct config_strlist* file_content;
};
/**
@@ -227,6 +277,9 @@ struct replay_runtime {
/** last element in answer list. */
struct replay_answer* answer_last;
/** list of fake timer callbacks that are pending */
struct fake_timer* timer_list;
/** callback to call for incoming queries */
comm_point_callback_t* callback_query;
/** user argument for incoming query callback */
@@ -246,6 +299,11 @@ struct replay_runtime {
/** size of buffers */
size_t bufsize;
/**
* Tree of macro values. Of type replay_var
*/
rbtree_t* vars;
};
/**
@@ -289,6 +347,36 @@ struct replay_answer {
ldns_pkt* pkt;
};
/**
* Timers with callbacks, fake replay version.
*/
struct fake_timer {
/** next in list */
struct fake_timer* next;
/** the runtime structure this is part of */
struct replay_runtime* runtime;
/** the callback to call */
void (*cb)(void*);
/** the callback user argument */
void* cb_arg;
/** if timer is enabled */
int enabled;
/** when the timer expires */
struct timeval tv;
};
/**
* Replay macro variable. And its value.
*/
struct replay_var {
/** rbtree node. Key is this structure. Sorted by name. */
rbnode_t node;
/** the variable name */
char* name;
/** the variable value */
char* value;
};
/**
* Read a replay scenario from the file.
* @param in: file to read from.
@@ -305,4 +393,56 @@ struct replay_scenario* replay_scenario_read(FILE* in, const char* name,
*/
void replay_scenario_delete(struct replay_scenario* scen);
/** compare two replay_vars */
int replay_var_compare(const void* a, const void* b);
/** get oldest enabled fake timer */
struct fake_timer* replay_get_oldest_timer(struct replay_runtime* runtime);
/**
* Create variable storage
* @return new or NULL on failure.
*/
rbtree_t* macro_store_create(void);
/**
* Delete variable storage
* @param store: the macro storage to free up.
*/
void macro_store_delete(rbtree_t* store);
/**
* Apply macro substitution to string.
* @param store: variable store.
* @param runtime: the runtime to look up values as needed.
* @param text: string to work on.
* @return newly malloced string with result.
*/
char* macro_process(rbtree_t* store, struct replay_runtime* runtime,
char* text);
/**
* Look up a macro value. Like calling ${$name}.
* @param store: variable store
* @param name: macro name
* @return newly malloced string with result or strdup("") if not found.
* or NULL on malloc failure.
*/
char* macro_lookup(rbtree_t* store, char* name);
/**
* Set macro value.
* @param store: variable store
* @param name: macro name
* @param value: text to set it to. Not expanded.
* @return false on failure.
*/
int macro_assign(rbtree_t* store, char* name, char* value);
/** Print macro variables stored as debug info */
void macro_print_debug(rbtree_t* store);
/** testbounds self test */
void testbound_selftest(void);
#endif /* TESTCODE_REPLAY_H */
+4 -3
View File
@@ -137,7 +137,7 @@ write_q(int fd, int udp, ldns_buffer* buf, int id,
exit(1);
}
}
if(send(fd, ldns_buffer_begin(buf), ldns_buffer_limit(buf), 0) <
if(send(fd, (void*)ldns_buffer_begin(buf), ldns_buffer_limit(buf), 0) <
(ssize_t)ldns_buffer_limit(buf)) {
#ifndef USE_WINSOCK
perror("send() data failed");
@@ -170,7 +170,8 @@ recv_one(int fd, int udp, ldns_buffer* buf)
len = ntohs(len);
ldns_buffer_clear(buf);
ldns_buffer_set_limit(buf, len);
if(recv(fd, ldns_buffer_begin(buf), len, 0) < (ssize_t)len) {
if(recv(fd, (void*)ldns_buffer_begin(buf), len, 0) <
(ssize_t)len) {
#ifndef USE_WINSOCK
perror("read() data failed");
#else
@@ -182,7 +183,7 @@ recv_one(int fd, int udp, ldns_buffer* buf)
} else {
ssize_t l;
ldns_buffer_clear(buf);
if((l=recv(fd, ldns_buffer_begin(buf),
if((l=recv(fd, (void*)ldns_buffer_begin(buf),
ldns_buffer_capacity(buf), 0)) < 0) {
#ifndef USE_WINSOCK
perror("read() data failed");
+93 -23
View File
@@ -43,7 +43,10 @@
#include "testcode/replay.h"
#include "testcode/fake_event.h"
#include "daemon/remote.h"
#include "util/config_file.h"
/** signal that this is a testbound compile */
#define unbound_testbound 1
/**
* include the main program from the unbound daemon.
* rename main to daemon_main to call it
@@ -54,8 +57,8 @@
/** maximum line length for lines in the replay file. */
#define MAX_LINE_LEN 1024
/** the config file (removed at exit) */
static char cfgfile[MAX_LINE_LEN];
/** config files (removed at exit) */
static struct config_strlist* cfgfiles = NULL;
/** give commandline usage for testbound. */
static void
@@ -66,6 +69,8 @@ testbound_usage()
printf("-h this help\n");
printf("-p file playback text file\n");
printf("-2 detect SHA256 support (exit code 0 or 1)\n");
printf("-g detect GOST support (exit code 0 or 1)\n");
printf("-s testbound self-test - unit test of testbound parts.\n");
printf("-o str unbound commandline options separated by spaces.\n");
printf("Version %s\n", PACKAGE_VERSION);
printf("BSD licensed, see LICENSE file in source package.\n");
@@ -121,33 +126,67 @@ echo_cmdline(int argc, char* argv[])
fprintf(stderr, "\n");
}
/** process config elements */
/** spool autotrust file */
static void
setup_config(FILE* in, char* configfile, int* lineno,
int* pass_argc, char* pass_argv[])
spool_auto_file(FILE* in, int* lineno, FILE* cfg, char* id)
{
char line[MAX_LINE_LEN];
char* parse;
FILE* spool;
/* find filename for new file */
while(isspace((int)*id))
id++;
if(strlen(id)==0)
fatal_exit("AUTROTRUST_FILE must have id, line %d", *lineno);
id[strlen(id)-1]=0; /* remove newline */
fake_temp_file("_auto_", id, line, sizeof(line));
/* add option for the file */
fprintf(cfg, "server: auto-trust-anchor-file: \"%s\"\n", line);
/* open file and spool to it */
spool = fopen(line, "w");
if(!spool) fatal_exit("could not open %s: %s", line, strerror(errno));
fprintf(stderr, "testbound is spooling key file: %s\n", line);
if(!cfg_strlist_insert(&cfgfiles, strdup(line)))
fatal_exit("out of memory");
line[sizeof(line)-1] = 0;
while(fgets(line, MAX_LINE_LEN-1, in)) {
parse = line;
(*lineno)++;
while(isspace((int)*parse))
parse++;
if(strncmp(parse, "AUTOTRUST_END", 13) == 0) {
fclose(spool);
return;
}
fputs(line, spool);
}
fatal_exit("no AUTOTRUST_END in input file");
}
/** process config elements */
static void
setup_config(FILE* in, int* lineno, int* pass_argc, char* pass_argv[])
{
char configfile[MAX_LINE_LEN];
char line[MAX_LINE_LEN];
char* parse;
FILE* cfg;
#ifdef USE_WINSOCK
snprintf(configfile, MAX_LINE_LEN, "testbound_cfg_%u.tmp",
(unsigned)getpid());
#else
snprintf(configfile, MAX_LINE_LEN, "/tmp/testbound_cfg_%u.tmp",
(unsigned)getpid());
#endif
fake_temp_file("_cfg", "", configfile, sizeof(configfile));
add_opts("-c", pass_argc, pass_argv);
add_opts(configfile, pass_argc, pass_argv);
cfg = fopen(configfile, "w");
if(!cfg) fatal_exit("could not open %s: %s",
configfile, strerror(errno));
line[MAX_LINE_LEN-1] = 0;
if(!cfg_strlist_insert(&cfgfiles, strdup(configfile)))
fatal_exit("out of memory");
line[sizeof(line)-1] = 0;
/* some basic settings to not pollute the host system */
fprintf(cfg, "server: use-syslog: no\n");
fprintf(cfg, " directory: \"\"\n");
fprintf(cfg, " chroot: \"\"\n");
fprintf(cfg, " username: \"\"\n");
fprintf(cfg, " pidfile: \"\"\n");
fprintf(cfg, " val-log-level: 2\n");
while(fgets(line, MAX_LINE_LEN-1, in)) {
parse = line;
(*lineno)++;
@@ -160,6 +199,10 @@ setup_config(FILE* in, char* configfile, int* lineno,
add_opts(parse+11, pass_argc, pass_argv);
continue;
}
if(strncmp(parse, "AUTOTRUST_FILE", 14) == 0) {
spool_auto_file(in, lineno, cfg, parse+14);
continue;
}
if(strncmp(parse, "CONFIG_END", 10) == 0) {
fclose(cfg);
return;
@@ -172,8 +215,7 @@ setup_config(FILE* in, char* configfile, int* lineno,
/** read playback file */
static struct replay_scenario*
setup_playback(const char* filename, char* configfile,
int* pass_argc, char* pass_argv[])
setup_playback(const char* filename, int* pass_argc, char* pass_argv[])
{
struct replay_scenario* scen = NULL;
int lineno = 0;
@@ -184,7 +226,7 @@ setup_playback(const char* filename, char* configfile,
perror(filename);
exit(1);
}
setup_config(in, configfile, &lineno, pass_argc, pass_argv);
setup_config(in, &lineno, pass_argc, pass_argv);
scen = replay_scenario_read(in, filename, &lineno);
fclose(in);
if(!scen)
@@ -198,9 +240,13 @@ setup_playback(const char* filename, char* configfile,
/** remove config file at exit */
void remove_configfile(void)
{
unlink(cfgfile);
struct config_strlist* p;
for(p=cfgfiles; p; p=p->next)
unlink(p->str);
config_delstrlist(cfgfiles);
cfgfiles = NULL;
}
/**
* Main fake event test program. Setup, teardown and report errors.
* @param argc: arg count.
@@ -220,12 +266,16 @@ main(int argc, char* argv[])
log_init(NULL, 0, NULL);
log_info("Start of %s testbound program.", PACKAGE_STRING);
/* determine commandline options for the daemon */
cfgfile[0] = 0;
pass_argc = 1;
pass_argv[0] = "unbound";
add_opts("-d", &pass_argc, pass_argv);
while( (c=getopt(argc, argv, "2ho:p:")) != -1) {
while( (c=getopt(argc, argv, "2gho:p:s")) != -1) {
switch(c) {
case 's':
free(pass_argv[1]);
testbound_selftest();
printf("selftest successful\n");
exit(0);
case '2':
#if defined(HAVE_EVP_SHA256) && defined(USE_SHA2)
printf("SHA256 supported\n");
@@ -233,6 +283,20 @@ main(int argc, char* argv[])
#else
printf("SHA256 not supported\n");
exit(1);
#endif
break;
case 'g':
#ifdef USE_GOST
if(ldns_key_EVP_load_gost_id()) {
printf("GOST supported\n");
exit(0);
} else {
printf("GOST not supported\n");
exit(1);
}
#else
printf("GOST not supported\n");
exit(1);
#endif
break;
case 'p':
@@ -258,7 +322,7 @@ main(int argc, char* argv[])
fatal_exit("atexit() failed: %s", strerror(errno));
/* setup test environment */
scen = setup_playback(playback_file, cfgfile, &pass_argc, pass_argv);
scen = setup_playback(playback_file, &pass_argc, pass_argv);
/* init fake event backend */
fake_event_init(scen);
@@ -287,7 +351,7 @@ struct listen_port* daemon_remote_open_ports(struct config_file*
return NULL;
}
struct daemon_remote* daemon_remote_create(struct worker* ATTR_UNUSED(worker))
struct daemon_remote* daemon_remote_create(struct config_file* ATTR_UNUSED(cfg))
{
return (struct daemon_remote*)calloc(1,1);
}
@@ -297,8 +361,14 @@ void daemon_remote_delete(struct daemon_remote* rc)
free(rc);
}
void daemon_remote_clear(struct daemon_remote* ATTR_UNUSED(rc))
{
/* nothing */
}
int daemon_remote_open_accept(struct daemon_remote* ATTR_UNUSED(rc),
struct listen_port* ATTR_UNUSED(ports))
struct listen_port* ATTR_UNUSED(ports),
struct worker* ATTR_UNUSED(worker))
{
return 1;
}
+21 -5
View File
@@ -64,6 +64,7 @@ test_anchor_empty(struct val_anchors* a)
static void
test_anchor_one(ldns_buffer* buff, struct val_anchors* a)
{
struct trust_anchor* ta;
uint16_t c = LDNS_RR_CLASS_IN;
unit_assert(anchor_store_str(a, buff,
"nl. DS 42860 5 1 14D739EB566D2B1A5E216A0BA4D17FA9B038BE4A"));
@@ -71,11 +72,19 @@ test_anchor_one(ldns_buffer* buff, struct val_anchors* a)
unit_assert(anchors_lookup(a, (uint8_t*)"\003com\000", 5, c) == NULL);
unit_assert(anchors_lookup(a,
(uint8_t*)"\007example\003com\000", 11, c) == NULL);
unit_assert(anchors_lookup(a, (uint8_t*)"\002nl\000", 4, c) != NULL);
unit_assert(anchors_lookup(a,
(uint8_t*)"\004labs\002nl\000", 9, c) != NULL);
unit_assert(anchors_lookup(a,
(uint8_t*)"\004fabs\002nl\000", 9, c) != NULL);
unit_assert((ta=anchors_lookup(a,
(uint8_t*)"\002nl\000", 4, c)) != NULL);
lock_basic_unlock(&ta->lock);
unit_assert((ta=anchors_lookup(a,
(uint8_t*)"\004labs\002nl\000", 9, c)) != NULL);
lock_basic_unlock(&ta->lock);
unit_assert((ta=anchors_lookup(a,
(uint8_t*)"\004fabs\002nl\000", 9, c)) != NULL);
lock_basic_unlock(&ta->lock);
unit_assert(anchors_lookup(a, (uint8_t*)"\002oo\000", 4, c) == NULL);
}
@@ -91,16 +100,23 @@ test_anchors(ldns_buffer* buff, struct val_anchors* a)
unit_assert(anchors_lookup(a, (uint8_t*)"\003com\000", 5, c) == NULL);
unit_assert(anchors_lookup(a,
(uint8_t*)"\007example\003com\000", 11, c) == NULL);
unit_assert(ta = anchors_lookup(a, (uint8_t*)"\002nl\000", 4, c));
unit_assert(query_dname_compare(ta->name, (uint8_t*)"\002nl\000")==0);
lock_basic_unlock(&ta->lock);
unit_assert(ta = anchors_lookup(a,
(uint8_t*)"\004labs\002nl\000", 9, c));
unit_assert(query_dname_compare(ta->name,
(uint8_t*)"\004labs\002nl\000") == 0);
lock_basic_unlock(&ta->lock);
unit_assert(ta = anchors_lookup(a,
(uint8_t*)"\004fabs\002nl\000", 9, c));
unit_assert(query_dname_compare(ta->name,
(uint8_t*)"\002nl\000") == 0);
lock_basic_unlock(&ta->lock);
unit_assert(anchors_lookup(a, (uint8_t*)"\002oo\000", 4, c) == NULL);
}
+2 -2
View File
@@ -483,7 +483,7 @@ void lruhash_test()
/* also small in size so that reclaim has to be done quickly. */
struct lruhash* table ;
printf("lruhash test\n");
table = lruhash_create(2, 4096,
table = lruhash_create(2, 8192,
test_slabhash_sizefunc, test_slabhash_compfunc,
test_slabhash_delkey, test_slabhash_deldata, NULL);
test_bin_find_entry(table);
@@ -491,7 +491,7 @@ void lruhash_test()
test_short_table(table);
test_long_table(table);
lruhash_delete(table);
table = lruhash_create(2, 4096,
table = lruhash_create(2, 8192,
test_slabhash_sizefunc, test_slabhash_compfunc,
test_slabhash_delkey, test_slabhash_deldata, NULL);
test_threaded_table(table);
+12 -1
View File
@@ -407,7 +407,7 @@ rnd_test()
for(i=0; i<num; i++) {
a[i] = ub_random(r);
unit_assert(a[i] >= 0);
unit_assert((size_t)a[i] <= (size_t)RAND_MAX);
unit_assert((size_t)a[i] <= (size_t)0x7fffffff);
if(i > 5)
unit_assert(a[i] != a[i-1] || a[i] != a[i-2] ||
a[i] != a[i-3] || a[i] != a[i-4] ||
@@ -432,6 +432,12 @@ main(int argc, char* argv[])
}
printf("Start of %s unit test.\n", PACKAGE_STRING);
ERR_load_crypto_strings();
#ifdef HAVE_OPENSSL_CONFIG
OPENSSL_config("unbound");
#endif
#ifdef USE_GOST
(void)ldns_key_EVP_load_gost_id();
#endif
checklock_start();
neg_test();
rnd_test();
@@ -448,9 +454,14 @@ main(int argc, char* argv[])
msgparse_test();
checklock_stop();
printf("%d checks ok.\n", testcount);
#ifdef HAVE_OPENSSL_CONFIG
EVP_cleanup();
/*ENGINE_cleanup();*/
CONF_modules_free();
#endif
CRYPTO_cleanup_all_ex_data();
ERR_remove_state(0);
ERR_free_strings();
RAND_cleanup();
return 0;
}
+1
View File
@@ -518,6 +518,7 @@ void msgparse_test()
matches_nolocation = 1; /* RR order not important for the next test */
testfromdrillfile(pkt, &alloc, out, "testdata/test_packets.6");
testfromdrillfile(pkt, &alloc, out, "testdata/test_packets.7");
matches_nolocation = 0;
/* cleanup */
+2 -2
View File
@@ -362,13 +362,13 @@ void slabhash_test()
/* also small in size so that reclaim has to be done quickly. */
struct slabhash* table;
printf("slabhash test\n");
table = slabhash_create(4, 2, 5200,
table = slabhash_create(4, 2, 10400,
test_slabhash_sizefunc, test_slabhash_compfunc,
test_slabhash_delkey, test_slabhash_deldata, NULL);
test_short_table(table);
test_long_table(table);
slabhash_delete(table);
table = slabhash_create(4, 2, 5200,
table = slabhash_create(4, 2, 10400,
test_slabhash_sizefunc, test_slabhash_compfunc,
test_slabhash_delkey, test_slabhash_deldata, NULL);
test_threaded_table(table);
+16 -10
View File
@@ -155,14 +155,16 @@ verifytest_rrset(struct module_env* env, struct val_env* ve,
struct query_info* qinfo)
{
enum sec_status sec;
char* reason = NULL;
if(vsig) {
log_nametypeclass(VERB_QUERY, "verify of rrset",
rrset->rk.dname, ntohs(rrset->rk.type),
ntohs(rrset->rk.rrset_class));
}
sec = dnskeyset_verify_rrset(env, ve, rrset, dnskey);
sec = dnskeyset_verify_rrset(env, ve, rrset, dnskey, &reason);
if(vsig) {
printf("verify outcome is: %s\n", sec_status_to_string(sec));
printf("verify outcome is: %s %s\n", sec_status_to_string(sec),
reason?reason:"");
}
if(should_be_bogus(rrset, qinfo)) {
unit_assert(sec == sec_status_bogus);
@@ -475,17 +477,21 @@ verify_test()
verifytest_file("testdata/test_signatures.7", "20070829144150");
verifytest_file("testdata/test_signatures.8", "20070829144150");
#if defined(HAVE_EVP_SHA256) && defined(USE_SHA2)
verifytest_file("testdata/test_signatures.9", "20070829144150");
verifytest_file("testdata/test_signatures.11", "20070829144150");
verifytest_file("testdata/test_sigs.rsasha256", "20070829144150");
verifytest_file("testdata/test_sigs.sha1_and_256", "20070829144150");
verifytest_file("testdata/test_sigs.rsasha256_draft", "20090101000000");
#endif
#if defined(HAVE_EVP_SHA512) && defined(USE_SHA2)
/* Skip test. Algorithm number uncertainty
verifytest_file("testdata/test_signatures.10", "20070829144150");
*/
verifytest_file("testdata/test_sigs.rsasha512_draft", "20070829144150");
#endif
verifytest_file("testdata/test_signatures.12", "20090107100022");
verifytest_file("testdata/test_signatures.13", "20080414005004");
dstest_file("testdata/test_ds_sig.1");
verifytest_file("testdata/test_sigs.hinfo", "20090107100022");
verifytest_file("testdata/test_sigs.revoked", "20080414005004");
#ifdef USE_GOST
if(ldns_key_EVP_load_gost_id())
verifytest_file("testdata/test_sigs.gost", "20090807060504");
else printf("Warning: skipped GOST, openssl does not provide gost.\n");
#endif
dstest_file("testdata/test_ds.sha1");
nsectest();
nsec3_hash_test("testdata/test_nsec3_hash.1");
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
example.com. 3600 IN DS 16486 5 1 9adff86d0a468b5989a686df8076269b3a31ba54 ; xokit-zevek-tydyg-kydoh-nydap-kicet-zybil-konon-ruvef-covuh-gyxex
+1
View File
@@ -0,0 +1 @@
example.com. 3600 IN DNSKEY 257 3 5 AwEAAas/cAhCFXvBUgTSNZCvQp0pLx1dY+7rXR0hH4/3EUgWmsmbYUpI1qD0xhwKD/oYGEwAm291fyWJ9c0oVxXDEK8= ;{id = 16486 (ksk), size = 512b}

Some files were not shown because too many files have changed in this diff Show More