commit 95528585c1d13b0e17e9d35387c45adec9774457
Author: Jacob Appelbaum <jacob(a)appelbaum.net>
Date: Sun Nov 4 22:58:40 2012 +0000
First stab at ensuring IPv6 connections are dropped on the floor.
This almost certainly does not solve all cases and this is a work in
progress.
---
src/torsocks.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/torsocks.c b/src/torsocks.c
index f559eec..1c772be 100644
--- a/src/torsocks.c
+++ b/src/torsocks.c
@@ -296,6 +296,12 @@ int torsocks_connect_guts(CONNECT_SIGNATURE, int (*original_connect)(CONNECT_SIG
return -1;
}
+ /* If this is an INET6, we'll refuse it. */
+ if ((connaddr->sin_family == AF_INET6)) {
+ show_msg(MSGERR, "connect: Connection is IPv6: rejecting.\n");
+ return -1;
+ }
+
/* If this isn't an INET socket we can't */
/* handle it, just call the real connect now */
if ((connaddr->sin_family != AF_INET)) {