[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#471112: optional no warn upon when falling through to a default net



tags 471112 patch
done

For those of us tunneling through to corporate nets for a small subnet,
and otherwise wanting the default case to go through our own internet, the
warning messags stating tsocks is falling through to the default net on
every open() call is pointless.

The included patch gives a .tsocks.conf "fallback = nowarn" option.

All the arguments presented to date that the user might not be expecting
tsocks to fall for example if they're using tor through are moot, because
if people truly aren't expecting it to fall through, then they can either
set "fallback = yes", or keep "fallback = no".  If they set it to
"nowarn", then they know that tsocks only tunnels for those networks
defined in .tsocks.conf.


-- 
Tim Connors
Description: this patch accepts fallback = nowarn to suppress the warning
 that we're going offnet
Last-update: 2020-06-08
Author: Tim Connors <reportbug@rather.puzzling.org>

diff -u tsocks-1.8beta5+ds1/parser.c tsocks-1.8beta5+ds1.patched/parser.c
--- tsocks-1.8beta5+ds1/parser.c	2020-06-03 17:38:58.000000000 +1000
+++ tsocks-1.8beta5+ds1.patched/parser.c	2020-06-09 15:32:33.578070929 +1000
@@ -522,6 +522,7 @@
 				"once in configuration file.\n",
 				lineno, currentcontext->lineno);
 	} else {
+		if(!strcmp(v, "nowarn")) config->fallback = -1;
 		if(!strcmp(v, "yes")) config->fallback = 1;
 		if(!strcmp(v, "no")) config->fallback = 0;
 	}
diff -u tsocks-1.8beta5+ds1/tsocks.c tsocks-1.8beta5+ds1.patched/tsocks.c
--- tsocks-1.8beta5+ds1/tsocks.c	2020-06-03 17:38:58.000000000 +1000
+++ tsocks-1.8beta5+ds1.patched/tsocks.c	2020-06-09 15:33:03.686150245 +1000
@@ -295,11 +295,13 @@
    if (path->address == NULL) {
       if (path == &(config->defaultserver)) {
          if (config->fallback) {
-            show_msg(MSGERR, "Connection needs to be made "
-                             "via default server but "
-                             "the default server has not "
-                             "been specified. Fallback is 'yes' so "
-                             "Falling back to direct connection.\n");
+            if (config->fallback != -1) {
+               show_msg(MSGERR, "Connection needs to be made "
+                                "via default server but "
+                                "the default server has not "
+                                "been specified. Fallback is 'yes' so "
+                                "Falling back to direct connection.\n");
+            }
             return(realconnect(__fd, __addr, __len));
          } else {
            show_msg(MSGERR, "Connection needs to be made "
diff -u tsocks-1.8beta5+ds1/tsocks.conf.5 tsocks-1.8beta5+ds1.patched/tsocks.conf.5
--- tsocks-1.8beta5+ds1/tsocks.conf.5	2020-06-03 17:38:58.000000000 +1000
+++ tsocks-1.8beta5+ds1.patched/tsocks.conf.5	2020-06-09 15:34:32.046383013 +1000
@@ -129,7 +129,8 @@
 .TP
 .I fallback
 This directive allows one to fall back to direct connection if no default
-server present in the configuration and fallback = yes.
+server present in the configuration and fallback = yes or fallback = nowarn
+(to suppress a warning about falling back).
 If fallback = no or not specified and there is no default server, the 
 tsocks gives an error message and aborts.
 This parameter protects the user against accidentally establishing

Reply to: