mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-22 23:56:01 +00:00
Enable block list by default
This commit is contained in:
@@ -27,8 +27,8 @@
|
||||
#define WHITE_LIST 1
|
||||
|
||||
#define MAX_TRIES 128
|
||||
#define ATTACK 32
|
||||
#define BAD 8
|
||||
#define ATTACK 8
|
||||
#define BAD 4
|
||||
#define MALFORMED 1
|
||||
|
||||
int init_acl(const char *path);
|
||||
|
||||
+13
-9
@@ -308,7 +308,7 @@ report_addr(int fd, int err_level)
|
||||
}
|
||||
// Block all requests from this IP, if the err# exceeds 128.
|
||||
if (check_block_list(peer_name, err_level)) {
|
||||
LOGE("block all requests from %s", peer_name);
|
||||
LOGE("add %s to block list", peer_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1419,14 +1419,18 @@ accept_cb(EV_P_ ev_io *w, int revents)
|
||||
return;
|
||||
}
|
||||
|
||||
if (acl) {
|
||||
char *peer_name = get_peer_name(serverfd);
|
||||
if (peer_name != NULL) {
|
||||
if (check_block_list(peer_name, 0)
|
||||
|| (get_acl_mode() == BLACK_LIST && acl_match_host(peer_name) == 1)
|
||||
|| (get_acl_mode() == WHITE_LIST && acl_match_host(peer_name) >= 0)) {
|
||||
if (verbose)
|
||||
LOGI("Access denied from %s", peer_name);
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user