From 450e82278061d5217eb0f1bac92c7ae1d1a53f9d Mon Sep 17 00:00:00 2001 From: nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com> Date: Thu, 21 Nov 2024 00:20:28 +0200 Subject: [PATCH] Fix ReservedAddress checking (#14) Mask was incorrectly calculated. --- Lidgren.Network/NetReservedAddress.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lidgren.Network/NetReservedAddress.cs b/Lidgren.Network/NetReservedAddress.cs index ea693156..fba91c5a 100644 --- a/Lidgren.Network/NetReservedAddress.cs +++ b/Lidgren.Network/NetReservedAddress.cs @@ -45,7 +45,7 @@ public static bool IsAddressReserved(IPAddress address) foreach (var (reservedIp, maskBits) in ReservedRanges) { - var mask = uint.MaxValue << maskBits; + var mask = uint.MaxValue << (32 - maskBits); if ((ipBits & mask) == (reservedIp & mask)) return true; }