microsoft / Windows-Dev-Performance

A repo for developers on Windows to file issues that impede their productivity, efficiency, and efficacy
MIT License
438 stars 21 forks source link

Measuring WiFi signal strength via the standard API causes packet loss #59

Closed TimothyTitus closed 3 years ago

TimothyTitus commented 3 years ago

Environment

Item Value
OS, Version / Build ___
Processor Architecture ___
Processor Type & Model ___
Memory ___
Storage Type, free / capacity (e.g. C: SSD 128GB / 512GB) ___
Relevant apps installed ___

Description

When you query RSSI signal strength in dbm, it causes packet loss.

Steps to reproduce

Query RSSI signal strength in dbm every 2-3 seconds.

Expected behavior

Querying the signal strength should be able to be performed without causing packet loss.

Actual behavior

Querying WiFi signal strength (RSSI) every few seconds causes packet loss.

TimothyTitus commented 3 years ago

If you call WlanScan() every second to get the current rssi information (so you can walk around and determine the quality of signal in a live capacity), it causes packet loss to run this function. Thus, it is destructive, when it should be non-desctructive/passive.

HelgeKeck commented 3 years ago

This isnt an issue at all. You are just using it completely wrong.

WlanScan() does of course cause a Packet loss, you are forcing the NIC to cycle through all channels, how could this not cause a loss?

Calling WlanScan() to get your current RSSI is a total overkill, you need to get this info from the current connection object, so you dont need to perform a scan

https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_association_attributes

HelgeKeck commented 3 years ago

also i dont understand your issue, who cares about packet loss if you are just want to walk arround and check your signal strength?

TimothyTitus commented 3 years ago

How do you get RSSI in dBm on an ongoing basis WITHOUT causing packet loss?

According to Microsoft support, all of the other methods do not provide RSSI in dBm, and are also not very accurate. -Tim-

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 5:54 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

This isnt an issue at all. You are just using it completely wrong.

WlanScan() does of course cause a Packet loss, you are forcing the NIC to cycle through all channels, how could this not cause a loss?

Calling WlanScan() to get your current RSSI is a total overkill, you need to get this info from the current connection object, so you dont need to perform a scan

https://docs.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_association_attributes

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723092304, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RXPWFRD2C3KVQ6FABLSOP5XLANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

The link i provided gives you an accurate RSSI value between -50 and -100 dBm, this value is based on the exact same data you would get from a WlanScan(), it is absolutely accurate in its provided span.

and even if i still dont understand the use case here, you still could put the NIC into monitor mode, set it to the desired channel, live decode the PCAP stream and getting your values from there. But this doesnt work if you want to be connected to a network.

you should do only one thing at a time, capturing or walking arround for a signal check

TimothyTitus commented 3 years ago

Here’s the use case: As an engineer trying to solve problems, you want to know a number of things:

If you have to do each of these as a separate test, it may take you 30 minutes to collect all of the information and analyze it to detect the problem.

If you can combine all of the tests into one tool that will analyze all of the above, you can solve problems within 5 minutes.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 8:32 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

The link i provided gives you an accurate RSSI value between -50 and -100 dBm, this value is based on the exact same data you would get from a WlanScan(), it is absolutely accurate in its provided span.

and even if i still dont understand the use case here, you still could put the NIC into monitor mode, set it to the desired channel, live decode the PCAP stream and getting your values from there. But this doesnt work if you want to be connected to a network.

you should do only one thing at a time, capturing or walking arround for a signal check

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723174309, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RRNQ4GPZMYSACIF26DSOQQJRANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

thats a bit more than: "so you can walk around and determine the quality of signal in a live capacity"

Anyway, thats maybe not what you want to hear, but this is definitely not an issue in the Windows WlanAPI. Its just the wrong way to do it

TimothyTitus commented 3 years ago

So what is the exact method that you say WILL work? We tried a number of different methods, and none of them got RSSI information returned reliably.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 9:08 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

thats a bit more than: "so you can walk around and determine the quality of signal in a live capacity"

Anyway, thats maybe not what you want to hear, but this is definitely not an issue in the Windows WlanAPI. Its just the wrong way to do it

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723193461, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RR5S5WWLH3PCR6RASTSOQUPBANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

really? i gave you 2 reliable ways to do it, pick one

TimothyTitus commented 3 years ago

Sorry, we tried that. Here’s the results (tested with 5 different wireless NICs to make sure we weren’t seeing a limitation from a single vendor):

wlanSignalQuality always shows 100 even when there is really poor signal quality. Thus, this is a completely useless stat.

Have you used this metric before to measure over time? Have you found it to be useful in any situation?

I did not see the other method you referenced.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 9:16 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

really? i gave you 2 reliable ways to do it, pick one

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723197395, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RRE4UDF7YM633WZUG3SOQVMDANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

did you even read the documentation? i dont think so, its directly on the page i shared with you.

HelgeKeck commented 3 years ago

this works 100%

HelgeKeck commented 3 years ago

I did not see the other method you referenced.

you still could put the NIC into monitor mode, set it to the desired channel, live decode the PCAP stream and getting your values from there. But this doesnt work if you want to be connected to a network.

TimothyTitus commented 3 years ago

Yes, I read it through 6 months ago, and re-read it based on your recommendation.

We tried this and discovered that the update frequency of this value is perhaps once a minute if not longer (is not specified in that doc, and I could not find it otherwise). Thus, you might have a strong signal when initially connected, but might be poor after the user starts to use it. Thus, by the time you see that you have poor quality, you might be back at good quality, so you keep moving around.

Additionally, it will continuously show 100% even when signal strength was poor. Thus it was not a reliable value shown no matter what.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 9:24 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

this works 100%

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723201443, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RUUX7JMAQDC2N5X5G3SOQWKJANCNFSM4TKIXJVA.

TimothyTitus commented 3 years ago

Huh? Captured packets show signal strength? Where is that shown? I’ve been involved in networking for over 30 years and have not seen this in an 802.11 frame definition.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 9:31 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

I did not see the other method you referenced.

you still could put the NIC into monitor mode, set it to the desired channel, live decode the PCAP stream and getting your values from there. But this doesnt work if you want to be connected to a network.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723205075, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RWBQB2OIBM7IQWFLQTSOQXFLANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

30 Years, thats amazing.

the Answer is the Radio Tap Header, transmitted in almost any wifi frame. You can even see the Signal strength per Antenna of the NIC.

HelgeKeck commented 3 years ago

where do you think is Windows, or any other OS on this planet, getting the signal strength value from?

TimothyTitus commented 3 years ago

Ok, this is valuable stuff! I’ll start researching this. Thanks.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 9:46 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

30 Years, thats amazing.

the Answer is the Radio Tap Header, transmitted in almost any wifi frame. You can even see the Signal strength per Antenna of the NIC.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723212242, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RTRCCY6SOZ6F66DPXLSOQY6TANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

i know you wont ask for, but here is one advice.

Just let it be and dont try to code this under windows.

You will understand it in one year

Good luck for your journey

TimothyTitus commented 3 years ago

Ok, this is a cryptic answer.

AirPcap (the only way it seems to get the radiotap information on Windows systems) is a hardware-based USB device sold by Riverbed (they acquired it from Cacetech a number of years ago).

Riverbed announced end of life of AirPcap in December 31, 2017. Thus, this is not a solution.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 9:51 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

i know you wont ask for, but here is one advice.

Just let it be and dont try to code this.

You will understand it in one year

Good luck for your journey

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723214427, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RQDBYHQKF2OYU3ME6LSOQZPZANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

put your nic into monitor mode and capture the frames, tons of programs can do this.

TimothyTitus commented 3 years ago

From what I’m reading/learning, the AirPcap card (discontinued) is the only adapter that adds radiotap information.

All of the packet captures I have done via my laptop do not have any radiotap information. How else should this information be captured using a standard wireless NIC?

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 10:31 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

put your nic into monitor mode and capture the frames, tons of programs can do this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723233657, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RSSIZBBCGQ72X4N3RLSOQ6F3ANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

The purpose of this repo is to collect and catalog issues that affect / impact developers who work on Windows.

This here is clearly not an issue and we should not discuss such things here.

To close this, i can only recommend you to search Stack Overflow or even here in github for more information. As i already said, my advice is not to try to code it by your own. Just use an already existing tool. From what i can see you havent been in touch with this technology before and this is a highly complex topic, which not only involves coding skills, you need to understand the WiFi Technology itself, Windows Driver Development, Hardware and much more.

Every WiFi Adapter provides a Radio Tap Header to the OS, not only AirPcap. You should give your research more time than just some hours, this takes months.

If you are on twitter search for people with a CWNE certification and try to get in contact with them.

TimothyTitus commented 3 years ago

HelgeKeck: I (and others) might disagree with you that this is not an issue.

I have researched quite a bit on this already. I appreciate your additional information, as it has been enlightening to research this, but it seems that some of your information is not showing to be technically correct.

If you say that “Every WiFi adapter provides a radiotap header to the OS”, then I would ask why it seems that every document I find online seems to be a dead project, no longer supported, or no longer implementable.

Pointing someone to dead technology is not really a good solution, and is not a defensible position.

If you have information of how to get a better quality stats out of Windows API regarding RSSI, I’m all ears. So far, I have not heard of a workable solution yet as I have tried the other methods and they do not update often enough to be useful.

…and I am certainly not asking you for code – I posted here because my Microsoft support ticket experts ran to the end of their ability to help us and said that the API was currently deficient and could not get live stats without causing packet loss. They recommended I post here so someone from the product team inside Microsoft would review it and consider adding better API support.

I presume you do not work for Microsoft or have control over changing their API to improve on it? -Tim-

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 8:42 PM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

The purpose of this repo is to collect and catalog issues that affect / impact developers who work on Windows.

This here is clearly not an issue and we should not discuss such things here.

To close this, i can only recommend you to search Stack Overflow or even here in github for more information. As i already said, my advice is not to try to code it by your own. Just use an already existing tool. From what i can see you havent been in touch with this technology before and this is a highly complex topic, which not only involves coding skills, you need to understand the WiFi Technology itself, Windows Driver Development, Hardware and much more.

Every WiFi Adapter provides a Radio Tap Header to the OS, not only AirPcap. You should give your research more time than just some hours, this takes months.

If you are on twitter search for people with a CWNE certification and try to get in contact with them.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723391015, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RS2JDYKZJVRMLKUV5LSOTF3FANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

this is not a dead technology, this is not even a own technology. Im using this every day, like any other WiFi Engineer in the world.

The radio tap header is by default not exposed to user mode applications in windows. Gettings this information is technically extremly difficult, you need to understand all the technologies i listed above, then you are able to code this by your own.

And no, im not working for Microsoft, and this is definitly not an technical issue that needs to be fixed. There is just no easy solution, like just making some API calls and then getting this information, this is complex stuff.

HelgeKeck commented 3 years ago

and just for the records, one of the microsoft persons, who is running this repo, asked me to jump in because i have experience with this topic and i know this API very well.

TimothyTitus commented 3 years ago

Ok, so if you know the API very well, you must agree with me that there is no Microsoft published API that would allow you to query the RSSI values on a second-by-second basis that does not cause packet loss.

Thus, you must agree with me that there is a performance limitation with the API.

Saying that there is a non-Microsoft supported method using radiotap information that NICs may or may not support is not really a solution.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 9:19 PM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

and just for the records, one of the microsoft persons, who is running this repo, asked me to jump in because i have experience with this topic and i know this API very well.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723393977, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RTHJXJSVX26QZTWCCLSOTKDJANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

dont agree, noone ever will.

There exists no performance issue, no issue at all. This API works exactly as expected. Also, i said nothing about a non microsoft way, dont know where this is coming from.

anyway, i cant help you any further.

wish you the best

TimothyTitus commented 3 years ago

I’m sorry you feel that way, but I think you may be alone with your feelings.

I will work with Microsoft directly on this, as they already see that there is a deficiency.

Sorry your time was wasted.

From: HelgeKeck notifications@github.com Sent: Friday, November 6, 2020 10:10 PM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Author author@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

dont agree, noone ever will.

There exists no performance issue, no issue at all. This API works exactly as expected. Also, i said nothing about a non microsoft way, dont know where this is coming from.

anyway, i cant help you any further.

wish you the best

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-723398130, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RQUWQTSKQAQVGCPA7LSOTQCNANCNFSM4TKIXJVA.

bitcrazed commented 3 years ago

Hey all. Thanks for the spirited discussion thus far.

@HelgeKeck has created very powerful network signal analysis tools for Windows (and other platforms) that I've been a big fan of for several years. I reached out to Helge, and asked him if he could provide some pointers/guidance/etc. Thank you for sharing your experiences and suggestions above Helge.

@TimothyTitus: I appreciate that you're frustrated that getting the signal strength data you seek isn't as easy as you might want.

This is a valid criticism about which I am happy to start a conversation with Windows' networking team to discuss. However, note that even if we're successful in convincing the team to add an API to expose this data to user-mode apps and tools, that it'll take a while for that API to show up in Windows Insider builds, and in subsequent OS releases.

So, what to do in the meantime?

As Helge suggests above, there are a few ways to get some amount of signal strength info but that you may have to compromise - if you're okay with simpler data, there are some approaches that avoid you needing to frequently call WlanScan() to get your current RSSI because doing so will cause the machine's wifi card to have to scan all networks, channels, etc. which may result in switching/dropping/losing connections, temporarily.

But, as you indicate, you'd prefer more accurate data, you have some options to consider and some work to do:

Ultimately, you want something, somewhere to expose signal strength data to user-mode code.

As Helge described above, he's previously used the existing capabilities of PCAP that will add the necessary signal strength data to a Radio Tap Header pseudo frame in the PCAP output stream. User-mode code can then decode the PCAP stream, and extract & display/analyze the data.

⚠ PCAP and the Radio Tap Header is not a Windows-specific thing - it originated in BSD and is now prevalent in Linux too. The Radio Tap Header enables code in the networking stack to add arbitrary data frames to network data streams, but it's arbitrary, not consistently supported, and to be avoided if not required (if nobody's listening why waste cycles and bytes adding data that's not read).

If you don't want to rely on NPCAP, you'll have to build your own. However, note that doing so is very non-trivial: You will need to build, install, configure, secure, service, etc. a kernel mode driver. Thus I would recommend that you attempt this only as a last resort. Instead, I would strongly encourage you to explore whether NPCAP will work for your requirement. (note: Wireshark's docs state that, on Windows, NPCAP should be preferred and that it's under active development).

A wise piece of guidance in this doc states:

The next logical question is: “how to I get radiotap headers in my captures?”. The headers are added by the wireless adapter (or its driver) that is being used to perform the frame capture. If the adapter does not inject the additional information as it captures frames, then no radiotap headers will be added. I guess the best way to verify this is simply to perform a capture and see if they appear in your capture using Wireshark. In my own particular case, I was performing a capture with an AirPcap NX card, which provides radiotap information. However, I also performed captures with the internal WLAN NIC of my laptop, which does not provide radiotap data.

In the meantime, as I stated above, I'll at least start a conversation with the Windows networking team to see if they have any suggestions/recommendations, or if anything can be done to support your requirements.

HTH.

TimothyTitus commented 3 years ago

Rich: Thank you for your response, it’s tone is far more understanding and solution-oriented than Helge.

I have quite a bit of experience with PCAP, and know packet decodes very well, but have never seen radiotap headers, so Helge did teach me something I did not know before.

The problem with the previously suggested option: AirPcap adapters are no longer sold, so I can’t expect my customers to go out and buy one.

Question: Do all Promiscuous-mode WiFi adapters (monitor/capture mode) support radiotap? Thus, this list would be a way of doing this: https://secwiki.org/w/Npcap/WiFi_adapters

PS: I completely understand that the timeframe for improving this API might be months/years/never. I figure as a user of the API, it is always beneficial to consider improvements to make the data easier to collect/ingest/interpret, so I’m happy to work with you and your team to offer suggestions so the API becomes a more valuable and more frequently used API versus falls into disuse because it does not provide useful data. -Tim-

From: Rich Turner notifications@github.com Sent: Monday, November 9, 2020 1:36 PM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Mention mention@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

Hey all. Thanks for the spirited discussion thus far.

Helge has created very powerful network signal analysis tools for Windows (and other platforms) that I've been a big fan of for several years. I reached out to Helge, and asked him if he could provide some pointers/guidance/etc. Thank you for sharing your experiences and suggestions above.

@TimothyTitushttps://github.com/TimothyTitus: I appreciate that you're frustrated that getting the signal strength data you seek isn't as easy as you might want.

This is a valid criticism about which I am happy to start a conversation with Windows' networking team to discuss. However, note that even if we're successful in convincing the team to add an API to expose this data to user-mode apps and tools, that it'll take a while for that API to show up in Windows Insider builds, and in subsequent OS releases.

So, what to do in the meantime?

As Helge suggests above, there are a few ways to get some amount of signal strength info but that you may have to compromise - if you're okay with simpler data, there are some approaches that avoid you needing to frequently call WlanScan() to get your current RSSI because doing so will cause the machine's wifi card to have to scan all networks, channels, etc. which may result in switching/dropping/losing connections, temporarily.

But, as you indicate, you'd prefer more accurate data, you have some options to consider and some work to do:

Ultimately, you want something, somewhere to expose signal strength data to user-mode code.

As Helge described above, he's previously used the existing capabilities of PCAP that will add the necessary signal strength data to a Radio Tap Header pseudo frame in the PCAP output stream. User-mode code can then decode the PCAP stream, and extract & display/analyze the data.

⚠ PCAP and the Radio Tap Header is not a Windows-specific thing - it originated in BSD and is now prevalent in Linuxhttps://www.kernel.org/doc/html/latest/networking/radiotap-headers.html too. The Radio Tap Header enables code in the networking stack to add arbitrary data frames to network data streams, but it's arbitrary, not consistently supported, and to be avoided if not required (if nobody's listening why waste cycles and bytes adding data that's not read).

If you don't want to rely on NPCAP, you'll have to build your own. However, note that doing so is very non-trivial: You will need to build, install, configure, secure, service, etc. a kernel mode driver. Thus I would recommend that you attempt this only as a last resort. Instead, I would strongly encourage you to explore whether NPCAP will work for your requirement. (note: Wireshark's docs state that, on Windows, NPCAP should be preferredhttps://wiki.wireshark.org/libpcap and that it's under active development).

A wise piece of guidance in this dochttps://medium.com/@tooethiopic/what-are-radiotap-headers-53a93a71e08e states:

The next logical question is: “how to I get radiotap headers in my captures?”. The headers are added by the wireless adapter (or its driver) that is being used to perform the frame capture. If the adapter does not inject the additional information as it captures frames, then no radiotap headers will be added. I guess the best way to verify this is simply to perform a capture and see if they appear in your capture using Wireshark. In my own particular case, I was performing a capture with an AirPcap NX card, which provides radiotap information. However, I also performed captures with the internal WLAN NIC of my laptop, which does not provide radiotap data.

In the meantime, as I stated above, I'll at least start a conversation with the Windows networking team to see if they have any suggestions/recommendations, or if anything can be done to support your requirements.

HTH.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-724292445, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RXGWS4UESB275YLLZLSPBOCRANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

Timothy,

if i was to direct my apologies, thats just how i am.

Windows once had an API that did what you want. But due to lack of support from the Hardware Vendors and bad driver Implementations, Microsoft ditched this API. Imo it is highly unlikely that we see this coming back.

AirPcap Adapter just offered a convienent way to access these kind of data. Not having these adapters doesnt mean it is not possible anymore on windows. Thats why i suggested that you are trying to contact people with a CWNE certification. These people deal everyday with this technology and they can answer you most of your questions. Use existing solutions for your problem.

Once i have been in the exact same situation like you are now. Believe me when i say that trying to code this by your own will cost you a year of your life, and most likely it wont work at the end.

TimothyTitus commented 3 years ago

I completely agree with you that trying to code a solution myself will lose a year of my life.

This is why I am asking Microsoft’s PM to consider making it a “Windows Wireless certified” requirement that this information is available via ALL wireless adapters that will be supported by Windows, thus forcing the vendors to all participate.

This was done years ago where Microsoft forced standards for mice, sound cards, network adapters, hard drives. This information should be required for wireless to help identify and troubleshoot problems in the wireless realm. -Tim-

From: HelgeKeck notifications@github.com Sent: Tuesday, November 10, 2020 10:07 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Mention mention@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

Timothy,

if i was to direct my apologies, thats just how i am.

Windows once had an API that did what you want. But due to lack of support from the Hardware Vendors and bad driver Implementations, Microsoft ditched this API. Imo it is highly unlikely that we see this coming back.

AirPcap Adapter just offered a convienent way to access these kind of data. Not having these adapters doesnt mean it is not possible anymore on windows. Thats why i suggested that you are trying to contact people with a CWNE certification. These people deal everyday with this technology and they can answer you most of your questions. Use existing solutions for your problem.

Once i have been in the exact same situation like you are now. Believe me when i say that trying to code this by your own will cost you a year of your life, and most likely it wont work at the end.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-724872382, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RXW6AWWOUPFPKICHCTSPF6LJANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

Unlikely that Microsoft will add these infos the WlanAPI, Microsoft offers these kind of data already on another place:

https://docs.microsoft.com/en-us/message-analyzer/microsoft-message-analyzer-operating-guide

image

HelgeKeck commented 3 years ago

im sure there is a seperate Forum for this on the Microsoft Tech Community Sites

bitcrazed commented 3 years ago

Hey all. I just heard back from the engineering lead responsible for our wifi stack.

In short, he echoes some of @HelgeKeck's points:

  1. If the goal is to get signal strength/quality for the currently connected AP, a non-invasive way to get signal quality is to register for WLAN notifications (WlanRegisterNotification) and listen for wlan_notification_msm_signal_quality_change. If dBm RSSI is needed, in first approximation one can apply the MSDN rule: “WLAN_SIGNAL_QUALITY is of type ULONG. This member contains a value between 0 and 100. A value of 0 implies an actual RSSI signal strength of -100 dbm. A value of 100 implies an actual RSSI signal strength of -50 dbm. You can calculate the RSSI signal strength value for wlanSignalQuality values between 1 and 99 using linear interpolation.”
  2. If the goal is to get signal strength/quality for all the currently visible networks: there is an intrinsic contradiction between maintaining high quality/reliability on the channel where the currently-connected AP is located, and requiring to know in details whatever is present/visible on dozens of other channels. Discovery of Wi-Fi networks located on other channels requires the Wi-Fi radio to hop from channel to channel and sit on those channel for short-but-compounding dwell times. As result performance on current channel/connection is seriously affected during scans. In general that should not result in disconnections (if it does there may be other factors, such as driver bugs or low signal quality on channel N), but it will definitely result in packet loss and dramatic bandwidth reduction during the scan (and a scan time can sometimes approach 5 seconds).

New Wi-Fi adapters are coming to market that basically have two radios and will be able to scan with no impact on performance on the connected channel, but their availability in the market is still minor and expected to grow quite slowly.

Alternatively instead WlanScan, one could use WlanGetAvailableNetworkList and get opportunistic network visibility data, but the freshness of that data depends on driver and network conditions, and in general it is not nearly good enough for network analyzer purposes.

In general Wlan APIs have not been designed for such usage.

So, @TimothyTitus - while your goal is indeed noble, valid, and useful, it is simply unrealistic to expect current single-radio wifi cards/chipsets to maintain a reliable, high-perf wifi connection whilst instructing the radio to sample each of the available networks.

Hopefully, as Wi-Fi 6 / MIMO cards/chipsets that support multiple radios become more prevalent over time, your goals may be easier to achieve. However, as the engineering lead points out, this will take some time to become the norm, and is subject to driver vendors commitment to delivering high quality drivers that support independently driving multiple physical radios, etc.

So, in the meantime, one approach you might want to consider is fitting your engineers' laptops with USB wifi adaptors and using those devices to scan available networks, leaving the built-in Wi-Fi to handle normal traffic.

And if you want to survey Wi-Fi 6 networks, signals, etc. you'll likely need to use Wi-Fi 6 adaptors, as and when they start to (inevitably) arrive in-market.

Oh, and then there'll be Wi-Fi 7/802.11AY, etc. 😉

TimothyTitus commented 3 years ago

Thanks for this info. The WLAN_SIGNAL_QUALITY does not update often enough to be useful. I think it updates every 60 seconds, if not less often.

Thus, if you are doing a signal study, and are walking around, you may walk right past the “sweet spot” and well into a bad area before realizing it.

If @HelgeKeck’s point about radiotap headers being on most all wireless frames at this point, then I would assume that it is an easy task to have the kernel take the signal strength off of each packet to have a dynamic (updated per packet, or perhaps every 100 packets even) value that would be non-destructive, right?

From: Rich Turner notifications@github.com Sent: Tuesday, November 10, 2020 11:04 AM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Mention mention@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

Hey all. I just heard back from the engineering lead responsible for our wifi stack.

In short, he echoes some of @HelgeKeckhttps://github.com/HelgeKeck's points:

  1. If the goal is to get signal strength/quality for the currently connected AP, a non-invasive way to get signal quality is to register for WLAN notifications (WlanRegisterNotification) and listen for wlan_notification_msm_signal_quality_change. If dBm RSSI is needed, in first approximation one can apply the MSDN rule: “WLAN_SIGNAL_QUALITY is of type ULONG. This member contains a value between 0 and 100. A value of 0 implies an actual RSSI signal strength of -100 dbm. A value of 100 implies an actual RSSI signal strength of -50 dbm. You can calculate the RSSI signal strength value for wlanSignalQuality values between 1 and 99 using linear interpolation.”
  2. If the goal is to get signal strength/quality for all the currently visible networks: there is an intrinsic contradiction between maintaining high quality/reliability on the channel where the currently-connected AP is located, and requiring to know in details whatever is present/visible on dozens of other channels. Discovery of Wi-Fi networks located on other channels requires the Wi-Fi radio to hop from channel to channel and sit on those channel for short-but-compounding dwell times. As result performance on current channel/connection is seriously affected during scans. In general that should not result in disconnections (if it does there may be other factors, such as driver bugs or low signal quality on channel N), but it will definitely result in packet loss and dramatic bandwidth reduction during the scan (and a scan time can sometimes approach 5 seconds).

New Wi-Fi adapters are coming to market that basically have two radios and will be able to scan with no impact on performance on the connected channel, but their availability in the market is still minor and expected to grow quite slowly.

Alternatively instead WlanScan, one could use WlanGetAvailableNetworkList and get opportunistic network visibility data, but the freshness of that data depends on driver and network conditions, and in general it is not nearly good enough for network analyzer purposes.

In general Wlan APIs have not been designed for such usage.

So, @TimothyTitushttps://github.com/TimothyTitus - while your goal is indeed noble, valid, and useful, it is simply unrealistic to expect current single-radio wifi cards/chipsets to maintain a reliable, high-perf wifi connection whilst instructing the radio to sample each of the available networks.

Hopefully, as Wi-Fi 6https://en.wikipedia.org/wiki/IEEE_802.11ax / MIMOhttps://en.wikipedia.org/wiki/Multi-user_MIMO cards/chipsets that support multiple radios become more prevalent over time, your goals may be easier to achieve. However, as the engineering lead points out, this will take some time to become the norm, and is subject to driver vendors commitment to delivering high quality drivers that support independently driving multiple physical radios, etc.

So, in the meantime, one approach you might want to consider is fitting your engineers' laptops with USB wifi adaptors and using those devices to scan available networks, leaving the built-in Wi-Fi to handle normal traffic.

And if you want to survey Wi-Fi 6 networks, signals, etc. you'll likely need to use Wi-Fi 6 adaptors, as and when they start to (inevitably) arrive in-market.

Oh, and then there'll be Wi-Fi 7/802.11AY, etc. 😉

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-724902117, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RW4B4THOQNISGMBHZDSPGFCTANCNFSM4TKIXJVA.

HelgeKeck commented 3 years ago

Timothy,

what you want to do is a WiFi Survey, please take my advice and try to connect to a Certified Wirless Network Engineer (CWNE), search for them on Twitter, Facebook or LinkedIn. Thats what they every day do, they know exactly how you should do that.

Thats also a good starting point. https://wlanprofessionals.com/

TimothyTitus commented 3 years ago

I am working with a couple of vendors in the space already, thank you.

The intent is to assist them with creating tools for troubleshooting, so it’s not that we want to buy an existing tool – moreover build a solution that folks like yourself would want to use to better solve problems than what you currently have.

I should be asking you: What would you want in a tool that you currently can’t do with your existing tool? (wishlist)

From: HelgeKeck notifications@github.com Sent: Tuesday, November 10, 2020 1:00 PM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Mention mention@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

Timothy,

what you want to do is a WiFi Survey, please take my advice and try to connect to a Certified Wirless Network Engineer (CWNE), search for them on Twitter, Facebook or LinkedIn. Thats what they every day do, they know exactly how you should do that.

Thats also a good starting point. https://wlanprofessionals.com/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-724963174, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RQSKYTW6XMSO7ZMSQLSPGSWNANCNFSM4TKIXJVA.

bitcrazed commented 3 years ago

@TimothyTitus The purpose of WLAN_SIGNAL_QUALITY is not to enable you to perform real-time Wi-Fi signal survey, and so is unlikely to suit your goals of performing real-time signal survey.

And, alas, not every Wi-Fi cards/chipsets and/or driver expose accurate and detailed signal RSSI data, so a comprehensive solution is unlikely to be forthcoming in the short term.

TimothyTitus commented 3 years ago

Understood.

From: Rich Turner notifications@github.com Sent: Tuesday, November 10, 2020 1:17 PM To: microsoft/WinDev WinDev@noreply.github.com Cc: Tim Titus ttitus@pathsolutions.com; Mention mention@noreply.github.com Subject: Re: [microsoft/WinDev] Measuring WiFi signal strength via the standard API causes packet loss (#59)

@TimothyTitushttps://github.com/TimothyTitus The purpose of WLAN_SIGNAL_QUALITY is not to enable you to perform real-time Wi-Fi signal survey, and so is unlikely to suit your goals of performing real-time signal survey.

And, alas, not every Wi-Fi cards/chipsets and/or driver expose accurate and detailed signal RSSI data, so a comprehensive solution is unlikely to be forthcoming in the short term.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/WinDev/issues/59#issuecomment-724971526, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUH2RUM5UVYZPVURW4W2VDSPGUURANCNFSM4TKIXJVA.

bitcrazed commented 3 years ago

As if to make the reasons why one might experience packet loss while surveying all available Wi-Fi signals using a laptop's built-in Wi-Fi card/chipset, this just arrived in my Twitter feed 😜

At up to 5s dwell per network, that'd require up to 27 x 5s = 135 secs to survey available networks in this building!

https://twitter.com/Nick_Craver/status/1326293272076177408

image

And with that, since there's nothing to actively track here, I'll close this thread.

Thanks everyone for your input, recommendations, and considerations.