summaryrefslogtreecommitdiff
path: root/accel-pppd/triton
AgeCommit message (Collapse)Author
2020-08-10triton: clear trig_epoll_events after readDmitry Kozlov
2019-12-24triton: small fixesDmitry Kozlov
2018-11-03triton: fix context schedule/wakeup raceGuillaume Nault
Allow triton_context_wakeup() to run before triton_context_schedule(). When that happens, triton_context_schedule() now lets the context running instead of putting it in sleep mode. Note that, even though triton now allows triton_context_wakeup() to happen before triton_context_schedule(), these two functions still need to be paired and not nested. That is, in a sequence like the following, triton_context_wakeup() triton_context_wakeup() triton_context_schedule() triton_context_schedule() the second triton_context_schedule() would put the context in sleep mode. No matter how many triton_context_wakeup() have been called, the first triton_context_schedule() "consumes" them all. Being immune to schedule/wakeup inversion allows to fix the pppd_compat module. This module needs to fork() to execute external programs. The parent then waits for completion of its child using triton_context_schedule(). When child terminates, the sigchld module runs a callback that has to call triton_context_wakeup() to resume execution of the parent. The problem is that there is no synchronisation between the parent and its child. When under stress, the child may execute faster than its parent and the sigchld callback might run triton_context_wakeup() before the parent had time to call triton_context_schedule(). Then accel-ppp might crash because the triton thread might have reset ctx->thread to NULL, making triton_context_wakeup() write to invalid memory when trying to insert the context in ctx->thread->wakeup_list[]. Synchronising the parent and its child completion's callback would require cooperation from triton_context_schedule(). Otherwise we would still have a time frame between the moment we let the callback waking up the context and the moment we put the context in sleep mode. Allowing schedule/wakeup call inversion in triton looks simpler since it avoids modifying the current API. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2018-10-26triton: make mempool.h self-contained even when MEMDEBUG is definedGuillaume Nault
If MEMDEBUG is defined, then we need to include "memdebug.h" to define 'md_free'. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2018-05-28triton: fixed improper lockingDmitry Kozlov
2018-03-06triton: prevent alloc_context function to be inlined (fixes improper stack ↵Dmitry Kozlov
size calculation)
2018-03-04fix build error with VALGRIND definedVladislav Grishenko
2018-03-02triton: more general fix of thread wake up crashVladislav Grishenko
after commit 287adbfc205c02eac375f55fb94f13c073faec97 gcc still may reorder alloca() and memset() calls. fix that with volatile access & memory barrier.
2017-12-28triton: fix crash due gcc mis-optimization of alloca()Vladislav Grishenko
since alloca() result is used indirectly, gcc 4.7.2 thinks the whole call can be dropped on any optimization level.
2017-12-27triton: fixed bugs introduced by previous commitDmitry Kozlov
2017-12-26reworked context prioritiesDmitry Kozlov
Introduced 4 priorities: 0 - management (cli) 1 - starting sessions (default priority) 2 - active sessions 3 - finishing sessions
2017-10-12triton: rewrited context sleeping implementationDmitry Kozlov
Instead of entering working thread into sleep triton saves machine context and stack on sleep and restores context/stack on wakeup. This saves costly new thread allocation.
2016-05-11triton: implement list_replace*()Guillaume Nault
Add list_replace() and list_replace_init(), as defined in Linux kernel sources. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2014-11-22remove trailing whitespacesDmitry Kozlov
2014-11-17triton: lock pending calls list in triton_cancel_call()Guillaume Nault
The pending_calls field of struct _triton_context_t can be concurrently used by other contexts. So it must only be accessed or modified under protection of the context's lock (like in triton_context_call() or ctx_thread()). Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2014-10-04radius: various bug fixesDmitry Kozlov
2014-10-04add include <sys/time.h> to triton.h (fixes complilation issue)Dmitry Kozlov
2014-10-03get rid of time(), use clock_gettime(CLOCK_MONOTONIC) insteadDmitry Kozlov
2014-09-22triton: make level triggered events oneshot (EPOLLONESHOT)Dmitry Kozlov
2014-09-22conf file: implemented ability to add suboptions into options in {} bracketsDmitry Kozlov
2014-09-22fixed compilation warningsDmitry Kozlov
2014-09-20rewrite of authentication/accounting proceduresDmitry Kozlov
This patch gets rid of synchronuos style of authentication/accounting. Synchronous style of authentication/accounting produced sleeping threads which becomes a problem when lots of sessions started/stopped and all they want authorization/accounting.
2014-09-13pppoe: start interfaces asynchronouslyDmitry Kozlov
When there are many interfaces to start accel-ppp stucks on startup because kernel slowly creates raw sockets. So starting this proccess asynchronous improves accel-ppp responsiveness
2014-09-09triton: fixed race conditionDmitry Kozlov
2014-06-03get out of SPINLOCK_INITIALIZER as it is not cross-platform compatibleDmitry Kozlov
2014-05-20triton: fix possible raceDmitry Kozlov
2014-05-18triton: fix possible raceDmitry Kozlov
2014-05-15triton: close file descriptors immediately in triton_unregister_handlerDmitry Kozlov
2014-05-12triton: improved epoll events handlingDmitry Kozlov
2014-04-11triton: implement list_first_entry()Guillaume Nault
* Add list_first_entry() to list.h * Declare parameter of list_empty() as const Both changes are already included in Linux kernel sources. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-11-07triton: use pthread_spinlock as spinlockDmitry Kozlov
Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
2013-08-15triton: do not call context close if it is marked as need free (f.e. context ↵Dmitry Kozlov
already called triton_context_unregister)
2013-07-24triton: Fix race upon terminationGuillaume Nault
The triton_terminate() function works by setting the need_close flag of each triton context, then queues this context for execution by a triton thread if not already running. But if the context is already being run by a triton thread, it may not notice that its need_close flag has been updated (this flag is only checked at the beginning of ctx_thread()). So if no other event wakes up that context (i.e. if ctx_thread() isn't run again), it will never terminate. This patch moves the need_close flag check at the end of ctx_thread() so that a triton context can take the need_close flag into account event if it's updated while running. The context spinlock is also used to protect the need_close flag as it is concurrently updated by triton_terminate(). Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-06-30mempool: set/check magic only if MEMDEBUG definedDmitry Kozlov
2013-06-30Revert "mempool: set/check magic only if MEMDEBUG defined"Dmitry Kozlov
This reverts commit 49b348dd38dcf89a057abebc0ffdf73748effa0a.
2013-06-30mempool: set/check magic only if MEMDEBUG definedDmitry Kozlov
2013-04-22triton: Automatic setting of thread-count parameterGuillaume Nault
Use the number of available processors to set the thread-count option if not given in configuration file. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2013-01-25cmake: use CMAKE_FIND_ROOT_PATH and LIB_SUFFIXKozlov 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-24ipool: implemneted net30 allocatorKozlov Dmitry
2012-09-05Add compilation checks for printf-style format stringsGuillaume Nault
Append the format() __attribute__ to function prototypes which use a format string. This allows GCC to check for consistency between the format string and its arguments when these functions are called. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
2012-08-29fix various typosKozlov Dmitry
2012-06-21fixed race on terminationKozlov Dmitry
2012-02-27core: increase stack sizeKozlov Dmitry
2012-02-02fix load module orderKozlov Dmitry
2012-01-16core: fix context unregister bugKozlov Dmitry
2011-12-27core: queue zero-priority context if number of threads is reached maximumKozlov Dmitry
2011-12-27implemented logging to system loggerKozlov Dmitry
2011-12-27Revert "implemented logging to system logger"Kozlov Dmitry
This reverts commit ee41cba691ab9f6461f4933461cf82be161333de.
2011-12-27implemented logging to system loggerKozlov Dmitry