openwrt/package/network/config/ltq-vdsl-app/patches/201-sigterm.patch
Jan Hoffmann 9c0f94e955 ltq-vdsl-app: disconnect when service is stopped
Stop the connection when the control daemon is terminated. The code is
a modified version of the termination routine in version 4.23.1 of the
daemon (which doesn't support VR9 modems anymore).

This could also be implemented by calling the acos and acs commands via
dsl_cpe_pipe.sh in the init script. However, doing it in the daemon
itself has the advantage of also working if it is terminated in another
way (for example during sysupgrade).

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
(cherry picked from commit 1daaef31b3)
2022-06-07 21:36:58 +02:00

20 lines
618 B
Diff

--- a/src/dsl_cpe_control.c
+++ b/src/dsl_cpe_control.c
@@ -6504,7 +6504,7 @@ DSL_CPE_STATIC void DSL_CPE_Termination
/* ignore the signal, we'll handle by ourself */
signal (sig, SIG_IGN);
- if (sig == SIGINT)
+ if (sig == SIGINT || sig == SIGTERM)
{
DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX "terminated" DSL_CPE_CRLF));
DSL_CPE_Termination ();
@@ -6803,6 +6803,7 @@ DSL_int_t dsl_cpe_daemon (
#ifndef RTEMS
signal (SIGINT, DSL_CPE_TerminationHandler);
+ signal (SIGTERM, DSL_CPE_TerminationHandler);
#endif /* RTEMS*/
/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/