It is currently April 19th, 2024, 10:29 pm

[Bug] Net measures can fail when multiple identically named adapters exist

Report bugs with the Rainmeter application and suggest features.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

[Bug] Net measures can fail when multiple identically named adapters exist

Post by SilverAzide »

There is a potential bug in the Net measures that are actually caused by some sort of Windows problem. This is very difficult to reproduce without a corrupted system, so patience is required.

A user of my Gadgets Network skins reported that the skins were not displaying any network activity on his system. The code in the skin for all the Net measures use the following measure style (pseudo-code):

Code: Select all

[MeasureNetIn]
Measure=NetIn
Interface=<name of network adapter>

[MeasureNetOut]
Measure=NetOut
Interface=<name of network adapter>
This code was reporting NO activity, even though the adapter name was correct. A look at the debug log reveals the source of the problem:

Code: Select all

DBUG (20:31:07.356) : * NETWORK-INTERFACE: Count=43
...
DBUG (20:31:07.437) :  19: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.438) :      Alias: NETGEAR WNDA3100v3 N600
DBUG (20:31:07.438) :      GUID: {A2FC8CB9-FB10-44B9-80AB-1F487E9BF72D}
DBUG (20:31:07.439) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.440) :      IfIndex=5, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.443) :  20: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.444) :      Alias: Wi-Fi 2
DBUG (20:31:07.445) :      GUID: {17FA7870-875D-4EDA-92B2-92387353B0A3}
DBUG (20:31:07.445) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.446) :      IfIndex=6, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.447) :  21: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.448) :      Alias: Wi-Fi
DBUG (20:31:07.448) :      GUID: {CB18C356-1E75-4161-921D-9A75E6DBE9D9}
DBUG (20:31:07.449) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.450) :      IfIndex=7, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.451) :  22: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.451) :      Alias: Wi-Fi 2
DBUG (20:31:07.452) :      GUID: {7F8200E1-08DB-4CC1-8587-3D2D4B605F58}
DBUG (20:31:07.453) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.454) :      IfIndex=8, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.455) :  23: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.455) :      Alias: Wi-Fi
DBUG (20:31:07.456) :      GUID: {7AD1C1D9-24FD-4FF5-AAFB-3797712532AA}
DBUG (20:31:07.459) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.460) :      IfIndex=9, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.462) :  24: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.462) :      Alias: NETGEAR WNDA3100v3 N600
DBUG (20:31:07.463) :      GUID: {06590E66-1291-4908-B16E-C7B769870683}
DBUG (20:31:07.464) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.465) :      IfIndex=23, State=Connected, Status=Up(1)
DBUG (20:31:07.465) :  25: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.466) :      Alias: Wi-Fi 3
DBUG (20:31:07.467) :      GUID: {839F943A-132F-4038-903D-FF6A3590E531}
DBUG (20:31:07.468) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.468) :      IfIndex=16, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.469) :  26: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.470) :      Alias: Wi-Fi 3
DBUG (20:31:07.471) :      GUID: {2BFE4D21-0271-47D5-AB47-1BA3FA126813}
DBUG (20:31:07.472) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.472) :      IfIndex=10, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.473) :  27: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.475) :      Alias: Wi-Fi 4
DBUG (20:31:07.476) :      GUID: {D1E7FC84-E44A-4EBE-88D5-D898ED18FF2C}
DBUG (20:31:07.477) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.478) :      IfIndex=17, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.478) :  28: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.479) :      Alias: Wi-Fi 2
DBUG (20:31:07.480) :      GUID: {F8E5FBBE-0ED7-4534-AAD4-A144A33AE9BC}
DBUG (20:31:07.481) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.482) :      IfIndex=11, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.482) :  29: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.483) :      Alias: Wi-Fi
DBUG (20:31:07.484) :      GUID: {8BF72EBB-8067-46BC-B4A9-A4F44F420E10}
DBUG (20:31:07.484) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.485) :      IfIndex=12, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.486) :  30: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.486) :      Alias: Wi-Fi 4
DBUG (20:31:07.488) :      GUID: {C81B42C0-A458-4A3E-90A8-06169A765544}
DBUG (20:31:07.489) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.491) :      IfIndex=13, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.493) :  31: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.494) :      Alias: Wi-Fi
DBUG (20:31:07.495) :      GUID: {C852D841-58C8-411F-9939-3BAAE6B8C24A}
DBUG (20:31:07.495) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.496) :      IfIndex=14, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.497) :  32: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.498) :      Alias: NETGEAR WNDA3100v3 N600
DBUG (20:31:07.498) :      GUID: {81E1D333-3A1F-4E5C-B1DF-7A8A767E4D73}
DBUG (20:31:07.499) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.500) :      IfIndex=15, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.501) :  33: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.501) :      Alias: Wi-Fi
DBUG (20:31:07.502) :      GUID: {E6910D44-4240-4B1C-8317-3351CB6FC60F}
DBUG (20:31:07.503) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.504) :      IfIndex=19, State=Unknown, Status=Not Present(6)
DBUG (20:31:07.504) :  34: Name: NETGEAR WNDA3100v3 N600 Wireless Dual Band USB Adapter
DBUG (20:31:07.505) :      Alias: Wi-Fi 2
DBUG (20:31:07.506) :      GUID: {A19AE7D1-C4E4-4678-B46D-512131A73B30}
DBUG (20:31:07.508) :      Type=Wireless(71), Hardware=Yes, Filter=No
DBUG (20:31:07.509) :      IfIndex=21, State=Unknown, Status=Not Present(6)
Note that there are SIXTEEN identically named network adapters. Only the 24th item (IfIndex=23) is a real device, all the others are garbage buried someplace in Windows. (They are in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkSetup2 and cannot be accessed without using some tools that cause Windows Defender and VirusTotal to go nuts with virus warnings.)

When using Interface=<name of network adapter> syntax, Rainmeter appears to find one of the dead entries and report no activity. When using Interface=Best or Interface=<IfIndex>, it does correctly find and report the proper adapter.

I don't know if this is really fixable. Maybe work-aroundable? I have also managed to create a bad adapter entry when I upgraded a VirtualBox installation; apparently Oracle does not properly remove existing VBox adapters when upgrading and just tries to add a new one. Windows complains, but creates the new entry anyway, which makes an essentially permanently bad entry in the list of adapters.
Gadgets Wiki GitHub More Gadgets...
User avatar
Brian
Developer
Posts: 2679
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [Bug] Net measures can fail when multiple identically named adapters exist

Post by Brian »

Hmmm. This one is a bit tricky.

I just pushed a change that will hopefully solve this issue. What it does is for the options SysInfoData and Interface, when specifying the "name" (or description) of the adapter, it will first attempt to match the desired name. Then it will check its connection status and operational status. If the adapter is "present" AND "connected". That is what will be used.

If there is still a name match, but no adapter has both "present" and "connected" flags, then the following will be returned:
The last interface index that has a connection state of Connected. If there is none, then the last interface index that has an operational status that is anything but Not Present. If neither of those are available, then the last interface index that is Not Connected. Lastly, if nothing is still found, the interface index of the first "name" match will be returned (like how it works today).

Hopefully that makes sense.

Also, the next release will have the ability to search by Alias instead of name, if desired.
Example: SysInfoData=Ethernet

-Brian
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: [Bug] Net measures can fail when multiple identically named adapters exist

Post by SilverAzide »

Brian wrote: December 9th, 2021, 12:16 am Hopefully that makes sense.
Disturbingly, it does make sense! This should be a great enhancement. I noticed after I posted the above that the SysInfo measure was having similar difficulties to the Net measures, so your fix should do the trick.

Thank you!
Gadgets Wiki GitHub More Gadgets...