From 11158b844d09ab82dc8f3d98bc25c48be18a4695 Mon Sep 17 00:00:00 2001 From: Jussi Laakkonen Date: Fri, 9 Oct 2020 16:33:32 +0300 Subject: [PATCH] [settings-vpn] Add ping, ping-exit and remap-usr1 to OpenVPN provisioning. JB#51497 Support ping, ping-exit and remap-usr1 values loaded from OpenVPN config. remap-usr1 should have either SIGHUP or SIGTERM but verification is not done here. Prevent use of ping-restart and connect-retry-max as they should not be allowed with ConnMan, since both will mess up with the VPN connectivity when restarts happen. Add remap-usr1 as supported OpenVPN option --- src/settingsvpnmodel.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/settingsvpnmodel.cpp b/src/settingsvpnmodel.cpp index 158af7f..d2ab615 100644 --- a/src/settingsvpnmodel.cpp +++ b/src/settingsvpnmodel.cpp @@ -799,8 +799,26 @@ QVariantMap SettingsVpnModel::processOpenVpnProvisioningFile(QFile &provisioning if (!arguments.isEmpty()) { rv.insert(QStringLiteral("OpenVPN.RemoteCertTls"), arguments.join(QChar(' '))); } + } else if (directive == QStringLiteral("ping")) { + if (!arguments.isEmpty()) { + rv.insert(QStringLiteral("OpenVPN.Ping"), arguments.join(QChar(' '))); + } + } else if (directive == QStringLiteral("ping-exit")) { + if (!arguments.isEmpty()) { + rv.insert(QStringLiteral("OpenVPN.PingExit"), arguments.join(QChar(' '))); + } + } else if (directive == QStringLiteral("remap-usr1")) { + if (!arguments.isEmpty()) { + rv.insert(QStringLiteral("OpenVPN.RemapUsr1"), arguments.join(QChar(' '))); + } + } else if (directive == QStringLiteral("ping-restart")) { + // Ignore, must not be set with ConnMan + qInfo() << "Ignoring ping-restart with OpenVPN"; + } else if (directive == QStringLiteral("connect-retry-max")) { + // Ignore, must not be set with ConnMan + qInfo() << "Ignoring connect-retry-max with OpenVPN"; } else { - // A directive that connman does not care about - pass through to the config file + // A directive that ConnMan does not care about - pass through to the config file extraOptions.append(line); } }