Merge pull request #304 from edk0/reject-expired

reject: Don't reject for expired K-lines
This commit is contained in:
Aaron Jones 2020-01-03 17:33:10 +00:00 committed by GitHub
commit 673fd77dd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -233,18 +233,29 @@ check_reject(rb_fde_t *F, struct sockaddr *addr)
rb_patricia_node_t *pnode;
reject_t *rdata;
delay_t *ddata;
/* Reject is disabled */
if (ConfigFileEntry.reject_after_count == 0 || ConfigFileEntry.reject_duration == 0)
return 0;
pnode = rb_match_ip(reject_tree, addr);
if(pnode != NULL)
{
rdata = pnode->data;
if (pnode == NULL)
return 0;
rdata = pnode->data;
rdata->time = rb_current_time();
if(rdata->count > (unsigned long)ConfigFileEntry.reject_after_count)
if (rdata->count <= (unsigned long)ConfigFileEntry.reject_after_count)
return 0;
if (rdata->aconf != NULL && rdata->aconf->status & CONF_ILLEGAL)
{
rb_dlinkDelete(&rdata->rnode, &reject_list);
reject_free(rdata);
rb_patricia_remove(reject_tree, pnode);
return 0;
}
ddata = rb_malloc(sizeof(delay_t));
ServerStats.is_rej++;
rb_setselect(F, RB_SELECT_WRITE | RB_SELECT_READ, NULL, NULL);
@ -268,10 +279,6 @@ check_reject(rb_fde_t *F, struct sockaddr *addr)
rb_dlinkAdd(ddata, &ddata->node, &delay_exit);
return 1;
}
}
/* Caller does what it wants */
return 0;
}
int
is_reject_ip(struct sockaddr *addr)