/[smeserver]/rpms/ipsvd/sme9/tcpsvd_keepalive.patch
ViewVC logotype

Contents of /rpms/ipsvd/sme9/tcpsvd_keepalive.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Dec 25 21:17:26 2013 UTC (10 years, 5 months ago) by charliebrady
Branch: MAIN
Add keepalive option for tcpsvd (Thanks Chris Maltby) - bug 8084/8078.

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

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed