Skip to content

Fix route updating logic #3885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/platform/datapath_raw_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ RawUpdateRoute(
_In_ CXPLAT_ROUTE* SrcRoute
)
{
if (DstRoute->State == RouteResolved &&
DstRoute->Queue != SrcRoute->Queue) {
DstRoute->Queue = SrcRoute->Queue;
}

if (!DstRoute->TcpState.Syncd) {
DstRoute->TcpState.Syncd = TRUE;
//
Expand Down
10 changes: 7 additions & 3 deletions src/platform/datapath_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,10 +791,14 @@ CxPlatUpdateRoute(
_In_ CXPLAT_ROUTE* SrcRoute
)
{
if (SrcRoute->DatapathType == CXPLAT_DATAPATH_TYPE_RAW ||
(SrcRoute->DatapathType == CXPLAT_DATAPATH_TYPE_UNKNOWN &&
!IS_LOOPBACK(SrcRoute->RemoteAddress))) {
if (SrcRoute->DatapathType == CXPLAT_DATAPATH_TYPE_RAW) {
RawUpdateRoute(DstRoute, SrcRoute);
}
if (DstRoute->DatapathType != SrcRoute->DatapathType ||
(DstRoute->State == RouteResolved &&
DstRoute->Queue != SrcRoute->Queue)) {
DstRoute->Queue = SrcRoute->Queue;
DstRoute->DatapathType = SrcRoute->DatapathType;
}
}

3 changes: 2 additions & 1 deletion src/test/MsQuicTests.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ QuicTestNatPortRebind(
void
QuicTestNatAddrRebind(
_In_ int Family,
_In_ uint16_t KeepAlivePaddingSize
_In_ uint16_t KeepAlivePaddingSize,
_In_ bool RebindDatapathAddr
);

void
Expand Down
27 changes: 16 additions & 11 deletions src/test/bin/quic_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,12 +1554,22 @@ TEST_P(WithFamilyArgs, RebindAddr) {
};
ASSERT_TRUE(DriverClient.Run(IOCTL_QUIC_RUN_NAT_ADDR_REBIND, Params));
} else {
#ifdef _WIN32
if (!UseDuoNic) {
GTEST_SKIP_("Raw socket with 127.0.0.2/::2 is not supported");
}
QuicTestNatAddrRebind(GetParam().Family, 0, FALSE);
}
}

TEST_P(WithFamilyArgs, RebindDatapathAddr) {
#if defined(QUIC_API_ENABLE_PREVIEW_FEATURES)
if (UseQTIP) {
//
// NAT rebind doesn't make sense for TCP and QTIP.
//
return;
}
#endif
QuicTestNatAddrRebind(GetParam().Family, 0);
TestLoggerT<ParamType> Logger("QuicTestNatAddrRebind(datapath)", GetParam());
if (!TestingKernelMode) {
QuicTestNatAddrRebind(GetParam().Family, 0, TRUE);
}
}

Expand All @@ -1580,12 +1590,7 @@ TEST_P(WithRebindPaddingArgs, RebindAddrPadded) {
};
ASSERT_TRUE(DriverClient.Run(IOCTL_QUIC_RUN_NAT_PORT_REBIND, Params));
} else {
#ifdef _WIN32
if (!UseDuoNic) {
GTEST_SKIP_("Raw socket with 127.0.0.2/::2 is not supported");
}
#endif
QuicTestNatAddrRebind(GetParam().Family, GetParam().Padding);
QuicTestNatAddrRebind(GetParam().Family, GetParam().Padding, FALSE);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/bin/winkernel/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,8 @@ QuicTestCtlEvtIoDeviceControl(
QuicTestCtlRun(
QuicTestNatAddrRebind(
Params->RebindParams.Family,
Params->RebindParams.Padding));
Params->RebindParams.Padding,
FALSE));
break;

case IOCTL_QUIC_RUN_CHANGE_MAX_STREAM_ID:
Expand Down
11 changes: 9 additions & 2 deletions src/test/lib/HandshakeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ QuicTestNatPortRebind(
void
QuicTestNatAddrRebind(
_In_ int Family,
_In_ uint16_t KeepAlivePaddingSize
_In_ uint16_t KeepAlivePaddingSize,
_In_ bool RebindDatapathAddr
)
{
RebindContext Context;
Expand Down Expand Up @@ -533,7 +534,13 @@ QuicTestNatAddrRebind(
TEST_QUIC_SUCCEEDED(Connection.GetLocalAddr(OrigLocalAddr));
ReplaceAddressHelper AddrHelper(OrigLocalAddr.SockAddr, OrigLocalAddr.SockAddr);

AddrHelper.IncrementAddr();
if (RebindDatapathAddr) {
QuicAddrFromString(UseDuoNic ? ((Family == AF_INET) ? "127.0.0.1" : "::1") : ((Family == AF_INET) ? "192.168.1.11" : "fc00::1:11"),
OrigLocalAddr.GetPort(),
&AddrHelper.New);
} else {
AddrHelper.IncrementAddr();
}
if (KeepAlivePaddingSize) {
Connection.SetKeepAlivePadding(KeepAlivePaddingSize);
}
Expand Down