Fixes #18090
Linux pal level struct for network info had only int32 field for speed. Even though our public API has it as long. The problem was in value overflowing in calculation MBits --> Bits.
public unsafe struct NetworkInterfaceInfo
{
public fixed byte Name[16];
+ public long Speed;
public int InterfaceIndex;
- public int Speed;
public int Mtu;
public ushort HardwareType;
public byte OperationalState;
ecmd.cmd = ETHTOOL_GSET;
if (ioctl(socketfd, SIOCETHTOOL, &ifr) == 0)
{
- nii->Speed = (int)ethtool_cmd_speed(&ecmd);
+ nii->Speed = (int64_t)ethtool_cmd_speed(&ecmd);
if (nii->Speed > 0)
{
// If we did not get -1
typedef struct
{
char Name[16]; // OS Interface name.
+ int64_t Speed; // Link speed for physical interfaces.
uint32_t InterfaceIndex; // Interface index.
- int32_t Speed; // Link speed for physical interfaces.
int32_t Mtu; // Interface MTU.
uint16_t HardwareType; // Interface mapped from L2 to NetworkInterfaceType.
uint8_t OperationalState; // Operational status.
[Fact]
[PlatformSpecific(TestPlatforms.Linux)] // Some APIs are not supported on Linux
- [ActiveIssue("https://github.com/dotnet/runtime/issues/18090")]
public void BasicTest_AccessInstanceProperties_NoExceptions_Linux()
{
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())