summaryrefslogtreecommitdiffhomepage
path: root/src/core/ngx_inet.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-10-10Core: sockaddr lengths now respected by ngx_cmp_sockaddr().Maxim Dounin1-6/+13
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.
2016-09-07Core: introduced ngx_cidr_match() function.Dmitry Volyntsev1-0/+87
2016-06-20Fixed build on MSVC.Roman Arutyunyan1-1/+1
2016-06-20Introduced ngx_inet_get_port() and ngx_inet_set_port() functions.Roman Arutyunyan1-21/+62
2016-05-24Fixed build on MSVC.Maxim Dounin1-2/+2
2016-05-23Realip: port support in X-Real-IP and X-Forwarded-For.Dmitry Volyntsev1-0/+79
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.
2016-05-23Introduced the ngx_sockaddr_t type.Ruslan Ermilov1-3/+3
It's properly aligned and can hold any supported sockaddr.
2016-05-11Removed a surplus condition from ngx_parse_inet6_url().Ruslan Ermilov1-33/+30
No functional changes, since the condition was always true.
2016-05-11Core: fixed port handling in ngx_parse_inet6_url().Valentin Bartenev1-1/+6
This fixes buffer over-read when no port is specified in cases similar to 5df5d7d771f6, and catches missing port separator.
2016-04-08Removed redundant "u" format specifier.Ruslan Ermilov1-1/+1
It is implied for "x" and "X".
2016-03-31Fixed format specifiers in ngx_sprintf().Sergey Kandaurov1-1/+1
2016-03-30Style.Ruslan Ermilov1-10/+10
2016-02-26Core: allow strings without null-termination in ngx_parse_url().Piotr Sikora1-2/+4
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>
2015-04-28Fixed overflow detection in ngx_inet_addr().Valentin Bartenev1-5/+5
Overflow detection of the last octet might not work. Reported by Sergey Polovko.
2015-03-17Overflow detection in ngx_inet_addr().Ruslan Ermilov1-2/+6
2013-12-06Core: externalized ngx_cmp_sockaddr().Ruslan Ermilov1-0/+73
It's also extended with the "cmp_port" argument to indicate whether ports should be compared as well, or only addresses.
2013-08-05Core: guard use of AI_ADDRCONFIG.Ruslan Ermilov1-0/+2
Some systems (notably NetBSD and OpenBSD) lack AI_ADDRCONFIG support. Reported by Piotr Sikora.
2013-08-05Fixed build with signed socklen_t and unix sockets.Maxim Dounin1-1/+1
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.
2013-08-05Core: only resolve address families configured on the local system.Ruslan Ermilov1-0/+1
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.
2013-07-11Core: extended ngx_sock_ntop() with socklen parameter.Vladimir Homutov1-5/+17
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.
2013-01-10Fixed "proxy_pass" with IP address and no port (ticket #276).Ruslan Ermilov1-10/+4
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.
2012-12-22Properly initialize "struct in6_addr" with zeroes.Ruslan Ermilov1-1/+1
2012-12-17Implemented IPv6 support for URLs specified using domain names.Ruslan Ermilov1-29/+210
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).
2012-12-17Fixed URL parsing code.Ruslan Ermilov1-5/+5
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.
2012-12-17Simplified URL parsing code.Ruslan Ermilov1-30/+26
Except for the "listen" directive, "*" specified as a hostname is no longer treated specially.
2012-06-04Support for IPv6 literals in proxy_pass and so on.Maxim Dounin1-7/+30
2012-06-01Code reduction (no functional changes).Ruslan Ermilov1-19/+2
2012-05-21Removed historical and now redundant syntax pre-checks in ngx_parse_url().Ruslan Ermilov1-5/+0
2012-04-12Reduced the number of lines of code in ngx_inet_addr().Ruslan Ermilov1-5/+1
2012-04-11Improved readability of the code that produces bitmask from prefix.Ruslan Ermilov1-2/+2
In collaboration with Maxim Dounin.
2012-04-03In ngx_ptocidr(), check that the supplied prefix length is withinRuslan Ermilov1-0/+7
the allowed range.
2012-04-03Fixed spelling in multiline C comments.Ruslan Ermilov1-1/+1
2012-01-18Copyright updated.Maxim Konovalov1-0/+1
2011-10-25Fixed port range checking.Ruslan Ermilov1-3/+3
2011-04-15fix segfault in IPv6 parsing while processing invalid IPv4 address X.YYYY.ZIgor Sysoev1-1/+1
patch by Maxim Dounin
2011-02-17fix u->one_addr handling in ngx_inet_resolve_host()Igor Sysoev1-1/+1
patch by Maxim Dounin
2009-12-07fix double free(), introduced in r3268Igor Sysoev1-1/+0
2009-11-03ngx_ptocidr() supports IPv6Igor Sysoev1-26/+66
2009-11-03make ngx_inet6_ntop() non-staticIgor Sysoev1-4/+1
2009-11-02change ngx_parse_addr() interfaceIgor Sysoev1-22/+13
2009-11-02ngx_parse_addr()Igor Sysoev1-0/+63
2009-11-02rename ngx_peer_addr_t to ngx_addr_tIgor Sysoev1-3/+3
2009-11-02use sin6_addr.s6_addr instead of "(u_char *) & .sin6_addr"Igor Sysoev1-2/+2
2009-11-02replace inet_addr() with ngx_inet_addr()Igor Sysoev1-21/+18
2009-11-02use ngx_inet6_addr()Igor Sysoev1-28/+2
2009-11-02ngx_inet6_addr()Igor Sysoev1-0/+120
2009-10-26http listen unix domain socketsIgor Sysoev1-0/+14
2009-05-18delete unneeded fieldIgor Sysoev1-3/+0
2009-05-07IPv6 for Win32Igor Sysoev1-0/+14
2009-02-24prepare ngx_ptocidr() for IPv6Igor Sysoev1-13/+14