Support IP accept list

This commit is contained in:
Nick Peng
2019-06-15 11:57:05 +08:00
parent 9a067e99c7
commit a09e63d333
7 changed files with 56 additions and 19 deletions

View File

@@ -962,11 +962,11 @@ static int _dns_server_ip_rule_check(struct dns_request *request, unsigned char
}
if (node == NULL) {
return -1;
goto rule_not_found;
}
if (node->data == NULL) {
return -1;
goto rule_not_found;
}
/* bogux-nxdomain */
@@ -986,7 +986,17 @@ static int _dns_server_ip_rule_check(struct dns_request *request, unsigned char
if (rule->ip_ignore) {
goto skip;
}
rule_not_found:
if (result_flag & DNSSERVER_FLAG_ACCEPT_IP) {
if (rule == NULL) {
goto skip;
}
if (!rule->ip_accept) {
goto skip;
}
}
return -1;
skip:
return -2;