1 |
diff -U4 -r net/ipsvd-0.12.1/src/socket_bind.c net.new/ipsvd-0.12.1/src/socket_bind.c |
diff -rN --unified=2 ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/socket_bind.c ipsvd-0.12.1/net/ipsvd-0.12.1/src/socket_bind.c |
2 |
--- net/ipsvd-0.12.1/src/socket_bind.c 2006-02-05 06:16:48.000000000 +1100 |
--- ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/socket_bind.c 2006-02-04 11:16:48.000000000 -0800 |
3 |
+++ net.new/ipsvd-0.12.1/src/socket_bind.c 2013-12-19 16:11:13.000000000 +1100 |
+++ ipsvd-0.12.1/net/ipsvd-0.12.1/src/socket_bind.c 2014-04-23 20:54:30.000000000 -0700 |
4 |
@@ -30,4 +30,10 @@ |
@@ -32,2 +32,8 @@ |
|
if (setsockopt(s,SOL_SOCKET,SO_RCVBUF,&size,sizeof size) == 0) return; |
|
|
size -= (size >> 5); |
|
5 |
} |
} |
6 |
} |
} |
7 |
+ |
+ |
10 |
+ int opt = 1; |
+ int opt = 1; |
11 |
+ return setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,&opt,sizeof opt); |
+ return setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,&opt,sizeof opt); |
12 |
+} |
+} |
13 |
diff -U4 -r net/ipsvd-0.12.1/src/socket.h net.new/ipsvd-0.12.1/src/socket.h |
diff -rN --unified=2 ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/socket.h ipsvd-0.12.1/net/ipsvd-0.12.1/src/socket.h |
14 |
--- net/ipsvd-0.12.1/src/socket.h 2006-02-05 06:16:48.000000000 +1100 |
--- ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/socket.h 2006-02-04 11:16:48.000000000 -0800 |
15 |
+++ net.new/ipsvd-0.12.1/src/socket.h 2013-12-19 16:11:42.000000000 +1100 |
+++ ipsvd-0.12.1/net/ipsvd-0.12.1/src/socket.h 2014-04-23 20:54:30.000000000 -0700 |
16 |
@@ -17,6 +17,7 @@ |
@@ -19,4 +19,5 @@ |
|
extern int socket_local4(int,char *,uint16 *); |
|
|
extern int socket_remote4(int,char *,uint16 *); |
|
17 |
|
|
18 |
extern void socket_tryreservein(int,int); |
extern void socket_tryreservein(int,int); |
19 |
+extern int socket_keepalive(int); |
+extern int socket_keepalive(int); |
20 |
|
|
21 |
#endif |
#endif |
22 |
diff -U4 -r net/ipsvd-0.12.1/src/tcpsvd.c net.new/ipsvd-0.12.1/src/tcpsvd.c |
diff -rN --unified=2 ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/tcpsvd.c ipsvd-0.12.1/net/ipsvd-0.12.1/src/tcpsvd.c |
23 |
--- net/ipsvd-0.12.1/src/tcpsvd.c 2006-02-05 06:16:47.000000000 +1100 |
--- ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/tcpsvd.c 2006-02-04 11:16:47.000000000 -0800 |
24 |
+++ net.new/ipsvd-0.12.1/src/tcpsvd.c 2013-12-19 16:24:28.000000000 +1100 |
+++ ipsvd-0.12.1/net/ipsvd-0.12.1/src/tcpsvd.c 2014-04-23 20:54:30.000000000 -0700 |
25 |
@@ -31,11 +31,11 @@ |
@@ -33,7 +33,7 @@ |
|
#include "ssl_io.h" |
|
|
#endif |
|
26 |
|
|
27 |
#ifdef SSLSVD |
#ifdef SSLSVD |
28 |
-#define USAGE " [-Ehpv] [-u user] [-c n] [-C n:msg] [-b n] [-l name] [-i dir|-x cdb] [-t sec] [-U ssluser] [-/ root] [-Z cert] [-K key] host port prog" |
-#define USAGE " [-Ehpv] [-u user] [-c n] [-C n:msg] [-b n] [-l name] [-i dir|-x cdb] [-t sec] [-U ssluser] [-/ root] [-Z cert] [-K key] host port prog" |
32 |
+#define USAGE " [-Ehkpv] [-u user] [-c n] [-C n:msg] [-b n] [-l name] [-i dir|-x cdb] [-t sec] host port prog" |
+#define USAGE " [-Ehkpv] [-u user] [-c n] [-C n:msg] [-b n] [-l name] [-i dir|-x cdb] [-t sec] host port prog" |
33 |
#endif |
#endif |
34 |
|
|
35 |
#define VERSION "$Id: tcpsvd.c,v 1.24 2006/02/03 19:30:24 pape Exp $" |
@@ -55,4 +55,5 @@ |
|
|
|
|
@@ -53,8 +53,9 @@ |
|
|
const char **prog; |
|
|
unsigned long cnum =0; |
|
36 |
unsigned long cmax =30; |
unsigned long cmax =30; |
37 |
unsigned long timeout =0; |
unsigned long timeout =0; |
38 |
+unsigned int keepalive =0; |
+unsigned int keepalive =0; |
39 |
|
|
40 |
unsigned int ucspi =1; |
unsigned int ucspi =1; |
41 |
const char *instructs =0; |
@@ -242,4 +243,6 @@ |
|
unsigned int iscdb =0; |
|
|
@@ -240,8 +241,10 @@ |
|
|
} |
|
|
else run =prog; |
|
42 |
if ((fd_move(0, c) == -1) || (fd_copy(1, 0) == -1)) |
if ((fd_move(0, c) == -1) || (fd_copy(1, 0) == -1)) |
43 |
drop("unable to set filedescriptor"); |
drop("unable to set filedescriptor"); |
44 |
+ if (keepalive) |
+ if (keepalive) |
45 |
+ socket_keepalive(0); |
+ socket_keepalive(0); |
46 |
sig_uncatch(sig_term); |
sig_uncatch(sig_term); |
47 |
sig_uncatch(sig_pipe); |
sig_uncatch(sig_pipe); |
48 |
sig_uncatch(sig_child); |
@@ -272,8 +275,8 @@ |
|
sig_unblock(sig_child); |
|
|
@@ -270,12 +273,12 @@ |
|
|
phccmax =0; |
|
|
|
|
49 |
#ifdef SSLSVD |
#ifdef SSLSVD |
50 |
while ((opt =getopt(argc, (const char **)argv, |
while ((opt =getopt(argc, (const char **)argv, |
51 |
- "c:C:i:x:u:l:Eb:hpt:vVU:/:Z:K:")) != opteof) { |
- "c:C:i:x:u:l:Eb:hpt:vVU:/:Z:K:")) != opteof) { |
56 |
+ "c:C:i:x:u:l:Eb:hpkt:vV")) != opteof) { |
+ "c:C:i:x:u:l:Eb:hpkt:vV")) != opteof) { |
57 |
#endif |
#endif |
58 |
switch(opt) { |
switch(opt) { |
59 |
case 'c': scan_ulong(optarg, &cmax); if (cmax < 1) usage(); break; |
@@ -298,4 +301,5 @@ |
|
case 'C': |
|
|
@@ -296,8 +299,9 @@ |
|
|
break; |
|
|
case 'E': ucspi =0; break; |
|
60 |
case 'b': scan_ulong(optarg, &backlog); break; |
case 'b': scan_ulong(optarg, &backlog); break; |
61 |
case 'h': lookuphost =1; break; |
case 'h': lookuphost =1; break; |
62 |
+ case 'k': keepalive =1; break; |
+ case 'k': keepalive =1; break; |
63 |
case 'p': lookuphost =1; paranoid =1; break; |
case 'p': lookuphost =1; paranoid =1; break; |
64 |
case 't': scan_ulong(optarg, &timeout); break; |
case 't': scan_ulong(optarg, &timeout); break; |
|
case 'v': ++verbose; break; |
|
|
#ifdef SSLSVD |
|