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) 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(); } 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;