aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_inet.c
Commit message (Collapse)AuthorAge
* Listen port ranges.Roman Arutyunyan2019-03-06
| | | | | | | | | | A range is specified with a dash. For each port in a range a separate listen socket is created. Examples: listen 8080-9000; listen example.com:80-88;
* Removed sorting of getaddrinfo() results.Roman Arutyunyan2019-03-20
| | | | | | | | | | Previously the ngx_inet_resolve_host() function sorted addresses in a way that IPv4 addresses came before IPv6 addresses. This was implemented in eaf95350d75c (1.3.10) along with the introduction of getaddrinfo() which could resolve host names to IPv6 addresses. Since the "listen" directive only used the first address, sorting allowed to preserve "listen" compatibility with the previous behavior and with the behavior of nginx built without IPv6 support. Now "listen" uses all resolved addresses which makes sorting pointless.
* Multiple addresses in "listen".Roman Arutyunyan2019-03-15
| | | | | | Previously only one address was used by the listen directive handler even if host name resolved to multiple addresses. Now a separate listening socket is created for each address.
* Fixed build without IPv6, broken by 874171c3c71a.Maxim Dounin2017-10-05
|
* Fixed handling of non-null-terminated unix sockets.Maxim Dounin2017-10-04
| | | | | | | | | | | | | At least FreeBSD, macOS, NetBSD, and OpenBSD can return unix sockets with non-null-terminated sun_path. Additionally, the address may become non-null-terminated if it does not fit into the buffer provided and was truncated (may happen on macOS, NetBSD, and Solaris, which allow unix socket addresess larger than struct sockaddr_un). As such, ngx_sock_ntop() might overread the sockaddr provided, as it used "%s" format and thus assumed null-terminated string. To fix this, the ngx_strnlen() function was introduced, and it is now used to calculate correct length of sun_path.
* Core: sockaddr lengths now respected by ngx_cmp_sockaddr().Maxim Dounin2016-10-10
| | | | | | | | | Linux can return AF_UNIX sockaddrs with partially filled sun_path, resulting in spurious comparison failures and failed binary upgrades. Added proper checking of the lengths provided. Reported by Jan Seda, http://mailman.nginx.org/pipermail/nginx-devel/2016-September/008832.html.
* Core: introduced ngx_cidr_match() function.Dmitry Volyntsev2016-09-07
|
* Fixed build on MSVC.Roman Arutyunyan2016-06-20
|
* Introduced ngx_inet_get_port() and ngx_inet_set_port() functions.Roman Arutyunyan2016-06-20
|
* Fixed build on MSVC.Maxim Dounin2016-05-24
|
* Realip: port support in X-Real-IP and X-Forwarded-For.Dmitry Volyntsev2016-05-23
| | | | | | | | | | Now, the module extracts optional port which may accompany an IP address. This custom extension is introduced, among other things, in order to facilitate logging of original client ports. Addresses with ports are expected to be in the RFC 3986 format, that is, with IPv6 addresses in square brackets. E.g., "X-Real-IP: [2001:0db8::1]:12345" sets client port ($remote_port) to 12345.
* Introduced the ngx_sockaddr_t type.Ruslan Ermilov2016-05-23
| | | | It's properly aligned and can hold any supported sockaddr.
* Removed a surplus condition from ngx_parse_inet6_url().Ruslan Ermilov2016-05-11
| | | | No functional changes, since the condition was always true.
* Core: fixed port handling in ngx_parse_inet6_url().Valentin Bartenev2016-05-11
| | | | | This fixes buffer over-read when no port is specified in cases similar to 5df5d7d771f6, and catches missing port separator.
* Removed redundant "u" format specifier.Ruslan Ermilov2016-04-08
| | | | It is implied for "x" and "X".
* Fixed format specifiers in ngx_sprintf().Sergey Kandaurov2016-03-31
|
* Style.Ruslan Ermilov2016-03-30
|
* Core: allow strings without null-termination in ngx_parse_url().Piotr Sikora2016-02-26
| | | | | | | | | | This fixes buffer over-read while using variables in the "proxy_pass", "fastcgi_pass", "scgi_pass", and "uwsgi_pass" directives, where result of string evaluation isn't null-terminated. Found with MemorySanitizer. Signed-off-by: Piotr Sikora <piotrsikora@google.com>
* Fixed overflow detection in ngx_inet_addr().Valentin Bartenev2015-04-28
| | | | | | Overflow detection of the last octet might not work. Reported by Sergey Polovko.
* Overflow detection in ngx_inet_addr().Ruslan Ermilov2015-03-17
|
* Core: externalized ngx_cmp_sockaddr().Ruslan Ermilov2013-12-06
| | | | | It's also extended with the "cmp_port" argument to indicate whether ports should be compared as well, or only addresses.
* Core: guard use of AI_ADDRCONFIG.Ruslan Ermilov2013-08-05
| | | | | | Some systems (notably NetBSD and OpenBSD) lack AI_ADDRCONFIG support. Reported by Piotr Sikora.
* Fixed build with signed socklen_t and unix sockets.Maxim Dounin2013-08-05
| | | | | | | | This seems to be the case at least under Cygwin, where build was broken by 05ba5bce31e0 (1.5.3). Reported by Kevin Worthington, http://mailman.nginx.org/pipermail/nginx/2013-August/040028.html.
* Core: only resolve address families configured on the local system.Ruslan Ermilov2013-08-05
| | | | | | | | | | | | | | | This is done by passing AI_ADDRCONFIG to getaddrinfo(). On Linux, setting net.ipv6.conf.all.disable_ipv6 to 1 will now be respected. On FreeBSD, AI_ADDRCONFIG filtering is currently implemented by attempting to create a datagram socket for the corresponding family, which succeeds even if the system doesn't in fact have any addresses of that family configured. That is, if the system with IPv6 support in the kernel doesn't have IPv6 addresses configured, AI_ADDRCONFIG will filter out IPv6 only inside a jail without IPv6 addresses or with IPv6 disabled.
* Core: extended ngx_sock_ntop() with socklen parameter.Vladimir Homutov2013-07-11
| | | | | | On Linux, sockaddr length is required to process unix socket addresses properly due to unnamed sockets (which don't have sun_path set at all) and abstract namespace sockets.
* Fixed "proxy_pass" with IP address and no port (ticket #276).Ruslan Ermilov2013-01-10
| | | | | | | | | Upstreams created by "proxy_pass" with IP address and no port were broken in 1.3.10, by not initializing port in u->sockaddr. API change: ngx_parse_url() was modified to always initialize port (in u->sockaddr and in u->port), even for the u->no_resolve case; ngx_http_upstream() and ngx_http_upstream_add() were adopted.
* Properly initialize "struct in6_addr" with zeroes.Ruslan Ermilov2012-12-22
|
* Implemented IPv6 support for URLs specified using domain names.Ruslan Ermilov2012-12-17
| | | | | | | | | This includes "debug_connection", upstreams, "proxy_pass", etc. (ticket #92) To preserve compatibility, "listen" specified with a domain name selects the first IPv4 address, if available. If not available, the first IPv6 address will be used (ticket #186).
* Fixed URL parsing code.Ruslan Ermilov2012-12-17
| | | | | | The URL parsing code is not expected to initialize port from default port when in "no_resolve" mode. This got broken in r4671 for the case of IPv6 literals.
* Simplified URL parsing code.Ruslan Ermilov2012-12-17
| | | | | Except for the "listen" directive, "*" specified as a hostname is no longer treated specially.
* Support for IPv6 literals in proxy_pass and so on.Maxim Dounin2012-06-04
|
* Code reduction (no functional changes).Ruslan Ermilov2012-06-01
|
* Removed historical and now redundant syntax pre-checks in ngx_parse_url().Ruslan Ermilov2012-05-21
|
* Reduced the number of lines of code in ngx_inet_addr().Ruslan Ermilov2012-04-12
|
* Improved readability of the code that produces bitmask from prefix.Ruslan Ermilov2012-04-11
| | | | In collaboration with Maxim Dounin.
* In ngx_ptocidr(), check that the supplied prefix length is withinRuslan Ermilov2012-04-03
| | | | the allowed range.
* Fixed spelling in multiline C comments.Ruslan Ermilov2012-04-03
|
* Copyright updated.Maxim Konovalov2012-01-18
|
* Fixed port range checking.Ruslan Ermilov2011-10-25
|
* fix segfault in IPv6 parsing while processing invalid IPv4 address X.YYYY.ZIgor Sysoev2011-04-15
| | | | patch by Maxim Dounin
* fix u->one_addr handling in ngx_inet_resolve_host()Igor Sysoev2011-02-17
| | | | patch by Maxim Dounin
* fix double free(), introduced in r3268Igor Sysoev2009-12-07
|
* ngx_ptocidr() supports IPv6Igor Sysoev2009-11-03
|
* make ngx_inet6_ntop() non-staticIgor Sysoev2009-11-03
|
* change ngx_parse_addr() interfaceIgor Sysoev2009-11-02
|
* ngx_parse_addr()Igor Sysoev2009-11-02
|
* rename ngx_peer_addr_t to ngx_addr_tIgor Sysoev2009-11-02
|
* use sin6_addr.s6_addr instead of "(u_char *) & .sin6_addr"Igor Sysoev2009-11-02
|
* replace inet_addr() with ngx_inet_addr()Igor Sysoev2009-11-02
|
* use ngx_inet6_addr()Igor Sysoev2009-11-02
|