From 773a2767c7a259618a3f7fe4803b5373d5c2c54c Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Tue, 21 Aug 2012 20:26:37 +0200 Subject: [PATCH] PPP, added missing pppapi_delete() thread safe function --- src/api/pppapi.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/api/pppapi.c b/src/api/pppapi.c index 341a945a..f06aa797 100644 --- a/src/api/pppapi.c +++ b/src/api/pppapi.c @@ -267,6 +267,27 @@ void pppapi_sighup(ppp_pcb *pcb) { } +/** + * Call ppp_delete() inside the tcpip_thread context. + */ +static void pppapi_do_ppp_delete(struct pppapi_msg_msg *msg) { + msg->err = ppp_delete(msg->ppp); + TCPIP_PPPAPI_ACK(msg); +} + +/** + * Call ppp_delete() in a thread-safe way by running that function inside the + * tcpip_thread context. + */ +int pppapi_delete(ppp_pcb *pcb) { + struct pppapi_msg msg; + msg.function = pppapi_do_ppp_delete; + msg.msg.ppp = pcb; + TCPIP_PPPAPI(&msg); + return msg.msg.err; +} + + /** * Call ppp_ioctl() inside the tcpip_thread context. */