1 |
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 |
--- ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/socket_bind.c 2006-02-04 11:16:48.000000000 -0800 |
3 |
+++ ipsvd-0.12.1/net/ipsvd-0.12.1/src/socket_bind.c 2014-04-23 20:54:30.000000000 -0700 |
4 |
@@ -32,2 +32,8 @@ |
5 |
} |
6 |
} |
7 |
+ |
8 |
+int socket_keepalive(int s) |
9 |
+{ |
10 |
+ int opt = 1; |
11 |
+ return setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,&opt,sizeof opt); |
12 |
+} |
13 |
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 |
--- ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/socket.h 2006-02-04 11:16:48.000000000 -0800 |
15 |
+++ ipsvd-0.12.1/net/ipsvd-0.12.1/src/socket.h 2014-04-23 20:54:30.000000000 -0700 |
16 |
@@ -19,4 +19,5 @@ |
17 |
|
18 |
extern void socket_tryreservein(int,int); |
19 |
+extern int socket_keepalive(int); |
20 |
|
21 |
#endif |
22 |
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 |
--- ipsvd-0.12.1.old/net/ipsvd-0.12.1/src/tcpsvd.c 2006-02-04 11:16:47.000000000 -0800 |
24 |
+++ ipsvd-0.12.1/net/ipsvd-0.12.1/src/tcpsvd.c 2014-04-23 20:54:30.000000000 -0700 |
25 |
@@ -33,7 +33,7 @@ |
26 |
|
27 |
#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" |
29 |
+#define USAGE " [-Ehkpv] [-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" |
30 |
#else |
31 |
-#define USAGE " [-Ehpv] [-u user] [-c n] [-C n:msg] [-b n] [-l name] [-i dir|-x cdb] [-t sec] 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" |
33 |
#endif |
34 |
|
35 |
@@ -55,4 +55,5 @@ |
36 |
unsigned long cmax =30; |
37 |
unsigned long timeout =0; |
38 |
+unsigned int keepalive =0; |
39 |
|
40 |
unsigned int ucspi =1; |
41 |
@@ -242,4 +243,6 @@ |
42 |
if ((fd_move(0, c) == -1) || (fd_copy(1, 0) == -1)) |
43 |
drop("unable to set filedescriptor"); |
44 |
+ if (keepalive) |
45 |
+ socket_keepalive(0); |
46 |
sig_uncatch(sig_term); |
47 |
sig_uncatch(sig_pipe); |
48 |
@@ -272,8 +275,8 @@ |
49 |
#ifdef SSLSVD |
50 |
while ((opt =getopt(argc, (const char **)argv, |
51 |
- "c:C:i:x:u:l:Eb:hpt:vVU:/:Z:K:")) != opteof) { |
52 |
+ "c:C:i:x:u:l:Eb:hkpt:vVU:/:Z:K:")) != opteof) { |
53 |
#else |
54 |
while ((opt =getopt(argc, (const char **)argv, |
55 |
- "c:C:i:x:u:l:Eb:hpt:vV")) != opteof) { |
56 |
+ "c:C:i:x:u:l:Eb:hpkt:vV")) != opteof) { |
57 |
#endif |
58 |
switch(opt) { |
59 |
@@ -298,4 +301,5 @@ |
60 |
case 'b': scan_ulong(optarg, &backlog); break; |
61 |
case 'h': lookuphost =1; break; |
62 |
+ case 'k': keepalive =1; break; |
63 |
case 'p': lookuphost =1; paranoid =1; break; |
64 |
case 't': scan_ulong(optarg, &timeout); break; |