Maxim Dounin
7b3731862b
Resolver: added missing memory allocation error handling.
2012-10-24 14:07:08 +00:00
Maxim Dounin
6a0f47e079
Resolver: cached addresses are returned with random rotation now.
...
This ensures balancing when working with dynamically resolved upstream
servers with multiple addresses.
Based on patch by Anton Jouline.
2012-09-28 18:28:38 +00:00
Maxim Dounin
42a75bba53
Resolver: fixed possible memory leak in ngx_resolver_create().
...
Found by Coverity.
2012-08-06 10:48:09 +00:00
Ruslan Ermilov
2c49af818b
When "resolver" is configured with a domain name, only the first
...
resolved address was used. Now all addresses will be used.
2012-06-18 12:46:05 +00:00
Ruslan Ermilov
da8bb22634
Fixed crash in ngx_resolver_cleanup_tree().
...
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.
2012-06-18 12:30:45 +00:00
Ruslan Ermilov
ac7f704931
Support for IPv6 literals and an optional port in resolver.
2012-06-04 14:23:27 +00:00
Maxim Dounin
01f1e4d1dc
Resolver: fixed format specification.
...
Patch by Yichun Zhang (agentzh).
2012-06-03 23:18:24 +00:00
Ruslan Ermilov
d2e005c39d
Fixed potential null pointer dereference in ngx_resolver_create().
...
While here, improved error message.
2012-05-22 13:12:14 +00:00
Maxim Dounin
7d863c0181
Resolver: protection from duplicate responses.
...
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.
2012-05-14 09:13:45 +00:00
Ruslan Ermilov
487ba70126
Fixed segmentation fault in ngx_resolver_create_name_query().
...
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.
2012-04-26 12:58:42 +00:00
Maxim Dounin
e34ff16f67
Resolver: added missing sanity checking when creating name queries.
...
Found by Veracode.
2012-03-22 11:57:18 +00:00
Maxim Dounin
7ca6c1ff78
Fix of rbtree lookup on hash collisions.
...
Previous code incorrectly assumed that nodes with identical keys are linked
together. This might not be true after tree rebalance.
Patch by Lanshun Zhou.
2012-02-27 22:15:39 +00:00
Maxim Dounin
53d9677de4
Fixed null pointer dereference in resolver (ticket #91 ).
...
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.
2012-02-27 16:57:02 +00:00
Maxim Dounin
9f38b20db5
Time parsing cleanup.
...
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).
2012-02-13 15:41:11 +00:00
Maxim Konovalov
f8d59e33f3
Copyright updated.
2012-01-18 15:07:43 +00:00
Ruslan Ermilov
777879c832
Silenced a warning for some compilers.
2011-11-16 13:27:33 +00:00
Ruslan Ermilov
bec516bec9
Now nginx uses TTL of a DNS response when calculating cache validity.
...
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.
2011-11-16 13:11:39 +00:00
Igor Sysoev
eb499bab59
Fixed compression pointer processing in DNS response greater than 255 bytes.
...
Thanks to Ben Hawkes.
2011-11-09 13:54:07 +00:00
Igor Sysoev
620718102b
Support of several servers in the "resolver" directive.
...
Patch by Kirill A. Korinskiy.
2011-10-24 16:09:05 +00:00
Igor Sysoev
efde3eb92e
fix building by gcc 4.6 without --with-debug
2011-04-23 17:25:06 +00:00
Igor Sysoev
49ac2b2b45
decrease resolver errors level to error
2010-09-27 11:23:45 +00:00
Igor Sysoev
aa6936e61a
style fix
2010-06-23 16:34:54 +00:00
Igor Sysoev
089b2fd31e
add context to a resolver log
2010-01-11 11:01:02 +00:00
Igor Sysoev
6cfcef3cbf
remove stale comment
2009-12-02 13:03:54 +00:00
Igor Sysoev
653edd491b
use ngx_resolver_alloc() instead of ngx_resolver_calloc()
...
since all fields are filled
2009-11-11 14:29:20 +00:00
Igor Sysoev
e79f429b4b
fix resolving an empty name (".")
2009-11-11 14:27:24 +00:00
Igor Sysoev
a59ba33060
*) fix resolving an empty name ("."),
...
*) add quotes in an error message,
*) backout r3299 in ngx_mail_smtp_handler.c
2009-11-09 19:15:11 +00:00
Igor Sysoev
70966c154f
fix "PTR ." case in address resolver
2009-11-09 18:04:05 +00:00
Igor Sysoev
64bfa87e73
fix segfault in resolver:
...
ngx_resolve_name_done() and ngx_resolve_addr_done() did not delete
contexts from a resolver node waiting list.
2009-11-09 17:45:56 +00:00
Igor Sysoev
0c189c5159
rename ngx_peer_addr_t to ngx_addr_t
2009-11-02 15:14:17 +00:00
Igor Sysoev
a8d3d2204f
fix resolver cache rbtree comparison
2009-09-19 16:15:13 +00:00
Igor Sysoev
99651523de
fix memory leak in resolver
2009-09-16 13:48:11 +00:00
Igor Sysoev
0cd76ea290
*) refactor error_log processing: listen socket log might inherit built-in
...
error_log with zero level, and r2447, r2466, r2467 were not enough
*) remove bogus "stderr" level
*) some functions and fields renames
2009-04-30 13:53:42 +00:00
Igor Sysoev
9a5f4c74cf
fix building by msvc, introduced in r2487
2009-02-02 10:17:06 +00:00
Igor Sysoev
8ef386e1af
fix return code, this fixes segfault when two or more
...
simultaneous connections are resolving the same address
2009-01-31 20:33:01 +00:00
Igor Sysoev
2c01fd32f2
use length of uncompressed name
2009-01-30 11:56:45 +00:00
Igor Sysoev
9258872c2a
store name pointer in variable allocated on stack
...
as resolver ctx may be already deallocated at this point
2009-01-29 14:35:23 +00:00
Igor Sysoev
fa748fe120
free addrs only it has been allocated before: non single address
2009-01-29 14:32:58 +00:00
Igor Sysoev
8629b9b27e
fix reverse resolving cache: it stored zero length names
...
*) free name only if it has been already allocated
*) store name length
2009-01-29 14:29:49 +00:00
Igor Sysoev
b3ac4fb27c
fix compression pointer for big (>255) DNS responses
2008-11-17 08:04:41 +00:00
Igor Sysoev
571a5e1512
show name for a FORMERR DNS response
2008-10-24 14:38:09 +00:00
Igor Sysoev
1c2bb210c1
FORMERR DNS response may be equal to mininal query size
2008-10-24 14:34:10 +00:00
Igor Sysoev
433608c180
style fix: remove tabs and trailing spaces
2008-05-14 07:54:52 +00:00
Igor Sysoev
a8372d8a84
limit CNAME recursion
2008-04-12 07:29:20 +00:00
Igor Sysoev
7c5c1dccd6
use correct ngx_sprintf() formats
2008-04-10 17:27:07 +00:00
Igor Sysoev
4ad5be6f93
log unexpected qtype
2008-04-10 17:26:14 +00:00
Igor Sysoev
19540cd83e
take into account DNAME
2008-04-10 17:12:21 +00:00
Igor Sysoev
09b199cf77
return NXDOMAIN for ".." in host name
2008-04-09 14:45:39 +00:00
Igor Sysoev
949aea4dfe
fix memory leak on resolver query send failure
2008-04-09 14:26:08 +00:00
Igor Sysoev
be02468c6d
fix previous commit
2008-03-04 10:47:34 +00:00