From 363cf024553741524c0c8cb9fa8b9226863c903b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 14 Nov 2012 10:09:06 -0500 Subject: Implement a PreferIPv6 flag for SocksPorts --- src/or/connection_edge.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/or/connection_edge.c') diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 758d8f5d87..4f3dda2842 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1682,6 +1682,13 @@ connection_ap_get_begincell_flags(entry_connection_t *ap_conn) } } + if (flags == BEGIN_FLAG_IPV6_OK) { + /* When IPv4 and IPv6 are both allowed, consider whether to say we + * prefer IPv6. Otherwise there's no point in declaring a preference */ + if (ap_conn->prefer_ipv6_traffic) + flags |= BEGIN_FLAG_IPV6_PREFERRED; + } + if (flags == BEGIN_FLAG_IPV4_NOT_OK) { log_warn(LD_BUG, "Hey; I'm about to ask a node for a connection that I " "am telling it to fulfil with neither IPv4 nor IPv6. That's " -- cgit v1.2.3-54-g00ecf