resetIpStack added
This commit is contained in:
parent
5aa47d35e7
commit
343e6a50df
8 changed files with 42 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState sta
|
|||
{
|
||||
if (IpcClient::Interface()) {
|
||||
if (state == VpnProtocol::Connected){
|
||||
IpcClient::Interface()->resetIpStack();
|
||||
IpcClient::Interface()->flushDns();
|
||||
|
||||
if (m_settings.routeMode() != Settings::VpnAllSites) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class IpcInterface
|
|||
SLOT( bool clearSavedRoutes() );
|
||||
SLOT( bool routeDeleteList(const QString &gw, const QStringList &ip) );
|
||||
SLOT( void flushDns() );
|
||||
SLOT( void resetIpStack() );
|
||||
|
||||
SLOT( bool checkAndInstallDriver() );
|
||||
SLOT( QStringList getTapList() );
|
||||
|
|
|
|||
|
|
@ -83,6 +83,11 @@ void IpcServer::flushDns()
|
|||
return Router::flushDns();
|
||||
}
|
||||
|
||||
void IpcServer::resetIpStack()
|
||||
{
|
||||
Router::resetIpStack();
|
||||
}
|
||||
|
||||
bool IpcServer::checkAndInstallDriver()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public:
|
|||
virtual bool clearSavedRoutes() override;
|
||||
virtual bool routeDeleteList(const QString &gw, const QStringList &ips) override;
|
||||
virtual void flushDns() override;
|
||||
virtual void resetIpStack() override;
|
||||
virtual bool checkAndInstallDriver() override;
|
||||
virtual QStringList getTapList() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,3 +53,14 @@ void Router::flushDns()
|
|||
#endif
|
||||
}
|
||||
|
||||
void Router::resetIpStack()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
RouterWin::Instance().resetIpStack();
|
||||
#elif defined (Q_OS_MAC)
|
||||
// todo fixme
|
||||
#elif defined Q_OS_LINUX
|
||||
// todo fixme
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public:
|
|||
static bool clearSavedRoutes();
|
||||
static int routeDeleteList(const QString &gw, const QStringList &ips);
|
||||
static void flushDns();
|
||||
static void resetIpStack();
|
||||
};
|
||||
|
||||
#endif // ROUTER_H
|
||||
|
|
|
|||
|
|
@ -289,6 +289,27 @@ void RouterWin::flushDns()
|
|||
//qDebug().noquote() << "OUTPUT ipconfig /flushdns: " + p.readAll();
|
||||
}
|
||||
|
||||
void RouterWin::resetIpStack()
|
||||
{
|
||||
// {
|
||||
// QProcess p;
|
||||
// QString command = QString("ipconfig /release");
|
||||
// p.start(command);
|
||||
// }
|
||||
{
|
||||
QProcess p;
|
||||
QString command = QString("netsh int ip reset");
|
||||
p.start(command);
|
||||
p.waitForFinished();
|
||||
}
|
||||
{
|
||||
QProcess p;
|
||||
QString command = QString("netsh winsock reset");
|
||||
p.start(command);
|
||||
p.waitForFinished();
|
||||
}
|
||||
}
|
||||
|
||||
void RouterWin::suspendWcmSvc(bool suspend)
|
||||
{
|
||||
if (suspend == m_suspended) return;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
bool clearSavedRoutes();
|
||||
int routeDeleteList(const QString &gw, const QStringList &ips);
|
||||
void flushDns();
|
||||
void resetIpStack();
|
||||
|
||||
void suspendWcmSvc(bool suspend);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue