diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-08-10 13:13:28 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-08-10 13:13:28 +0000 |
| commit | 845f6d553a48a74f12e9b80b7824d59da257bc82 (patch) | |
| tree | 9b7866822b51333f875fd4bf147ebdd811b9d009 /src/event | |
| parent | 7a8e33993a1322c11c583d96c5c47498fda12859 (diff) | |
| download | nginx-845f6d553a48a74f12e9b80b7824d59da257bc82.tar.gz nginx-845f6d553a48a74f12e9b80b7824d59da257bc82.tar.bz2 | |
ignore meaningless bits in CIDR and warn about them
Diffstat (limited to 'src/event')
| -rw-r--r-- | src/event/ngx_event.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/event/ngx_event.c b/src/event/ngx_event.c index d32fb7ffd..7a856d409 100644 --- a/src/event/ngx_event.c +++ b/src/event/ngx_event.c @@ -1038,8 +1038,9 @@ ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) #if (NGX_DEBUG) ngx_event_conf_t *ecf = conf; - ngx_event_debug_t *dc; + ngx_int_t rc; ngx_str_t *value; + ngx_event_debug_t *dc; struct hostent *h; ngx_inet_cidr_t in_cidr; @@ -1056,13 +1057,21 @@ ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) if (dc->addr != INADDR_NONE) { dc->mask = 0xffffffff; - return NGX_OK; + return NGX_CONF_OK; + } + + rc = ngx_ptocidr(&value[1], &in_cidr); + + if (rc == NGX_DONE) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "low address bits of %V are meaningless", &value[1]); + rc = NGX_OK; } - if (ngx_ptocidr(&value[1], &in_cidr) == NGX_OK) { + if (rc == NGX_OK) { dc->mask = in_cidr.mask; dc->addr = in_cidr.addr; - return NGX_OK; + return NGX_CONF_OK; } h = gethostbyname((char *) value[1].data); @@ -1084,7 +1093,7 @@ ngx_event_debug_connection(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) #endif - return NGX_OK; + return NGX_CONF_OK; } |
