Update to net/tsocks
Tom Murphy
freebsd at pertho.net
Tue Jan 18 15:32:39 UTC 2011
Hi,
I know this app is rather ancient (last release 23rd October 2002), but
I found there's a rather annoying bug where tsocks just won't connect you
to the SOCKS server and gives back an error:
Error 56 attempting to connect to SOCKS server
I found a patch here at this URL which came out in 2005:
http://sourceforge.net/tracker/index.php?%20func=detail&aid=1252703&group_id=17338&atid=117338
I have applied it and all it needs are two extra files in net/tsocks/files:
patch-tsocks.c :
--- tsocks.c.orig 2011-01-18 15:03:09.000000000 +0000
+++ tsocks.c 2011-01-18 15:05:04.000000000 +0000
@@ -658,7 +658,7 @@ int poll(POLL_SIGNATURE) {
* come around again (since we can't flag it for read, we don't know
* if there is any data to be read and can't be bothered checking) */
if (conn->selectevents & WRITE) {
- setevents |= POLLOUT;
+ ufds[i].revents |= POLLOUT;
nevents++;
}
}
@@ -852,7 +852,11 @@ static int connect_server(struct connreq
sizeof(conn->serveraddr));
show_msg(MSGDEBUG, "Connect returned %d, errno is %d\n", rc, errno);
- if (rc) {
+ if (rc && errno == EISCONN) {
+ rc = 0;
+ show_msg(MSGDEBUG, "Socket %d already connected to SOCKS server\n", conn->sockid);
+ conn->state = CONNECTED;
+ } else if (rc) {
if (errno != EINPROGRESS) {
show_msg(MSGERR, "Error %d attempting to connect to SOCKS "
"server (%s)\n", errno, strerror(errno));
patch-tsocks.h:
--- tsocks.h.orig 2011-01-18 15:01:48.000000000 +0000
+++ tsocks.h 2011-01-18 15:03:00.000000000 +0000
@@ -75,9 +75,9 @@ struct connreq {
#define FAILED 14
/* Flags to indicate what events a socket was select()ed for */
-#define READ (1<<0)
-#define WRITE (1<<1)
-#define EXCEPT (1<<2)
+#define READ (POLLIN|POLLRDNORM)
+#define WRITE (POLLOUT|POLLWRNORM|POLLWRBAND)
+#define EXCEPT (POLLRDBAND|POLLPRI)
#define READWRITE (READ|WRITE)
#define READWRITEEXCEPT (READ|WRITE|EXCEPT)
Compiles on my amd64 FreeBSD 8.1-RELEASE machine just fine and actually
will now connect to the SOCKS server like it's supposed to.
Regards,
Tom
More information about the freebsd-ports
mailing list