aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorJan Hoffmann <jan@3e8.eu>2022-04-27 19:40:50 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2022-06-07 21:36:58 +0200
commit9c0f94e9551dd06455e93ac5e41b61b5cd1d2459 (patch)
tree74a23408968c2641d17d49e88478c8e9329c5402 /package/network
parent8f4b5fdd5f1a2a85f3b16da69a03edf1c3470369 (diff)
downloadupstream-9c0f94e9551dd06455e93ac5e41b61b5cd1d2459.tar.gz
upstream-9c0f94e9551dd06455e93ac5e41b61b5cd1d2459.tar.bz2
upstream-9c0f94e9551dd06455e93ac5e41b61b5cd1d2459.zip
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 1daaef31b35201a9c15a2084e25dac41b48c1867)
Diffstat (limited to 'package/network')
-rw-r--r--package/network/config/ltq-vdsl-app/patches/200-autoboot.patch75
-rw-r--r--package/network/config/ltq-vdsl-app/patches/201-sigterm.patch2
-rw-r--r--package/network/config/ltq-vdsl-app/patches/300-ubus.patch4
3 files changed, 78 insertions, 3 deletions
diff --git a/package/network/config/ltq-vdsl-app/patches/200-autoboot.patch b/package/network/config/ltq-vdsl-app/patches/200-autoboot.patch
index 5b882bf30f..cc6feb94aa 100644
--- a/package/network/config/ltq-vdsl-app/patches/200-autoboot.patch
+++ b/package/network/config/ltq-vdsl-app/patches/200-autoboot.patch
@@ -1,3 +1,10 @@
+This enables automatic connection after the control daemon is started,
+and also stops the connection on termination.
+
+Using the autoboot restart command is necessary because the stop command
+doesn't actually stop the connection, and would also leave the driver in
+a state where an explicit start command is necessary to connect again.
+
--- a/src/dsl_cpe_init_cfg.c
+++ b/src/dsl_cpe_init_cfg.c
@@ -27,7 +27,7 @@ DSL_InitData_t gInitCfgData =
@@ -9,3 +16,71 @@
DSL_CPE_AUTOBOOT_CFG_SET(DSL_FALSE, DSL_FALSE, DSL_FALSE),
DSL_CPE_TEST_MODE_CTRL_SET(DSL_TESTMODE_DISABLE),
DSL_CPE_LINE_ACTIVATE_CTRL_SET(DSL_G997_INHIBIT_LDSF, DSL_G997_INHIBIT_ACSF, DSL_G997_NORMAL_STARTUP),
+--- a/src/dsl_cpe_control.c
++++ b/src/dsl_cpe_control.c
+@@ -6515,10 +6515,13 @@ DSL_CPE_STATIC void DSL_CPE_Termination
+ DSL_CPE_STATIC DSL_void_t DSL_CPE_Termination (void)
+ {
+ #ifdef INCLUDE_DSL_CPE_CLI_SUPPORT
+- DSL_int_t nDevice = 0;
+ DSL_char_t buf[32] = "quit";
+ #endif
+
++ DSL_Error_t nRet = DSL_SUCCESS;
++ DSL_int_t nDevice = 0;
++ DSL_AutobootConfig_t sAutobootCfg;
++ DSL_AutobootControl_t sAutobootCtl;
+ DSL_CPE_Control_Context_t *pCtrlCtx;
+
+ pCtrlCtx = DSL_CPE_GetGlobalContext();
+@@ -6527,6 +6530,50 @@ DSL_CPE_STATIC DSL_void_t DSL_CPE_Termi
+ pCtrlCtx->bRun = DSL_FALSE;
+ }
+
++ for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; ++nDevice)
++ {
++ g_bWaitBeforeConfigWrite[nDevice] = DSL_TRUE;
++ g_bWaitBeforeLinkActivation[nDevice] = DSL_TRUE;
++ g_bWaitBeforeRestart[nDevice] = DSL_TRUE;
++
++ g_bAutoContinueWaitBeforeConfigWrite[nDevice] = DSL_FALSE;
++ g_bAutoContinueWaitBeforeLinkActivation[nDevice] = DSL_FALSE;
++ g_bAutoContinueWaitBeforeRestart[nDevice] = DSL_FALSE;
++
++ memset(&sAutobootCfg, 0x0, sizeof(DSL_AutobootConfig_t));
++ sAutobootCfg.data.nStateMachineOptions.bWaitBeforeConfigWrite = DSL_TRUE;
++ sAutobootCfg.data.nStateMachineOptions.bWaitBeforeLinkActivation = DSL_TRUE;
++ sAutobootCfg.data.nStateMachineOptions.bWaitBeforeRestart = DSL_TRUE;
++
++ nRet = (DSL_Error_t)DSL_CPE_Ioctl(
++ DSL_CPE_GetGlobalContext()->fd[nDevice],
++ DSL_FIO_AUTOBOOT_CONFIG_SET, (DSL_int_t)&sAutobootCfg);
++
++ if (nRet < DSL_SUCCESS)
++ {
++ DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
++ "Autoboot configuration for device (%d) failed!, nRet = %d!"
++ DSL_CPE_CRLF, nDevice, sAutobootCtl.accessCtl.nReturn));
++ }
++
++ memset(&sAutobootCtl, 0, sizeof(DSL_AutobootControl_t));
++ sAutobootCtl.data.nCommand = DSL_AUTOBOOT_CTRL_RESTART;
++
++ nRet = (DSL_Error_t)DSL_CPE_Ioctl(
++ DSL_CPE_GetGlobalContext()->fd[nDevice],
++ DSL_FIO_AUTOBOOT_CONTROL_SET, (DSL_int_t)&sAutobootCtl);
++
++ if (nRet < DSL_SUCCESS)
++ {
++ DSL_CCA_DEBUG(DSL_CCA_DBG_ERR, (DSL_CPE_PREFIX
++ "Autoboot restart for device (%d) failed!, nRet = %d!"
++ DSL_CPE_CRLF, nDevice, sAutobootCtl.accessCtl.nReturn));
++ }
++ }
++
++ DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX
++ "Autoboot restart executed" DSL_CPE_CRLF));
++
+ #ifdef INCLUDE_DSL_CPE_CLI_SUPPORT
+ for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++)
+ {
diff --git a/package/network/config/ltq-vdsl-app/patches/201-sigterm.patch b/package/network/config/ltq-vdsl-app/patches/201-sigterm.patch
index 68a416ce24..4e97835983 100644
--- a/package/network/config/ltq-vdsl-app/patches/201-sigterm.patch
+++ b/package/network/config/ltq-vdsl-app/patches/201-sigterm.patch
@@ -9,7 +9,7 @@
{
DSL_CCA_DEBUG(DSL_CCA_DBG_MSG, (DSL_CPE_PREFIX "terminated" DSL_CPE_CRLF));
DSL_CPE_Termination ();
-@@ -6756,6 +6756,7 @@ DSL_int_t dsl_cpe_daemon (
+@@ -6803,6 +6803,7 @@ DSL_int_t dsl_cpe_daemon (
#ifndef RTEMS
signal (SIGINT, DSL_CPE_TerminationHandler);
diff --git a/package/network/config/ltq-vdsl-app/patches/300-ubus.patch b/package/network/config/ltq-vdsl-app/patches/300-ubus.patch
index f218ea2208..d257ca2fc4 100644
--- a/package/network/config/ltq-vdsl-app/patches/300-ubus.patch
+++ b/package/network/config/ltq-vdsl-app/patches/300-ubus.patch
@@ -10,7 +10,7 @@
DSL_char_t *g_sFirmwareName1 = DSL_NULL;
DSL_FirmwareFeatures_t g_nFwFeatures1 = {DSL_FW_XDSLMODE_CLEANED, DSL_FW_XDSLFEATURE_CLEANED,
DSL_FW_XDSLFEATURE_CLEANED};
-@@ -6759,6 +6762,8 @@ DSL_int_t dsl_cpe_daemon (
+@@ -6806,6 +6809,8 @@ DSL_int_t dsl_cpe_daemon (
signal (SIGTERM, DSL_CPE_TerminationHandler);
#endif /* RTEMS*/
@@ -19,7 +19,7 @@
/* Open DSL_CPE_MAX_DSL_ENTITIES devices*/
for (nDevice = 0; nDevice < DSL_CPE_MAX_DSL_ENTITIES; nDevice++)
{
-@@ -7213,6 +7218,7 @@ DSL_int_t dsl_cpe_daemon (
+@@ -7260,6 +7265,7 @@ DSL_int_t dsl_cpe_daemon (
#endif /* INCLUDE_DSL_CPE_CLI_SUPPORT */
DSL_CPE_CONTROL_EXIT: