[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #5127 [Obfsproxy]: Fix IPv6 support in obfsproxy
#5127: Fix IPv6 support in obfsproxy
-----------------------+----------------------------------------------------
Reporter: karsten | Owner: asn
Type: defect | Status: new
Priority: normal | Milestone:
Component: Obfsproxy | Version:
Keywords: | Parent:
Points: | Actualpoints:
-----------------------+----------------------------------------------------
Comment(by murble):
diff --git a/src/util.c b/src/util.c
index b820981..422280e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -172,7 +172,7 @@ resolve_address_port(const char *address, int nodns,
int pas
char *a = xstrdup(address), *cp;
const char *portstr;
- if ((cp = strchr(a, ':'))) {
+ if ((cp = strrchr(a, ':'))) {
portstr = cp+1;
*cp = '\0';
} else if (default_port) {
is sufficient for basic stuff like:
./obfsproxy --no-safe-logging --log-min-severity=debug obfs2
--dest=::1:1025 server ::1:1024
./obfsproxy --no-safe-logging --log-min-severity=debug obfs2
--dest=::1:1024 client ::1:1234
to work, but IPv6 addresses are not printed correctly:
z.B
2012-02-15 21:40:12 [debug] obfs2: Parsed options nicely!
2012-02-15 21:40:12 [debug] Now listening on [0.0.0.0]:1024 for protocol
obfs2.
2012-02-15 21:40:35 [debug] [0.0.0.0]:1024: new connection from
[0.0.0.0]:55993 (1 total)
2012-02-15 21:40:35 [debug] [0.0.0.0]:55993: server connection
2012-02-15 21:40:35 [info] [0.0.0.0]:55993 (obfs2): Successful outbound
connection to '[0.0.0.0]:1025'.
the problem is in printable_address() due to a typo:
@@ -243,7 +243,7 @@ printable_address(struct sockaddr *addr, socklen_t
addrlen)
case AF_INET6: {
char abuf[INET6_ADDRSTRLEN];
struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)addr;
- if (!inet_ntop(AF_INET, &sin6->sin6_addr, abuf, INET6_ADDRSTRLEN))
+ if (!inet_ntop(AF_INET6, &sin6->sin6_addr, abuf, INET6_ADDRSTRLEN))
break;
obfs_snprintf(apbuf, sizeof apbuf, "[%s]:%d", abuf,
ntohs(sin6->sin6_port));
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/5127#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs