From a0f7607d7e1921e7ddbbec5140c5e665c1543671 Mon Sep 17 00:00:00 2001 From: catgirl <137518916+ccatgirl@users.noreply.github.com> Date: Sun, 13 Jul 2025 08:43:33 -0500 Subject: [PATCH] Encode IP in OPEN_CONNECTION_REPLY_2 for RakNet compatibility NC would crash Jenkins' RakNet clients compiled with assertions. --- src/network/raknet/RakNetCodec.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/network/raknet/RakNetCodec.php b/src/network/raknet/RakNetCodec.php index d8803c0e..082cfcf5 100644 --- a/src/network/raknet/RakNetCodec.php +++ b/src/network/raknet/RakNetCodec.php @@ -1,6 +1,12 @@ buffer .= chr(4); + $packet->buffer .= Utils::writeInt($packet->ip); + $packet->buffer .= Utils::writeShort($packet->port); + } + public static function encode(RakNetPacket $packet){ if($packet->buffer != null && strlen($packet->buffer) > 0){ return; @@ -17,7 +23,7 @@ class RakNetCodec{ case RakNetInfo::OPEN_CONNECTION_REPLY_2: $packet->buffer .= RakNetInfo::MAGIC; $packet->buffer .= Utils::writeLong($packet->serverID); - $packet->buffer .= Utils::writeShort($packet->port); + static::encodeIPAddress($packet); $packet->buffer .= Utils::writeShort($packet->mtuSize); $packet->buffer .= chr(0); //Server security break;