openwrt/package/network/config/ltq-vdsl-app/patches/300-ubus.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

51 lines
1.4 KiB
Diff

--- a/src/dsl_cpe_control.c
+++ b/src/dsl_cpe_control.c
@@ -177,6 +177,9 @@ extern DSL_Error_t DSL_CPE_Pipe_StaticRe
#endif /* INCLUDE_DSL_RESOURCE_STATISTICS*/
#endif
+extern void ubus_init();
+extern void ubus_deinit();
+
DSL_char_t *g_sFirmwareName1 = DSL_NULL;
DSL_FirmwareFeatures_t g_nFwFeatures1 = {DSL_FW_XDSLMODE_CLEANED, DSL_FW_XDSLFEATURE_CLEANED,
DSL_FW_XDSLFEATURE_CLEANED};
@@ -6806,6 +6809,8 @@ DSL_int_t dsl_cpe_daemon (
signal (SIGTERM, DSL_CPE_TerminationHandler);
#endif /* RTEMS*/
+ ubus_init();
+
/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/
for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++)
{
@@ -7260,6 +7265,7 @@ DSL_int_t dsl_cpe_daemon (
#endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */
DSL_CPE_CONTROL_EXIT:
+ ubus_deinit();
#ifdef INCLUDE_DSL_BONDING
DSL_CPE_BND_Stop((DSL_CPE_BND_Context_t*)pCtrlCtx->pBnd);
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,7 +11,7 @@ else
dsl_cpe_control_common_ldflags =
endif
-dsl_cpe_control_LDADD = -lpthread -lrt
+dsl_cpe_control_LDADD = -lpthread -lrt -lubox -lubus
if INCLUDE_DSL_CPE_DTI_SUPPORT
dsl_cpe_control_LDADD += -ldti_agent
@@ -66,7 +66,8 @@ dsl_cpe_control_SOURCES = \
dsl_cpe_control.c \
dsl_cpe_init_cfg.c \
dsl_cpe_linux.c \
- dsl_cpe_debug.c
+ dsl_cpe_debug.c \
+ dsl_cpe_ubus.c
dsl_cpe_control_SOURCES += \
$(dsl_cpe_control_dti_sources)