summaryrefslogtreecommitdiff
path: root/accel-pppd/cli/telnet.c
AgeCommit message (Collapse)Author
2017-12-26reworked context prioritiesDmitry Kozlov
Introduced 4 priorities: 0 - management (cli) 1 - starting sessions (default priority) 2 - active sessions 3 - finishing sessions
2016-04-28cli: flush pending data before disconnectingGuillaume Nault
The telnet and tcp servers disconnect as soon as they receive the 'exit' command or see a disconnection from the client. In this case, all data queued for transmission are lost. This can lead to truncated output when big amount of data is being sent. For example, on a moderately loaded server with a few thouthands connections, the output of the 'accel-cmd show sessions' command can be truncated. The problem is that accel-cmd sends the 'show sessions' command, followed by 'exit'. It does so because it has to stop running once all data has been received from the server. But it never knows whether more data are going to arrive. Disconnection must then come from the server, hence the use of 'exit' (although the same effect could be achieved with shutdown(SHUT_WR)). The telnet and tcp modules behave very similarly and are modified in the same way: * For a soft disconnection, cln_read() doesn't call disconnect() anymore if there are data queued for transmission. Instead it sets the 'disconnect' flag and stops listening to its peer (no need to process further messages). * cln_write() checks the 'disconnect' flag once it has sent all pending data and actually performs the disconnection if necessary. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2016-04-28cli: fix data output miss-orderingGuillaume Nault
In tcp and telnet backends, the first buffer been queued is directly pointed to by cln->xmit_buf. It's not added to cln->xmit_queue. Therefore testing if ->xmit_queue is empty doesn't reliably tells if data has already been queued. We should test if ->xmit_buf is non-NULL instead. This is reliable because ->xmit_buf is re-filled with the first buffer from ->xmit_queue after every successful write(). Failure to properly check if data has already been queued can lead to message miss-ordering because cli_client_send() or telnet_send() will try to directly write() their input buffer, effectively bypassing the one previously queued up in ->xmit_buf. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2016-04-28cli: fix partial line duplication and truncationGuillaume Nault
When queueing output data for later write(), the 'n' first bytes of the buffer have already been sent (we have n > 0 if EAGAIN was returned after some other write() calls succeeded). Therefore, we need to skip these bytes when initialising the buffer to be queued. The size passed to memcpy() did already take that space into account. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2014-11-22remove trailing whitespacesDmitry Kozlov
2014-10-22cli: introduced verbose optionDmitry Kozlov
If verbose=0 then cli won't produce any logging if verbose=1 then log only connections if verbose=2 then log also executed commands
2014-05-12triton: improved epoll events handlingDmitry Kozlov
2013-06-04use /var/lib/accel-ppp instead /var/run/accel-pppKozlov Dmitry
2013-01-24backport 1.7Kozlov Dmitry
* l2tp: Fix allocation checking when adding octets AVP * cli, tcp: Fix non-NULL terminated string reception * Fix va_end() missing calls * chap-secrets: implemented encryption * auth_pap: make messages like other auth modules * cli: check xmit_buf is not null at enter to write function * pppoe: implemented regular expression support * chap-secrets: implemented encryption * ippool: fixed initialization order * optional shaper compiling * ppp: dns/wins code cleanup
2013-01-24merge upstreamKozlov Dmitry
2012-07-19Merge commit '918036a3c42cb6dd5b796c52b6aaf278c466c928'Kozlov Dmitry
* commit '918036a3c42cb6dd5b796c52b6aaf278c466c928': cli: telnet: check for disconnect condition while processing input chars
2012-07-19cli: telnet: check for disconnect condition while processing input charsKozlov Dmitry
2012-07-11futher session backup implementationKozlov Dmitry
cli: introduced 'restart' command to restrat daemon
2012-06-19general preparation for IPoE integrationKozlov Dmitry
2012-01-13set FD_CLOEXEC on opened file descriptorsKozlov Dmitry
2011-05-30rewrited initialization procedure (fix gcc-4.6 builds)Kozlov Dmitry
2011-01-28cli: fixed buffer overflow in telnet partDmitry Kozlov
2011-01-26cli: save history to file when telnet client disconnectsDmitry Kozlov
2011-01-05rename accel-pptp to accel-pppDmitry Kozlov