Why NGX_SOCKADDRLEN is 512?

Igor Sysoev igor at sysoev.ru
Tue Mar 1 10:58:09 MSK 2011


On Mar 1, 2011, at 10:28 , speedfirst wrote:

> For an IPv6, sizeof (struct sockaddr_in6) is only 28bytes, so why set
> NGX_SOCKADDRLEN 512?

src/core/ngx_inet.h

/*
 * TODO: autoconfigure NGX_SOCKADDRLEN and NGX_SOCKADDR_STRLEN as
 *       sizeof(struct sockaddr_storage)
 *       sizeof(struct sockaddr_un)
 *       sizeof(struct sockaddr_in6)
 *       sizeof(struct sockaddr_in)
 */

[...]

#if (NGX_HAVE_UNIX_DOMAIN)
#define NGX_SOCKADDRLEN       sizeof(struct sockaddr_un)
#else
#define NGX_SOCKADDRLEN       512
#endif

struct sockaddr_un size is about 110 bytes depending on platform.


--
Igor Sysoev
http://sysoev.ru/en/




More information about the nginx mailing list