Skip to content

Commit

Permalink
Some minor cleanup to WindowsRouteMonitor
Browse files Browse the repository at this point in the history
We should flush the cloned routes in the destructor, and tidy up
a couple bits of lint while we're at it
  • Loading branch information
oskirby committed Jul 2, 2024
1 parent 8de0b4f commit 99a7a82
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/platforms/windows/daemon/windowsroutemonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ WindowsRouteMonitor::WindowsRouteMonitor(quint64 luid, QObject* parent)
WindowsRouteMonitor::~WindowsRouteMonitor() {
MZ_COUNT_DTOR(WindowsRouteMonitor);
CancelMibChangeNotify2(m_routeHandle);
flushExclusionRoutes();

flushRouteTable(m_exclusionRoutes);
flushRouteTable(m_clonedRoutes);
logger.debug() << "WindowsRouteMonitor destroyed.";
}

Expand Down Expand Up @@ -180,7 +182,7 @@ void WindowsRouteMonitor::updateExclusionRoute(MIB_IPFORWARD_ROW2* data,
}

// If neither the interface nor next-hop have changed, then do nothing.
if ((data->InterfaceLuid.Value) == bestLuid &&
if (data->InterfaceLuid.Value == bestLuid &&
memcmp(&nexthop, &data->NextHop, sizeof(SOCKADDR_INET)) == 0) {
return;
}
Expand Down Expand Up @@ -216,7 +218,7 @@ bool WindowsRouteMonitor::routeContainsDest(const IP_ADDRESS_PREFIX* route,
if (route->Prefix.si_family == AF_INET) {
return prefixcmp(&route->Prefix.Ipv4.sin_addr, &dest->Prefix.Ipv4.sin_addr,
route->PrefixLength) == 0;
} if (route->Prefix.si_family == AF_INET6) {
} else if (route->Prefix.si_family == AF_INET6) {
return prefixcmp(&route->Prefix.Ipv6.sin6_addr,
&dest->Prefix.Ipv6.sin6_addr, route->PrefixLength) == 0;
} else {
Expand Down

0 comments on commit 99a7a82

Please sign in to comment.