giampaolo / psutil

Cross-platform lib for process and system monitoring in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Windows] Missing NICS in psutil.net_if_addrs() when no IP protocol is set

deajan opened this issue · comments

Summary

  • OS: Windows 11
  • Architecture: x86-64
  • Psutil version: 5.9.7
  • Python version: Python 3.11.5
  • Type: core

Description

I was playing with psutil.net_if_addrs() to list all the NICS on a server, but noticed that two NICS were missing.
Upon investigation, it seems that when the NIC interface doesn't have IPv4 and IPv6 protocol enabled, psutil won't add them to the list of NICS.
While this could look like a normal bahavior, it limits the ability of psutil to see bridged / virtual switch connected NICs that will have IP protocol disabled because of the bridging.
All kind of hypervisor systems (VirtualBox, VMWare workstation, Hyper-V) and other bridged NICS will be impacted by this.

Best regards.