aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_resolver.c
Commit message (Collapse)AuthorAge
...
* Resolver: limited CNAME recursion.Ruslan Ermilov2016-01-26
| | | | Previously, the recursion was only limited for cached responses.
* Resolver: fixed use-after-free memory accesses with CNAME.Roman Arutyunyan2016-01-26
| | | | | | | | | | | | | | | | | | | | | | | | | When several requests were waiting for a response, then after getting a CNAME response only the last request's context had the name updated. Contexts of other requests had the wrong name. This name was used by ngx_resolve_name_done() to find the node to remove the request context from. When the name was wrong, the request could not be properly cancelled, its context was freed but stayed linked to the node's waiting list. This happened e.g. when the first request was aborted or timed out before the resolving completed. When it completed, this triggered a use-after-free memory access by calling ctx->handler of already freed request context. The bug manifests itself by "could not cancel <name> resolving" alerts in error_log. When a request was responded with a CNAME, the request context kept the pointer to the original node's rn->u.cname. If the original node expired before the resolving timed out or completed with an error, this would trigger a use-after-free memory access via ctx->name in ctx->handler(). The fix is to keep ctx->name unmodified. The name from context is no longer used by ngx_resolve_name_done(). Instead, we now keep the pointer to resolver node to which this request is linked. Keeping the original name intact also improves logging.
* Resolver: changed the ngx_resolver_create_*_query() arguments.Roman Arutyunyan2016-01-26
| | | | | | No functional changes. This is needed by the following change.
* Resolver: fixed CNAME processing for several requests.Ruslan Ermilov2016-01-26
| | | | | | When several requests were waiting for a response, then after getting a CNAME response only the last request was properly processed, while others were left waiting.
* Resolver: fixed crashes in timeout handler.Ruslan Ermilov2016-01-26
| | | | | | | | | | | | | | | | | If one or more requests were waiting for a response, then after getting a CNAME response, the timeout event on the first request remained active, pointing to the wrong node with an empty rn->waiting list, and that could cause either null pointer dereference or use-after-free memory access if this timeout expired. If several requests were waiting for a response, and the first request terminated (e.g., due to client closing a connection), other requests were left without a timeout and could potentially wait indefinitely. This is fixed by introducing per-request independent timeouts. This change also reverts 954867a2f0a6 and 5004210e8c78.
* Resolver: fixed possible segmentation fault on DNS format error.Roman Arutyunyan2016-01-26
|
* Resolver: canceled resend timer on empty resend queues.Sergey Kandaurov2015-06-17
| | | | This is specifically useful on graceful shutdown.
* Removed the obsolete rtsig module.Ruslan Ermilov2015-04-23
|
* Removed the obsolete aio module.Ruslan Ermilov2015-04-22
|
* Resolver: fixed debug event logging.Ruslan Ermilov2014-11-20
| | | | | | | | | In 954867a2f0a6, we switched to using resolver node as the timer event data. This broke debug event logging. Replaced now unused ngx_resolver_ctx_t.ident with ngx_resolver_node_t.ident so that ngx_event_ident() extracts something sensible when accessing ngx_resolver_node_t as ngx_connection_t.
* Resolver: fixed use-after-free memory access.Ruslan Ermilov2014-11-20
| | | | | | In 954867a2f0a6, we switched to using resolver node as the timer event data, so make sure we do not free resolver node memory until the corresponding timer is deleted.
* Events: removed broken thread support from posted events.Valentin Bartenev2014-09-01
| | | | | It's mostly dead code. And the idea of thread support for this task has been deprecated.
* Resolver: notify all waiting requests on timeout.Ruslan Ermilov2014-08-19
| | | | | If a "resolver_timeout" occurs, only the first waiting request was notified. Other requests may hang forever.
* Resolver: fixed resend on malformed responses.Ruslan Ermilov2014-07-16
| | | | | | DNS request resend on malformed responses was broken in 98876ce2a7fd (1.5.8). Reported by Pramod Korathota.
* Style: use ngx_str_null().Tatsuhiko Kubo2014-07-09
|
* Fixed format specifier in logging of "c->number".Sergey Kandaurov2014-03-06
|
* Resolver: properly handle connect() failures.Ruslan Ermilov2014-02-20
| | | | | If initial attempt to connect() the UDP socket failed, e.g. due to network unreachable, no further attempts were made.
* Resolver: added support for domain names with a trailing dot.Yichun Zhang2014-01-10
|
* Resolver: use minimum TTL for caching (ticket #329).Ruslan Ermilov2013-12-16
|
* Resolver: lookups are case-insensitive.Ruslan Ermilov2013-12-13
|
* The "ipv6=" boolean parameter of the "resolver" directive.Ruslan Ermilov2013-12-09
| | | | | When set to "off", only IPv4 addresses will be resolved, and no AAAA queries are ever sent.
* Resolver: implemented IPv6 name to address resolving.Ruslan Ermilov2013-12-09
|
* Resolver: implemented IPv6 address to name resolving.Ruslan Ermilov2013-12-06
|
* Changed resolver API to use ngx_addr_t.Ruslan Ermilov2013-12-06
|
* Resolver: fixed indentation.Ruslan Ermilov2013-12-13
|
* Resolver: fixes in PTR processing.Ruslan Ermilov2013-12-06
| | | | | Verify that class of RR is "IN". Verify that RR data length is non-zero.
* Resolver: fixes in A processing.Ruslan Ermilov2013-12-06
| | | | | | Verify that class of RR is "IN". Verify that RR data length is exactly four octets. Correctly shift to the next RR if RR type is unknown.
* Resolver: fixed response processing.Ruslan Ermilov2013-12-06
| | | | | | | Stricten response header checks: ensure that reserved bits are zeroes, and that the opcode is "standard query". Fixed the "zero-length domain name in DNS response" condition.
* Resolver: removed unnecessary casts.Ruslan Ermilov2013-12-06
|
* Resolver: improved code readability.Ruslan Ermilov2013-12-06
| | | | | | | | | Renamed ngx_resolver_query_t to ngx_resolver_hdr_t as it describes the header that is common to DNS queries and answers. Replaced the magic number 12 by the size of the header structure. The other changes are self-explanatory.
* Win32: MinGW GCC compatibility.Maxim Dounin2013-09-04
| | | | | | | | | Several warnings silenced, notably (ngx_socket_t) -1 is now checked on socket operations instead of -1, as ngx_socket_t is unsigned on win32 and gcc complains on comparison. With this patch, it's now possible to compile nginx using mingw gcc, with options we normally compile on win32.
* Resolver: added missing memory allocation error handling.Maxim Dounin2012-10-24
|
* Resolver: cached addresses are returned with random rotation now.Maxim Dounin2012-09-28
| | | | | | | This ensures balancing when working with dynamically resolved upstream servers with multiple addresses. Based on patch by Anton Jouline.
* Resolver: fixed possible memory leak in ngx_resolver_create().Maxim Dounin2012-08-06
| | | | Found by Coverity.
* When "resolver" is configured with a domain name, only the firstRuslan Ermilov2012-06-18
| | | | resolved address was used. Now all addresses will be used.
* Fixed crash in ngx_resolver_cleanup_tree().Ruslan Ermilov2012-06-18
| | | | | | | | If sending a DNS request fails with an error (e.g., when mistakenly trying to send it to a local IP broadcast), such a request is not deleted if there are clients waiting on it. However, it was still erroneously removed from the queue. Later ngx_resolver_cleanup_tree() attempted to remove it from the queue again that resulted in a NULL pointer dereference.
* Support for IPv6 literals and an optional port in resolver.Ruslan Ermilov2012-06-04
|
* Resolver: fixed format specification.Maxim Dounin2012-06-03
| | | | Patch by Yichun Zhang (agentzh).
* Fixed potential null pointer dereference in ngx_resolver_create().Ruslan Ermilov2012-05-22
| | | | While here, improved error message.
* Resolver: protection from duplicate responses.Maxim Dounin2012-05-14
| | | | | | | | | If we already had CNAME in resolver node (i.e. rn->cnlen and rn->u.cname set), and got additional response with A record, it resulted in rn->cnlen set and rn->u.cname overwritten by rn->u.addr (or rn->u.addrs), causing segmentation fault later in ngx_resolver_free_node() on an attempt to free overwritten rn->u.cname. The opposite (i.e. CNAME got after A) might cause similar problems as well.
* Fixed segmentation fault in ngx_resolver_create_name_query().Ruslan Ermilov2012-04-26
| | | | | | | | | If name passed for resolution was { 0, NULL } (e.g. as a result of name server returning CNAME pointing to ".") pointer wrapped to (void *) -1 resulting in segmentation fault on an attempt to dereference it. Reported by Lanshun Zhou.
* Resolver: added missing sanity checking when creating name queries.Maxim Dounin2012-03-22
| | | | Found by Veracode.
* Fix of rbtree lookup on hash collisions.Maxim Dounin2012-02-27
| | | | | | | Previous code incorrectly assumed that nodes with identical keys are linked together. This might not be true after tree rebalance. Patch by Lanshun Zhou.
* Fixed null pointer dereference in resolver (ticket #91).Maxim Dounin2012-02-27
| | | | | | | | The cycle->new_log.file may not be set before config parsing finished if there are no error_log directive defined at global level. Fix is to copy it after config parsing. Patch by Roman Arutyunyan.
* Time parsing cleanup.Maxim Dounin2012-02-13
| | | | | | | Nuke NGX_PARSE_LARGE_TIME, it's not used since 0.6.30. The only error ngx_parse_time() can currently return is NGX_ERROR, check it explicitly and make sure to cast it to appropriate type (either time_t or ngx_msec_t) to avoid signedness warnings on platforms with unsigned time_t (notably QNX).
* Copyright updated.Maxim Konovalov2012-01-18
|
* Silenced a warning for some compilers.Ruslan Ermilov2011-11-16
|
* Now nginx uses TTL of a DNS response when calculating cache validity.Ruslan Ermilov2011-11-16
| | | | | | | | Previously it used a hardcoded value of 300 seconds. Also added the "valid=" parameter to the "resolver" directive that can be used to override the cache validity time. Patch by Kirill A. Korinskiy with minor changes.
* Fixed compression pointer processing in DNS response greater than 255 bytes.Igor Sysoev2011-11-09
| | | | Thanks to Ben Hawkes.
* Support of several servers in the "resolver" directive.Igor Sysoev2011-10-24
| | | | Patch by Kirill A. Korinskiy.