You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/win_loopback.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Windows Loopback Traffic Monitoring: Why ETW Fails and Npcap Works
1
+
# Windows Loopback Traffic Monitoring: Why Standard APIs Fail and Npcap Works
2
2
3
3
> **[📖 English](win_loopback.md)**
4
4
> **[📖 简体中文(大陆)](win_loopback.zh-cn.md)**
@@ -114,12 +114,13 @@ macOS inherits BSD's design philosophy: loopback is an ordinary network interfac
114
114
115
115
## winload's Solution
116
116
117
-
winload provides two Windows loopback capture backends:
117
+
winload uses **Npcap** as its Windows loopback capture backend:
118
118
119
119
- **`--npcap` (recommended)**: Captures real loopback packets via Npcap's WFP callout. Accurate data.
120
120
Requires [Npcap](https://npcap.com/#download) installed with "Support loopback traffic capture" enabled.
121
121
122
-
- **`--etw` (experimental)**: Polls counters via `GetIfEntry` API.
123
-
Due to the Windows kernel deficiency described above, most versions return 0. **Essentially non-functional.** Kept only for completeness.
122
+
> I previously experimented with polling `GetIfEntry` / `GetIfTable` counters directly, hoping to avoid the Npcap dependency. The result? Counters stubbornly stayed at 0 on every Windows version I tested. As detailed above, this is because the loopback pseudo-interface has no NDIS driver behind it — so there is simply nothing to count. I ended up removing that code path entirely. Thanks, Microsoft, for the *delightful* consistency.
124
123
125
-
On Linux / macOS, loopback traffic is obtained directly via the `sysinfo` crate — no extra flags needed.
124
+
So yes — to monitor loopback traffic on Windows, you need to install a third-party driver. On Linux and macOS it just works out of the box, because those operating systems treated loopback as a real network device from the start. On Windows, the [Npcap](https://npcap.com/#download) project graciously fills the gap that the OS left behind.
125
+
126
+
On Linux / macOS, loopback traffic is obtained directly via the [`sysinfo`](https://crates.io/crates/sysinfo) crate — no extra flags needed.
|`--etw`|`GetIfEntry` API polling | ⚠️ Experimental — counters are 0 on most Windows versions |
126
+
```bash
127
+
winload --npcap
128
+
```
129
+
130
+
This requires [Npcap](https://npcap.com/#download) installed with "Support loopback traffic capture" enabled during setup.
131
131
132
-
**To use `--npcap`**: Install [Npcap](https://npcap.com/#download) and enable "Support loopback traffic capture" during installation.
132
+
> I previously tried polling Windows' own `GetIfEntry` API directly, but the counters are always 0 for loopback — there is simply no NDIS driver behind the loopback pseudo-interface to count anything. That code path has been removed.
133
133
134
134
> 📖 For a deep dive into why Windows loopback is broken, see [docs/win_loopback.md](docs/win_loopback.md)
135
135
136
136
On Linux and macOS, loopback traffic works out of the box — no extra flags needed.
0 commit comments