Commit Graph
11331 Commits
Author SHA1 Message Date
Witold Kręcicki 70a1ba20ec QNAME miminimization should create a separate fetch context for each fetch -
this makes the cache more efficient and eliminates duplicates queries.
2018-10-23 12:15:04 +00:00
Witold KręcickiandMichał Kępień b5c9a8caad Set result to SERVFAIL if upstream responded with FORMERR
Commit ba91243542 causes the resolver to
respond to a client query with FORMERR when all upstream queries sent to
the servers authoritative for QNAME elicit FORMERR responses.  This
happens because resolver code returns DNS_R_FORMERR in such a case and
dns_result_torcode() acts as a pass-through for all arguments which are
already a valid RCODE.

The correct RCODE to set in the response returned to the client in the
case described above is SERVFAIL.  Make sure this happens by overriding
the RCODE in query_gotanswer(), on the grounds that any format errors in
the client query itself should be caught long before execution reaches
that point.  This change should not reduce query error logging accuracy
as the resolver code itself reports the exact reason for returning a
DNS_R_FORMERR result using log_formerr().
2018-10-23 13:50:27 +02:00
Ondřej Surý 4b47958163 Fix typo in isc_rwlock_pause() on sparc 2018-10-23 09:29:03 +02:00
Ondřej Surý c4cee27f9b Add support for enabling and enforcing FIPS mode in OpenSSL:
* Add configure option --enable-fips-mode that detects and enables FIPS mode
* Add a function to enable FIPS mode and call it on crypto init
* Log an OpenSSL error when FIPS_mode_set() fails and exit
* Report FIPS mode status in a separate log message from named
2018-10-22 20:55:35 +02:00
Evan Hunt e839972ee2 address unresolved externals 2018-10-19 00:49:53 -07:00
Evan Hunt 3f35ab8567 remove references to methods and app_api.c 2018-10-19 00:28:53 -07:00
Evan Hunt c609a67ac7 change to bool constants; also fixed style error 2018-10-18 20:42:25 -07:00
Evan HuntandWitold Kręcicki 09f58ab63f retain a minimal "methods" struct in the mctx
- this enables memory to be allocated and freed in dyndb modules
  when named is linked statically. when we standardize on libtool,
  this should become unnecessary.
- also, simplified the isc_mem_create/createx API by removing
  extra compatibility functions
2018-10-18 09:19:12 +00:00
Evan HuntandWitold Kręcicki 6f7c9623c5 remove isc_bind9 usage from view.c 2018-10-18 09:19:12 +00:00
Evan HuntandWitold Kręcicki 0e86fa16e8 complete removal of a few unneeded functions
- removed register functions from isc_app, isc_timer, isc_task
- added a task_p.h header for use by unit tests
2018-10-18 09:19:12 +00:00
Witold Kręcicki 38a127c35b Remove layering from isc_task, isc_app, isc_socket, isc_timer, isc_mem 2018-10-18 09:19:12 +00:00
Witold Kręcicki cdbac34cba Get rid of isc_bind9 conditional 2018-10-18 09:19:12 +00:00
Michał Kępień ba91243542 Do not set qctx->result to DNS_R_SERVFAIL unless necessary
In some cases, setting qctx->result to DNS_R_SERVFAIL causes the value
of a 'result' variable containing a more specific failure reason to be
effectively discarded.  This may cause certain query error log messages
to lack specificity despite a more accurate problem cause being
determined during query processing.

In other cases, qctx->result is set to DNS_R_SERVFAIL even though a more
specific error (e.g. ISC_R_NOMEMORY) could be explicitly indicated.

Since the response message's RCODE is derived from qctx->result using
dns_result_torcode(), which handles a number of possible isc_result_t
values and returns SERVFAIL for anything not explicitly listed, it is
fine to set qctx->result to something more specific than DNS_R_SERVFAIL
(in fact, this is already being done in a few cases).  Modify most
QUERY_ERROR() calls so that qctx->result is set to a more specific error
code when possible.  Adjust query_error() so that statistics are still
calculated properly.  Remove the RECURSE_ERROR() macro which was
introduced exactly because qctx->result could be set to DNS_R_SERVFAIL
instead of DNS_R_DUPLICATE or DNS_R_DROP, which need special handling.
Modify dns_sdlz_putrr() so that it returns DNS_R_SERVFAIL when a DLZ
driver returns invalid RDATA, in order to prevent setting RCODE to
FORMERR (which is what dns_result_torcode() translates e.g. DNS_R_SYNTAX
to) while responding authoritatively.
2018-10-08 12:47:28 +02:00
Michał Kępień b3cd868c4b Remove the 'want_stale' field from struct query_ctx
As the previous commit makes the 'want_stale' field of struct query_ctx
redundant, remove it.
2018-10-08 12:47:28 +02:00
Michał Kępień cb48d410d8 Set up stale response lookup before query_done() is called
When something goes wrong while recursing for an answer to a query,
query_gotanswer() sets a flag (qctx->want_stale) in the query context.
query_done() is subsequently called and it can either set up a stale
response lookup (if serve-stale is enabled) or conclude that a SERVFAIL
response should be sent.  This may cause confusion when looking at query
error logs since the QUERY_ERROR() line responsible for setting the
response's RCODE to SERVFAIL is not in a catch-all branch of a switch
statement inside query_gotanswer() (like it is for authoritative
responses) but rather in a code branch which appears to have something
to do with serve-stale, even when the latter is not enabled.

Extract the part of query_done() responsible for checking serve-stale
configuration and optionally setting up a stale response lookup into a
separate function, query_usestale(), shifting the responsibility for
setting the response's RCODE to SERVFAIL to the same QUERY_ERROR() line
in query_gotanswer() which is evaluated for authoritative responses.
2018-10-08 12:47:28 +02:00
Evan Hunt c642f9970a move declaration to the top of the block 2018-10-05 11:13:54 -07:00
Tony FinchandEvan Hunt 7a2b0ac92a Fix crash at shutdown during an RPZ reload. [RT #46210] 2018-10-05 13:58:47 -04:00
Evan Hunt f14445f13d remove references to deleted files 2018-10-05 09:10:40 -07:00
Ondřej Surý 5ccbb274d2 Remove HAVE_OPENSSL guard from openssl_shim.{c,h} and uncrustify it 2018-10-05 13:12:48 +02:00
Ondřej Surý 3994b1f9c2 Remove support for obsoleted and insecure DSA and DSA-NSEC3-SHA1 algorithms 2018-10-05 09:21:43 +02:00
Witold KręcickiandMichał Kępień 87b07bf08a Fix creating and validating EdDSA signatures
Revert parts of commit c3b8130fe8 which
inadvertently broke creating and validating EdDSA signatures:

 1. EVP_DigestSignInit() returns 1 on success.

 2. EdDSA does not support streaming (EVP_Digest*Update() followed by
    EVP_Digest*Final()), only one shot operations.
2018-10-04 12:38:46 +02:00
Mark Andrews f723a1247f Undo implict promotion to 64 bits in our Windows implementation of atomic_load_explicit() by casting to uint_fast32_t. 2018-10-04 06:59:28 +10:00
Evan Hunt 51c6f4b682 extend DNSTAP to record UPDATE requests and responses as a separate type 2018-10-03 01:03:56 -07:00
Evan HuntandMark Andrews 395f6a1474 make update_log() work if zone is not set
- update_log() is called to log update errors, but if those errors
  occur before the zone is set (for example, when returning NOTAUTH)
  it returns without logging anything.
2018-10-03 02:09:26 -04:00
Mark Andrews d4cc0b98de use PRIuFAST32 instead of PRIdFAST32 2018-10-03 07:59:18 +10:00
Mark Andrews 0fc1b1bffa improve case presevation 2018-10-02 15:09:32 +10:00
Evan Hunt b4dca44ad2 fix chaosnet address comparison 2018-09-28 00:42:03 -07:00
Evan Hunt 2b61b83199 check both allow-query-cache and allow-query-cache-on 2018-09-27 21:48:44 -07:00
Evan HuntandMark Andrews 6a3afe2778 fix a formatting error in logged RPZ error messages 2018-09-27 19:59:21 -04:00
Tony FinchandEvan Hunt 9407d9e266 RPZ now treats covering NSEC records the same as negative answers 2018-09-27 14:53:34 -07:00
Mark AndrewsandEvan Hunt ac1c3aaa27 only emit a single space between mac length and the orginal id if the mac length is zero 2018-09-27 16:34:49 -04:00
Zhaolong ZhangandMichał Kępień 21966423cd Fix crash caused by race condition in timer creation
The race condition is the timer elapses before isc__timer_create()
returns the pointer to the caller.  Assigning the return pointer before
enabling the timer will fix it.
2018-09-27 15:17:52 +02:00
Michał KępieńandEvan Hunt 56003e9f9f Prevent a race after zone load
Zone loading happens in a different task (zone->loadtask) than other
zone actions (zone->task).  Thus, when zone_postload() is called in the
context of zone->loadtask, it may cause zone maintenance to be queued in
zone->task and another thread can then execute zone_maintenance() before
zone_postload() gets a chance to finish its work in the first thread.
This would not be a problem if zone_maintenance() accounted for this
possibility by locking the zone before checking the state of its
DNS_ZONEFLG_LOADPENDING flag.  However, the zone is currently not locked
before the state of that flag is checked, which may prevent zone
maintenance from happening despite zone_postload() scheduling it.  Fix
by locking the zone in zone_maintenance() before checking the state of
the zone's DNS_ZONEFLG_LOADPENDING flag.
2018-09-26 19:35:51 -07:00
Thomas JachandOndřej Surý f2d6b1b859 Couple additional Windows build fixes in VCX files 2018-09-26 09:34:34 +02:00
Mark Andrews a1d8306e3a add strlcat and strlcpy 2018-09-20 14:53:26 +10:00
Mark Andrews be333e93ec remove isc_string_strlcat and isc_string_strlcpy 2018-09-20 14:00:28 +10:00
Mark Andrews 0eda75fec0 don't typedef socklen_t for _MSC_VER >= 1914 2018-09-20 13:51:50 +10:00
Mark Andrews fbeefd4990 add krb5-selfsub and ms-selfsub 2018-09-10 09:32:31 +10:00
Mark Andrews 5fb75a3d75 check that name field is not a valid type 2018-09-10 09:32:31 +10:00
Mark Andrews 156d86e673 fix dns_ssumatchtype_subdomainms dns_ssumatchtype_subdomainkrb5 as they don't require the name field to be '.' 2018-09-10 09:32:31 +10:00
Mark Andrews 81b133d963 avoid macro name collision with system defined macro 2018-09-10 09:18:17 +10:00
Evan Hunt 2c3b827e5d <isc/string.h> instead of "isc/string.h" 2018-09-07 15:26:50 -07:00
Ondřej Surý 161b5dccae Remove NEED_PTHREAD_SCOPE_SYSTEM define that was needed on older FreeBSDs 2018-09-07 12:17:40 +02:00
Ondřej Surý 2750799132 Assume socklen_t is always available on all supported platforms (except on Windows where it is typedefed to int32_t) 2018-09-07 12:17:40 +02:00
Ondřej Surý 5d8f9bf935 Always enable CALL_PTHREAD_SETCONCURRENCY as it is part of POSIX Threads 2018-09-07 12:17:40 +02:00
Ondřej Surý 927b65aa7f Remove now dummy HAVE_UNIXWARE_SIGWAIT define 2018-09-07 12:17:40 +02:00
Ondřej Surý c7b1e7fd08 Linux (glibc) has NPTL since LinuxThreads are no-more, so remove HAVE_LINUXTHREADS 2018-09-07 12:17:40 +02:00
Ondřej Surý 2f02552a93 Remove now dummy NEED_PTHREAD_INIT 2018-09-07 12:17:30 +02:00
Ondřej Surý 4d46f0f95d Drop ISC_PLATFORM_USEDECLSPEC and IRS_PLATFORM_USEDECLSPEC as they are platform dependent and only unix vs win32 platform.h header difference is enough 2018-09-07 12:17:30 +02:00
Ondřej Surý 51b0d5d55e Replace platform ISC_PLATFORM_HAVESTATNSEC with config ENABLE_STAT_NSEC 2018-09-07 12:17:30 +02:00