From 9b1834fd2cc713e637e0c8996d4369565406cbcc Mon Sep 17 00:00:00 2001 From: mtbishop Date: Sun, 8 Jul 2012 05:32:57 +0000 Subject: [PATCH] 2951972 - make vtund quiet about connections (Sean MacLennan) --- ChangeLog | 1 + Credits | 3 +++ client.c | 8 +++++--- main.c | 7 +++++-- vtun.h | 3 ++- vtund.8 | 8 +++++++- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b32397..494518c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ Add description of "keepalive timeout:count;" syntax to man page and vtund.conf sample. Remove doubled if(send_a_file){...} block in linkfd.c. + pat2951972 - reduce connection chatter 3.0.2: rfe1685781 - vtun3 client should parse vtun2 server encr directives (hch) diff --git a/Credits b/Credits index c7a5e5c..44dacd5 100644 --- a/Credits +++ b/Credits @@ -156,3 +156,6 @@ Sergey Popov (Pinkbyte) <@pinkbyte.ru> Eugene Berdnikov Link timeout in UDP mode (deb339364) Types cleanup + +Sean MacLennan + Reduce connection chatter diff --git a/client.c b/client.c index a49942b..eb7a981 100644 --- a/client.c +++ b/client.c @@ -17,7 +17,7 @@ */ /* - * $Id: client.c,v 1.11.2.2 2008/01/07 22:35:27 mtbishop Exp $ + * $Id: client.c,v 1.11.2.3 2012/07/08 05:32:57 mtbishop Exp $ */ #include "config.h" @@ -126,10 +126,12 @@ void client(struct vtun_host *host) io_init(); set_title("%s connecting to %s", host->host, vtun.svr_name); - vtun_syslog(LOG_INFO,"Connecting to %s", vtun.svr_name); + if (!vtun.quiet) + vtun_syslog(LOG_INFO,"Connecting to %s", vtun.svr_name); if( connect_t(s,(struct sockaddr *) &svr_addr, host->timeout) ){ - vtun_syslog(LOG_INFO,"Connect to %s failed. %s(%d)", vtun.svr_name, + if (!vtun.quiet || errno != ETIMEDOUT) + vtun_syslog(LOG_INFO,"Connect to %s failed. %s(%d)", vtun.svr_name, strerror(errno), errno); } else { if( auth_client(s, host) ){ diff --git a/main.c b/main.c index 33232c0..b5ffcc5 100644 --- a/main.c +++ b/main.c @@ -17,7 +17,7 @@ */ /* - * $Id: main.c,v 1.9.2.4 2012/07/07 07:14:17 mtbishop Exp $ + * $Id: main.c,v 1.9.2.5 2012/07/08 05:32:57 mtbishop Exp $ */ #include "config.h" @@ -92,7 +92,7 @@ int main(int argc, char *argv[], char *env[]) /* Start logging to syslog and stderr */ openlog("vtund", LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON); - while( (opt=getopt(argc,argv,"misf:P:L:t:np")) != EOF ){ + while( (opt=getopt(argc,argv,"misf:P:L:t:npq")) != EOF ){ switch(opt){ case 'm': if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) { @@ -123,6 +123,9 @@ int main(int argc, char *argv[], char *env[]) case 't': vtun.timeout = atoi(optarg); break; + case 'q': + vtun.quiet = 1; + break; default: usage(); exit(1); diff --git a/vtun.h b/vtun.h index f3d3cc9..5702518 100644 --- a/vtun.h +++ b/vtun.h @@ -17,7 +17,7 @@ */ /* - * $Id: vtun.h,v 1.12.2.5 2012/07/07 07:14:17 mtbishop Exp $ + * $Id: vtun.h,v 1.12.2.6 2012/07/08 05:32:57 mtbishop Exp $ */ #ifndef _VTUN_H @@ -219,6 +219,7 @@ struct vtun_opts { struct vtun_addr bind_addr; /* Server should listen on this address */ int svr_type; /* Server mode */ int syslog; /* Facility to log messages to syslog under */ + int quiet; /* Be quiet about common errors */ }; #define VTUN_STAND_ALONE 0 #define VTUN_INETD 1 diff --git a/vtund.8 b/vtund.8 index 240084b..26df6e5 100644 --- a/vtund.8 +++ b/vtund.8 @@ -1,5 +1,5 @@ .\" Manual page for vtund -.\" $Id: vtund.8,v 1.6.2.1 2007/06/29 05:26:43 mtbishop Exp $ +.\" $Id: vtund.8,v 1.6.2.2 2012/07/08 05:32:57 mtbishop Exp $ .\" SH section heading .\" SS subsection heading .\" LP paragraph @@ -37,6 +37,9 @@ vtund \- VTun(Virtual Tunnel) daemon. .I -p ] [ +.I -q +] +[ .I -m ] [ @@ -101,6 +104,9 @@ Reconnect to the server after connection termination. By default vtund will exit if connection has been terminated. This options is equivalent to the 'persist' option of config file. .TP +.I -q +Inhibit the printing of connection messages. +.TP .I -m Force memory pages to be locked memory-resident to prevent potential VM deadlock. Useful with NFS traffic. This option has no config file equivalent. .TP