feature/mozilla upstream (#1237)
* cherry-pick 4dfcad96506fb5b88c5bb27342b6d9413fc361c9 from mozilla upstream * cherry-pick a95fa8c088b9edaff2de18751336942c2d145a9a from mozilla * cherry-pick commit 4fc1ebbad86a9abcafdc761725a7afd811c8d2d3 from mozilla * cherry-pick 4dfcad96506fb5b88c5bb27342b6d9413fc361c9 from mozilla upstream * cherry-pick 22de4fcbd454c64ff496c3380eeaeeb6afff4d64 from mozilla upstream * cherry-pick 649673be561b66c96367adf379da1545f8838763 from mozilla upstream * cherry-pick 41bdad34517d0ddaef32139482e5505d92e4b533 from mozilla upstream * cherry-pick f6e49a85538eaa230d3a8634fa7600966132ccab from mozilla upstream * cherry-pick 86c585387efa0a09c7937dfe799a90a666404fcd from mozilla upstream * cherry-pick a18c1fac740469ca3566751b74a16227518630c4 from mozilla upstream * fixed missing ; * added excludeLocalNetworks() for linux * build fixes on windows after cherry-picks * Add rules for excluded sites splittunell mode * Fix app splittunell when ipv6 is not setup * Fix Linux build --------- Co-authored-by: Mykola Baibuz <mykola.baibuz@gmail.com>
This commit is contained in:
parent
f1c6067485
commit
8ca31e0c90
27 changed files with 1119 additions and 607 deletions
|
|
@ -11,6 +11,8 @@
|
|||
#include <winsock2.h>
|
||||
#include <ws2ipdef.h>
|
||||
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
#include "ipaddress.h"
|
||||
|
|
@ -19,28 +21,41 @@ class WindowsRouteMonitor final : public QObject {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WindowsRouteMonitor(QObject* parent);
|
||||
WindowsRouteMonitor(quint64 luid, QObject* parent);
|
||||
~WindowsRouteMonitor();
|
||||
|
||||
void setDetaultRouteCapture(bool enable);
|
||||
|
||||
bool addExclusionRoute(const IPAddress& prefix);
|
||||
bool deleteExclusionRoute(const IPAddress& prefix);
|
||||
void flushExclusionRoutes();
|
||||
void flushExclusionRoutes() { return flushRouteTable(m_exclusionRoutes); };
|
||||
|
||||
void setLuid(quint64 luid) { m_luid = luid; }
|
||||
quint64 getLuid() { return m_luid; }
|
||||
quint64 getLuid() const { return m_luid; }
|
||||
|
||||
public slots:
|
||||
void routeChanged();
|
||||
|
||||
private:
|
||||
bool isRouteExcluded(const IP_ADDRESS_PREFIX* dest) const;
|
||||
static bool routeContainsDest(const IP_ADDRESS_PREFIX* route,
|
||||
const IP_ADDRESS_PREFIX* dest);
|
||||
static QHostAddress prefixToAddress(const IP_ADDRESS_PREFIX* dest);
|
||||
|
||||
void flushRouteTable(QHash<IPAddress, MIB_IPFORWARD_ROW2*>& table);
|
||||
void updateExclusionRoute(MIB_IPFORWARD_ROW2* data, void* table);
|
||||
void updateValidInterfaces(int family);
|
||||
void updateInterfaceMetrics(int family);
|
||||
void updateCapturedRoutes(int family);
|
||||
void updateCapturedRoutes(int family, void* table);
|
||||
|
||||
QHash<IPAddress, MIB_IPFORWARD_ROW2*> m_exclusionRoutes;
|
||||
QList<quint64> m_validInterfacesIpv4;
|
||||
QList<quint64> m_validInterfacesIpv6;
|
||||
QMap<quint64, ULONG> m_interfaceMetricsIpv4;
|
||||
QMap<quint64, ULONG> m_interfaceMetricsIpv6;
|
||||
|
||||
quint64 m_luid = 0;
|
||||
// Default route cloning
|
||||
bool m_defaultRouteCapture = false;
|
||||
QHash<IPAddress, MIB_IPFORWARD_ROW2*> m_clonedRoutes;
|
||||
|
||||
const quint64 m_luid = 0;
|
||||
HANDLE m_routeHandle = INVALID_HANDLE_VALUE;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue