mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-30 13:13:44 +00:00
Ignore IPs in white list. #899
This commit is contained in:
+8
-5
@@ -1436,19 +1436,22 @@ accept_cb(EV_P_ ev_io *w, int revents)
|
||||
|
||||
char *peer_name = get_peer_name(serverfd);
|
||||
if (peer_name != NULL) {
|
||||
if (check_block_list(peer_name, 0)) {
|
||||
LOGE("block all requests from %s", peer_name);
|
||||
close(serverfd);
|
||||
return;
|
||||
}
|
||||
int in_white_list = 0;
|
||||
if (acl) {
|
||||
if ((get_acl_mode() == BLACK_LIST && acl_match_host(peer_name) == 1)
|
||||
|| (get_acl_mode() == WHITE_LIST && acl_match_host(peer_name) >= 0)) {
|
||||
LOGE("Access denied from %s", peer_name);
|
||||
close(serverfd);
|
||||
return;
|
||||
} else if (acl_match_host(peer_name) == -1) {
|
||||
in_white_list = 1;
|
||||
}
|
||||
}
|
||||
if (!in_white_list && check_block_list(peer_name, 0)) {
|
||||
LOGE("block all requests from %s", peer_name);
|
||||
close(serverfd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int opt = 1;
|
||||
|
||||
Reference in New Issue
Block a user