2011年2月28日星期一

Re: Why NGX_SOCKADDRLEN is 512?

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

没有评论:

发表评论