diff options
author | Roger Dingledine <arma@torproject.org> | 2004-10-25 06:16:26 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-10-25 06:16:26 +0000 |
commit | 0113a643a2e32b80931400e07d3b7389875570d1 (patch) | |
tree | e60392062eb6222025ca15fc02aed0186895711b /src/or/connection.c | |
parent | f084bc07b5157fce4d4b647310f152bcaac46c69 (diff) | |
download | tor-0113a643a2e32b80931400e07d3b7389875570d1.tar tor-0113a643a2e32b80931400e07d3b7389875570d1.tar.gz |
quick-and-dirty dir policy since the dirservers are getting hammered
nick, could you abstract this sometime so we don't repeat the
sockspolicy code twice?
svn:r2589
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 0c45b7fb2..0c3908ff0 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -420,6 +420,15 @@ static int connection_handle_listener_read(connection_t *conn, int new_type) { return 0; } } + if(new_type == CONN_TYPE_DIR) { + /* check dirpolicy to see if we should accept it */ + if(dir_policy_permits_address(ntohl(remote.sin_addr.s_addr)) == 0) { + log_fn(LOG_WARN,"Denying dir connection from address %s.", + inet_ntoa(remote.sin_addr)); + tor_close_socket(news); + return 0; + } + } newconn = connection_new(new_type); newconn->s = news; |