diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2016-10-26 14:00:48 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-11-12 10:33:42 +0300 |
commit | 35aa665337499ac83a1dbd46b0f77a57b82fd993 (patch) | |
tree | fba106ac91f776989b847f0ed52821eda6525f1c /accel-pppd | |
parent | 810d23477a9ca33dfa2379c3fc742c3c56df3a9d (diff) | |
download | accel-ppp-35aa665337499ac83a1dbd46b0f77a57b82fd993.tar.gz accel-ppp-35aa665337499ac83a1dbd46b0f77a57b82fd993.zip |
l2tp: fix l2tp_ctx_switch()
There are three different triton contexts that use l2tp_ctx_switch() as
their ->before_switch callback (main UDP server, L2TP control and L2TP
data).
In UDP server and L2TP control contexts, l2tp_ctx_switch() is called
with 'arg' == NULL. Only L2TP data contexts pass an ap_session pointer.
So we have to check 'arg' before setting 'net' or accel-ppp would
segfaults.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 5d9041f..bb3df4d 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -255,8 +255,13 @@ static inline int nsnr_cmp(uint16_t ns, uint16_t nr) static void l2tp_ctx_switch(struct triton_context_t *ctx, void *arg) { - struct ap_session *s = arg; - net = s->net; + struct ap_session *apses = arg; + + if (apses) + net = apses->net; + else + net = def_net; + log_switch(ctx, arg); } |