summaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-10-31 11:08:38 -0400
committerNick Mathewson <nickm@torproject.org>2012-11-14 23:16:23 -0500
commit4bec25c3cd8869fb4b0cb6f1139bc2672b5b14a7 (patch)
treee593e6ed630546b2894146cbda82ec96b6eb34c3 /src/or/connection.c
parentb7843ca5544e741e74fe5f93fb49579e01b468c8 (diff)
downloadtor-4bec25c3cd8869fb4b0cb6f1139bc2672b5b14a7.tar.gz
tor-4bec25c3cd8869fb4b0cb6f1139bc2672b5b14a7.zip
Add {No,}IPv{4,6}Traffic options to SOCKSPort
These options are for telling the SOCKSPort that it should allow or not allow connections to IPv4/IPv6 addresses. These aren't implemented yet; this is just the code to read the options and get them into the entrey_connection_t.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index bb175d0d6d..89ac8f5e7c 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1115,6 +1115,13 @@ connection_listener_new(const struct sockaddr *listensockaddr,
lis_conn->session_group = global_next_session_group--;
}
}
+ if (type == CONN_TYPE_AP) {
+ lis_conn->socks_ipv4_traffic = port_cfg->ipv4_traffic;
+ lis_conn->socks_ipv6_traffic = port_cfg->ipv6_traffic;
+ } else {
+ lis_conn->socks_ipv4_traffic = 1;
+ lis_conn->socks_ipv6_traffic = 1;
+ }
if (connection_add(conn) < 0) { /* no space, forget it */
log_warn(LD_NET,"connection_add for listener failed. Giving up.");
@@ -1348,6 +1355,8 @@ connection_init_accepted_conn(connection_t *conn,
TO_ENTRY_CONN(conn)->session_group = listener->session_group;
TO_ENTRY_CONN(conn)->nym_epoch = get_signewnym_epoch();
TO_ENTRY_CONN(conn)->socks_request->listener_type = listener->base_.type;
+ TO_ENTRY_CONN(conn)->ipv4_traffic_ok = listener->socks_ipv4_traffic;
+ TO_ENTRY_CONN(conn)->ipv6_traffic_ok = listener->socks_ipv6_traffic;
switch (TO_CONN(listener)->type) {
case CONN_TYPE_AP_LISTENER:
conn->state = AP_CONN_STATE_SOCKS_WAIT;