[wt4hq] tunnelsrv is crashing all the time
Olivier F5MZN
olecam at f5mzn.org
Sun Jul 15 06:03:27 CEST 2007
Hello,
Mario Lorenz wrote:
> Am 14. Jul 2007, um 14:28:38 schrieb Dieter Kritzer:
>> our linux-tunnelsrv is crashing very 5 minutes.
>>
>> any idea?
>
> I've found the bug. Finally. Extremely well hidden.
> in tx_proc the call to _send() has a "+1" in the end.
> That will make the if (nBytesSent == SOCKET_ERROR) wrong.
> SocketError is defined as -1, and the -1 error code is thus
> changed into a 0, so the whole error handling logic does
> not kick in.
> So when _send() hits an error (full buffer) it will go into
> a neverending loop...
>
> The problem we are having now is that the tunnel client, if the
> connection breaks for whatever reason, when trying to reconnect,
> will send garbage (wt protocol data) as username/password...
> But that requires fixing the client which we cannot do...
Wow, well seen Mario!!
Can you approve the following modification:
In the "int tx_proc(void)" function
Replace :
/* Try to send the bloc of data to the client */
/* Note that one must not send the null-terminal character! */
nBytesSent = _send(tun->sock, szBuffer, nBufferLen - 1, 0) + 1;
by
/* Try to send the bloc of data to the client */
/* Note that one must not send the null-terminal character! */
nBytesSent = _send(tun->sock, szBuffer, nBufferLen - 1, 0);
and replace:
/* Remove the sent bytes from the TX buffer */
buffer_read(&(tun->pszTxBuffer), &(tun->nTxBufferSize),
szBuffer, nBytesSent, 0);
by
/* Remove the sent bytes from the TX buffer */
buffer_read(&(tun->pszTxBuffer), &(tun->nTxBufferSize),
szBuffer, nBytesSent + 1, 0);
Regarding your suggestion amending MSG_NOSIGNAL. Is it enought to add
the MSG_NOSIGNAL here?
/*
* Send a buffers to the socket
*/
static int _send(SOCKET s, const char * buf, int len, int flags)
{
return send(s, buf, len, MSG_NOSIGNAL | flags);
}
I'll prepare the download area with these mods including without waiting
for your reply in order to give the other team the chance to have a
tunnel server working for the last hours of the contest!
After that I'll try to figure out what happens with the client.
Thanks a lot Mario!
--
Olivier / f5mzn
More information about the Wt4hq
mailing list