From 32b0fed3d7e4dd2573379c3cecfdb2224d6140f7 Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Mon, 28 Jul 2025 10:41:55 -0500 Subject: [PATCH 1/3] fix This resolves the issue where a ConnectionRequestMessage could not exceed the transport MTU size because it was using the ReliableSequenced and not the ReliableFragmentedSequenced pipeline. --- .../Runtime/Connection/NetworkConnectionManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs index 96f0223ef3..6514736f23 100644 --- a/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs +++ b/com.unity.netcode.gameobjects/Runtime/Connection/NetworkConnectionManager.cs @@ -635,7 +635,7 @@ private void SendConnectionRequest() } } - SendMessage(ref message, NetworkDelivery.ReliableSequenced, NetworkManager.ServerClientId); + SendMessage(ref message, NetworkDelivery.ReliableFragmentedSequenced, NetworkManager.ServerClientId); message.MessageVersions.Dispose(); } From e2fb66ced9c7fa9aa7610cb6168c47173a30d8cf Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Mon, 28 Jul 2025 10:44:09 -0500 Subject: [PATCH 2/3] test Adjusting the ConnectionApproval tests to use a NetworkConfig.ConnectionData array that is larger than the typical ~1300 byte MTU size (not taking headers into consideration). --- .../Tests/Runtime/ConnectionApproval.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/ConnectionApproval.cs b/com.unity.netcode.gameobjects/Tests/Runtime/ConnectionApproval.cs index efa19cffd5..fdf8cc3836 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/ConnectionApproval.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/ConnectionApproval.cs @@ -22,7 +22,7 @@ public enum PlayerCreation Prefab, PrefabHash, NoPlayer, - FailValidation + FailValidation, } private PlayerCreation m_PlayerCreation; private bool m_ClientDisconnectReasonValidated; @@ -38,7 +38,7 @@ public ConnectionApprovalTests(PlayerCreation playerCreation) protected override int NumberOfClients => 1; - private Guid m_ValidationToken; + private string m_ValidationToken; protected override bool ShouldCheckForSpawnedPlayers() { @@ -56,8 +56,13 @@ protected override void OnServerAndClientsCreated() m_ClientDisconnectReasonValidated = false; m_BypassConnectionTimeout = m_PlayerCreation == PlayerCreation.FailValidation; m_Validated.Clear(); - m_ValidationToken = Guid.NewGuid(); - var validationToken = Encoding.UTF8.GetBytes(m_ValidationToken.ToString()); + m_ValidationToken = string.Empty; + // Exceed the expected MTU size + while (m_ValidationToken.Length < 2000) + { + m_ValidationToken += Guid.NewGuid().ToString(); + } + var validationToken = Encoding.UTF8.GetBytes(m_ValidationToken); m_ServerNetworkManager.ConnectionApprovalCallback = NetworkManagerObject_ConnectionApprovalCallback; m_ServerNetworkManager.NetworkConfig.PlayerPrefab = m_PlayerCreation == PlayerCreation.Prefab ? m_PlayerPrefab : null; if (m_PlayerCreation == PlayerCreation.PrefabHash) @@ -66,7 +71,6 @@ protected override void OnServerAndClientsCreated() } m_ServerNetworkManager.NetworkConfig.ConnectionApproval = true; m_ServerNetworkManager.NetworkConfig.ConnectionData = validationToken; - foreach (var client in m_ClientNetworkManagers) { client.NetworkConfig.PlayerPrefab = m_PlayerCreation == PlayerCreation.Prefab ? m_PlayerPrefab : null; From 8fd8d5966a631985eaf3e3eca8acd323e346499e Mon Sep 17 00:00:00 2001 From: NoelStephensUnity Date: Mon, 28 Jul 2025 13:03:18 -0500 Subject: [PATCH 3/3] update Adding changelog entry. --- com.unity.netcode.gameobjects/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.netcode.gameobjects/CHANGELOG.md b/com.unity.netcode.gameobjects/CHANGELOG.md index d512887ec3..489af4f446 100644 --- a/com.unity.netcode.gameobjects/CHANGELOG.md +++ b/com.unity.netcode.gameobjects/CHANGELOG.md @@ -17,6 +17,7 @@ Additional documentation and release notes are available at [Multiplayer Documen ### Fixed +- Fixed issue where NetworkConfig.ConnectionData could cause the ConnectionRequestMessage to exceed the transport's MTU size and would result in a buffer overflow error. (#3564) - Fixed regression issue in v2.x where `NetworkObject.GetNetworkBehaviourAtOrderIndex` was converted from public to internal. (#3541) - Fixed ensuring OnValueChanged callback is still triggered on the authority when a collection changes and then reverts to the previous value in the same frame. (#3539) - Fixed synchronizing the destroyGameObject parameter to clients for InScenePlaced network objects. (#3514)