Skip to content

Commit d5a8344

Browse files
committed
🐛 ngx_http_waf_check
1 parent 8b3e416 commit d5a8344

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

inc/ngx_http_waf_module_check.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ static ngx_int_t ngx_http_waf_check_cc_ipv4(ngx_http_request_t* r, ngx_int_t* ou
168168

169169
unsigned long ipv4 = sin->sin_addr.s_addr;
170170

171-
if (srv_conf->ngx_waf_cc_deny == 0 || srv_conf->ngx_waf_cc_deny == NGX_CONF_UNSET) {
171+
if (srv_conf->waf_cc_deny == 0 || srv_conf->waf_cc_deny == NGX_CONF_UNSET) {
172172
return NOT_MATCHED;
173173
}
174-
if (srv_conf->ngx_waf_cc_deny_limit == NGX_CONF_UNSET
175-
|| srv_conf->ngx_waf_cc_deny_duration == NGX_CONF_UNSET) {
174+
if (srv_conf->waf_cc_deny_limit == NGX_CONF_UNSET
175+
|| srv_conf->waf_cc_deny_duration == NGX_CONF_UNSET) {
176176
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "ngx_waf: CC-DENY-CONF-INVALID");
177177
return NOT_MATCHED;
178178
}
@@ -199,11 +199,11 @@ static ngx_int_t ngx_http_waf_check_cc_ipv4(ngx_http_request_t* r, ngx_int_t* ou
199199
HASH_ADD_INT(srv_conf->ipv4_times, key, hash_item);
200200
}
201201
else {
202-
if (difftime(now, hash_item->start_time) >= srv_conf->ngx_waf_cc_deny_duration * 60.0) {
202+
if (difftime(now, hash_item->start_time) >= srv_conf->waf_cc_deny_duration * 60.0) {
203203
HASH_DEL(srv_conf->ipv4_times, hash_item);
204204
}
205205
else {
206-
if (hash_item->times > (ngx_uint_t)srv_conf->ngx_waf_cc_deny_limit) {
206+
if (hash_item->times > (ngx_uint_t)srv_conf->waf_cc_deny_limit) {
207207
ctx->blocked = TRUE;
208208
strcpy((char*)ctx->rule_type, "CC-DENY");
209209
strcpy((char*)ctx->rule_deatils, "");
@@ -420,7 +420,7 @@ static ngx_int_t ngx_http_waf_free_hash_table(ngx_http_request_t* r, ngx_http_wa
420420
}
421421
for (; srv_conf->ipv4_times_old_cur != NULL && count < 100; srv_conf->ipv4_times_old_cur = p->hh.next) {
422422
/* 判断当前的记录是否过期 */
423-
if (difftime(now, srv_conf->ipv4_times_old_cur->start_time) < srv_conf->ngx_waf_cc_deny_duration * 60.0) {
423+
if (difftime(now, srv_conf->ipv4_times_old_cur->start_time) < srv_conf->waf_cc_deny_duration * 60.0) {
424424
/* 在新的哈希表中查找是否存在当前记录 */
425425
HASH_FIND_INT(srv_conf->ipv4_times, &srv_conf->ipv4_times_old_cur->key, p);
426426
if (p == NULL) {

0 commit comments

Comments
 (0)