My workstation is on Windows 11 and the client unexpectedly crashed with an ArgumentOutOfRangeException. Windows EventView showed:
Anwendung: eduVPN.Client.exe
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.ArgumentOutOfRangeException
bei System.Net.IPAddress..ctor(Int64)
bei eduVPN.ViewModels.VPN.Session.<.ctor>b__77_1()
bei System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
bei System.Threading.ThreadHelper.ThreadStart()
The issue seems to be that casting tunnelAddress.Address to int can result in an overflow. See image below. Aside from that IPAddress.Adress is marked as obsolete and should be replaced by GetAddressBytes [1].
I am not familiar enough with the calculation of IP addresses and subnet masks, but replacing line 444 with something like the following should help:
var addressBytes = tunnelAddress.GetAddressBytes();
var unicastMaskBytes = unicast.IPv4Mask.GetAddressBytes();
var maskBytes = new byte[] { 0, 0, 0, 1 };
for (var i = 0; i < addressBytes.Length; i++)
{
addressBytes[i] = (byte)(addressBytes[i] & unicastMaskBytes[i]);
}
for (var i = 0; i < addressBytes.Length; i++)
{
addressBytes[i] = (byte)(addressBytes[i] | maskBytes[i]);
}
gateway = new IPAddress(addressBytes).ToString();
Thanks for reporting this. The problem is sign bit 1 from 132 in 10.45.84.132. (calculation was done in host byte order, so the last component of IP became MSB).
Hey everyone,
My workstation is on Windows 11 and the client unexpectedly crashed with an
ArgumentOutOfRangeException
. Windows EventView showed:The issue seems to be that casting
tunnelAddress.Address
toint
can result in an overflow. See image below. Aside from thatIPAddress.Adress
is marked as obsolete and should be replaced byGetAddressBytes
[1].I am not familiar enough with the calculation of IP addresses and subnet masks, but replacing line 444 with something like the following should help:
[1] https://learn.microsoft.com/en-us/dotnet/api/system.net.ipaddress.getaddressbytes?view=net-8.0