diff --git a/src/platform/datapath_raw_socket.c b/src/platform/datapath_raw_socket.c index 3f6e21bc88..1ff4060e53 100644 --- a/src/platform/datapath_raw_socket.c +++ b/src/platform/datapath_raw_socket.c @@ -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; // diff --git a/src/platform/datapath_win.c b/src/platform/datapath_win.c index 1ba9cca243..ceb5763201 100644 --- a/src/platform/datapath_win.c +++ b/src/platform/datapath_win.c @@ -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; + } } diff --git a/src/test/MsQuicTests.h b/src/test/MsQuicTests.h index a69cabf2ef..05333b181b 100644 --- a/src/test/MsQuicTests.h +++ b/src/test/MsQuicTests.h @@ -358,7 +358,8 @@ QuicTestNatPortRebind( void QuicTestNatAddrRebind( _In_ int Family, - _In_ uint16_t KeepAlivePaddingSize + _In_ uint16_t KeepAlivePaddingSize, + _In_ bool RebindDatapathAddr ); void diff --git a/src/test/bin/quic_gtest.cpp b/src/test/bin/quic_gtest.cpp index 611bd73520..21db0eda5c 100644 --- a/src/test/bin/quic_gtest.cpp +++ b/src/test/bin/quic_gtest.cpp @@ -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 Logger("QuicTestNatAddrRebind(datapath)", GetParam()); + if (!TestingKernelMode) { + QuicTestNatAddrRebind(GetParam().Family, 0, TRUE); } } @@ -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); } } diff --git a/src/test/bin/winkernel/control.cpp b/src/test/bin/winkernel/control.cpp index 61c6134e7b..2427eb78b0 100644 --- a/src/test/bin/winkernel/control.cpp +++ b/src/test/bin/winkernel/control.cpp @@ -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: diff --git a/src/test/lib/HandshakeTest.cpp b/src/test/lib/HandshakeTest.cpp index ee500ada9b..5d130f1998 100644 --- a/src/test/lib/HandshakeTest.cpp +++ b/src/test/lib/HandshakeTest.cpp @@ -499,7 +499,8 @@ QuicTestNatPortRebind( void QuicTestNatAddrRebind( _In_ int Family, - _In_ uint16_t KeepAlivePaddingSize + _In_ uint16_t KeepAlivePaddingSize, + _In_ bool RebindDatapathAddr ) { RebindContext Context; @@ -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); }