1 # This patch is to fix: |
|
2 # 16134419 rsyslogd forwarding over TCP does not detect server restart |
|
3 # which was fixed in upstream version 6.4.1; this patch is a minor variant |
|
4 # on the upstream patch, adapted for 6.2.0 . This can go away once we |
|
5 # upgrade to 6.4.1 or later, except for the CheckConnection() part in |
|
6 # runtime/netstrm.c which needs to make sure to return a value, as there |
|
7 # was a bug in the 6.4.1 code that failed to do this: |
|
8 # http://bugzilla.adiscon.com/show_bug.cgi?id=511 |
|
9 |
|
10 --- rsyslog/runtime/netstrm.c.orig 2012-01-09 06:05:45.000000000 -0800 |
|
11 +++ rsyslog/runtime/netstrm.c 2014-01-29 10:16:47.131765870 -0800 |
|
12 @@ -250,11 +250,13 @@ |
|
13 |
|
14 |
|
15 /* check connection - slim wrapper for NSD driver function */ |
|
16 -static void |
|
17 +static rsRetVal |
|
18 CheckConnection(netstrm_t *pThis) |
|
19 { |
|
20 + DEFiRet; |
|
21 ISOBJ_TYPE_assert(pThis, netstrm); |
|
22 - pThis->Drvr.CheckConnection(pThis->pDrvrData); |
|
23 + iRet = pThis->Drvr.CheckConnection(pThis->pDrvrData); |
|
24 + RETiRet; |
|
25 } |
|
26 |
|
27 |
|
28 --- rsyslog/runtime/netstrm.h~ 2011-12-01 02:26:19.000000000 -0800 |
|
29 +++ rsyslog/runtime/netstrm.h 2013-12-02 09:30:45.155766988 -0800 |
|
30 @@ -53,7 +53,7 @@ |
|
31 rsRetVal (*SetDrvrMode)(netstrm_t *pThis, int iMode); |
|
32 rsRetVal (*SetDrvrAuthMode)(netstrm_t *pThis, uchar*); |
|
33 rsRetVal (*SetDrvrPermPeers)(netstrm_t *pThis, permittedPeers_t*); |
|
34 - void (*CheckConnection)(netstrm_t *pThis); /* This is a trick mostly for plain tcp syslog */ |
|
35 + rsRetVal (*CheckConnection)(netstrm_t *pThis); /* This is a trick mostly for plain tcp syslog */ |
|
36 /* the GetSock() below is a hack to make imgssapi work. In the long term, |
|
37 * we should migrate imgssapi to a stream driver, which will relieve us of |
|
38 * this problem. Please note that nobody else should use GetSock(). Using it |
|
39 @@ -72,9 +72,10 @@ |
|
40 /* v4 */ |
|
41 rsRetVal (*EnableKeepAlive)(netstrm_t *pThis); |
|
42 ENDinterface(netstrm) |
|
43 -#define netstrmCURR_IF_VERSION 4 /* increment whenever you change the interface structure! */ |
|
44 +#define netstrmCURR_IF_VERSION 5 /* increment whenever you change the interface structure! */ |
|
45 /* interface version 3 added GetRemAddr() |
|
46 * interface version 4 added EnableKeepAlive() -- rgerhards, 2009-06-02 |
|
47 + * interface version 5 changed return of CheckConnection from void to rsRetVal -- alorbach, 2012-09-06 |
|
48 * */ |
|
49 |
|
50 /* prototypes */ |
|
51 --- rsyslog/runtime/nsd.h.orig 2012-01-09 06:05:45.000000000 -0800 |
|
52 +++ rsyslog/runtime/nsd.h 2013-12-02 09:21:26.146155301 -0800 |
|
53 @@ -65,7 +65,7 @@ |
|
54 rsRetVal (*SetMode)(nsd_t *pThis, int mode); /* sets a driver specific mode - see driver doc for details */ |
|
55 rsRetVal (*SetAuthMode)(nsd_t *pThis, uchar*); /* sets a driver specific mode - see driver doc for details */ |
|
56 rsRetVal (*SetPermPeers)(nsd_t *pThis, permittedPeers_t*); /* sets driver permitted peers for auth needs */ |
|
57 - void (*CheckConnection)(nsd_t *pThis); /* This is a trick mostly for plain tcp syslog */ |
|
58 + rsRetVal (*CheckConnection)(nsd_t *pThis); /* This is a trick mostly for plain tcp syslog */ |
|
59 rsRetVal (*GetSock)(nsd_t *pThis, int *pSock); |
|
60 rsRetVal (*SetSock)(nsd_t *pThis, int sock); |
|
61 /* GetSock() and SetSock() return an error if the driver does not use plain |
|
62 @@ -82,9 +82,10 @@ |
|
63 /* v5 */ |
|
64 rsRetVal (*EnableKeepAlive)(nsd_t *pThis); |
|
65 ENDinterface(nsd) |
|
66 -#define nsdCURR_IF_VERSION 5 /* increment whenever you change the interface structure! */ |
|
67 +#define nsdCURR_IF_VERSION 6 /* increment whenever you change the interface structure! */ |
|
68 /* interface version 4 added GetRemAddr() |
|
69 * interface version 5 added EnableKeepAlive() -- rgerhards, 2009-06-02 |
|
70 + * interface version 6 changed return of CheckConnection from void to rsRetVal -- alorbach, 2012-09-06 |
|
71 */ |
|
72 |
|
73 /* interface for the select call */ |
|
74 --- rsyslog/runtime/nsd_gtls.c~ 2012-01-09 06:05:45.000000000 -0800 |
|
75 +++ rsyslog/runtime/nsd_gtls.c 2013-12-02 10:14:55.324156585 -0800 |
|
76 @@ -1310,13 +1310,16 @@ |
|
77 * This is a dummy here. For details, check function common in ptcp driver. |
|
78 * rgerhards, 2008-06-09 |
|
79 */ |
|
80 -static void |
|
81 +static rsRetVal |
|
82 CheckConnection(nsd_t __attribute__((unused)) *pNsd) |
|
83 { |
|
84 + DEFiRet; |
|
85 nsd_gtls_t *pThis = (nsd_gtls_t*) pNsd; |
|
86 ISOBJ_TYPE_assert(pThis, nsd_gtls); |
|
87 |
|
88 - nsd_ptcp.CheckConnection(pThis->pTcp); |
|
89 + CHKiRet(nsd_ptcp.CheckConnection(pThis->pTcp)); |
|
90 +finalize_it: |
|
91 + RETiRet; |
|
92 } |
|
93 |
|
94 |
|
95 --- rsyslog/runtime/nsd_ptcp.c~ 2012-01-09 06:05:17.000000000 -0800 |
|
96 +++ rsyslog/runtime/nsd_ptcp.c 2013-12-02 10:13:48.561929979 -0800 |
|
97 @@ -726,9 +726,10 @@ |
|
98 * http://blog.gerhards.net/2008/06/getting-bit-more-reliability-from-plain.html |
|
99 * rgerhards, 2008-06-09 |
|
100 */ |
|
101 -static void |
|
102 +static rsRetVal |
|
103 CheckConnection(nsd_t *pNsd) |
|
104 { |
|
105 + DEFiRet; |
|
106 int rc; |
|
107 char msgbuf[1]; /* dummy */ |
|
108 nsd_ptcp_t *pThis = (nsd_ptcp_t*) pNsd; |
|
109 @@ -741,7 +742,10 @@ |
|
110 * need to close our side, too. |
|
111 */ |
|
112 sockClose(&pThis->sock); |
|
113 + ABORT_FINALIZE(RS_RET_IO_ERROR); |
|
114 } |
|
115 +finalize_it: |
|
116 + RETiRet; |
|
117 } |
|
118 |
|
119 |
|
120 --- rsyslog/tools/omfwd.c.orig 2012-01-09 06:05:45.000000000 -0800 |
|
121 +++ rsyslog/tools/omfwd.c 2013-12-02 09:01:51.293926230 -0800 |
|
122 @@ -310,7 +310,7 @@ |
|
123 |
|
124 alreadySent = 0; |
|
125 dbgprintf("omfwd: XXXX: pData %p, pNetStrm %p\n", pData, pData->pNetstrm); |
|
126 - netstrm.CheckConnection(pData->pNetstrm); /* hack for plain tcp syslog - see ptcp driver for details */ |
|
127 + CHKiRet(netstrm.CheckConnection(pData->pNetstrm)); /* hack for plain tcp syslog - see ptcp driver for details */ |
|
128 while(alreadySent != len) { |
|
129 lenSend = len - alreadySent; |
|
130 CHKiRet(netstrm.Send(pData->pNetstrm, buf+alreadySent, &lenSend)); |
|
131 @@ -319,6 +319,12 @@ |
|
132 } |
|
133 |
|
134 finalize_it: |
|
135 + if(iRet != RS_RET_OK) { |
|
136 + /* error! */ |
|
137 + dbgprintf("TCPSendBuf error %d, destruct TCP Connection!\n", iRet); |
|
138 + DestructTCPInstanceData(pData); |
|
139 + iRet = RS_RET_SUSPENDED; |
|
140 + } |
|
141 RETiRet; |
|
142 } |
|
143 |
|
144 @@ -363,6 +369,7 @@ |
|
145 { |
|
146 DEFiRet; |
|
147 instanceData *pData = (instanceData *) pvData; |
|
148 + dbgprintf("TCPSendPrepRetry performs a DestructTCPInstanceData\n"); |
|
149 |
|
150 assert(pData != NULL); |
|
151 DestructTCPInstanceData(pData); |
|
152 @@ -380,6 +387,7 @@ |
|
153 |
|
154 assert(pData != NULL); |
|
155 if(pData->pNetstrm == NULL) { |
|
156 + dbgprintf("TCPSendInit CREATE\n"); |
|
157 CHKiRet(netstrms.Construct(&pData->pNS)); |
|
158 /* the stream driver must be set before the object is finalized! */ |
|
159 CHKiRet(netstrms.SetDrvrName(pData->pNS, cs.pszStrmDrvr)); |
|
160 @@ -403,6 +411,7 @@ |
|
161 |
|
162 finalize_it: |
|
163 if(iRet != RS_RET_OK) { |
|
164 + dbgprintf("TCPSendInit FAILED with %d.\n", iRet); |
|
165 DestructTCPInstanceData(pData); |
|
166 } |
|
167 |
|