mirror of
https://github.com/nginx/nginx.git
synced 2025-06-09 19:12:47 +08:00
Fixed range checking for the "somaxconn" sysctl.
This commit is contained in:
parent
620718102b
commit
c5762451a9
@ -88,7 +88,6 @@ ngx_debug_init()
|
|||||||
ngx_int_t
|
ngx_int_t
|
||||||
ngx_os_specific_init(ngx_log_t *log)
|
ngx_os_specific_init(ngx_log_t *log)
|
||||||
{
|
{
|
||||||
int somaxconn;
|
|
||||||
size_t size;
|
size_t size;
|
||||||
ngx_err_t err;
|
ngx_err_t err;
|
||||||
ngx_uint_t i;
|
ngx_uint_t i;
|
||||||
@ -155,12 +154,9 @@ ngx_os_specific_init(ngx_log_t *log)
|
|||||||
|
|
||||||
ngx_ncpu = ngx_darwin_hw_ncpu;
|
ngx_ncpu = ngx_darwin_hw_ncpu;
|
||||||
|
|
||||||
somaxconn = 32676;
|
if (ngx_darwin_kern_ipc_somaxconn > 32767) {
|
||||||
|
|
||||||
if (ngx_darwin_kern_ipc_somaxconn > somaxconn) {
|
|
||||||
ngx_log_error(NGX_LOG_ALERT, log, 0,
|
ngx_log_error(NGX_LOG_ALERT, log, 0,
|
||||||
"sysctl kern.ipc.somaxconn must be no more than %d",
|
"sysctl kern.ipc.somaxconn must be less than 32768");
|
||||||
somaxconn);
|
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ ngx_debug_init()
|
|||||||
ngx_int_t
|
ngx_int_t
|
||||||
ngx_os_specific_init(ngx_log_t *log)
|
ngx_os_specific_init(ngx_log_t *log)
|
||||||
{
|
{
|
||||||
int version, somaxconn;
|
int version;
|
||||||
size_t size;
|
size_t size;
|
||||||
ngx_err_t err;
|
ngx_err_t err;
|
||||||
ngx_uint_t i;
|
ngx_uint_t i;
|
||||||
@ -210,12 +210,9 @@ ngx_os_specific_init(ngx_log_t *log)
|
|||||||
ngx_ncpu = ngx_freebsd_hw_ncpu;
|
ngx_ncpu = ngx_freebsd_hw_ncpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
somaxconn = version < 600008 ? 32676 : 65535;
|
if (version < 600008 && ngx_freebsd_kern_ipc_somaxconn > 32767) {
|
||||||
|
|
||||||
if (ngx_freebsd_kern_ipc_somaxconn > somaxconn) {
|
|
||||||
ngx_log_error(NGX_LOG_ALERT, log, 0,
|
ngx_log_error(NGX_LOG_ALERT, log, 0,
|
||||||
"sysctl kern.ipc.somaxconn must be no more than %d",
|
"sysctl kern.ipc.somaxconn must be less than 32768");
|
||||||
somaxconn);
|
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user