Skip to content

Commit

Permalink
tcpip: ignore network with a netmask set to None (#478)
Browse files Browse the repository at this point in the history
* tcpip: ignore network with a netmask set to None

For such netmask, the mask is 32 bits long per psutil docs and

* update release notes
  • Loading branch information
MatthieuDartiailh authored Dec 29, 2024
1 parent d484ff9 commit 3eb0986
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ PyVISA-py Changelog
0.7.3 (unreleased)
------------------

- ignore network interface card with no subnet mask when discovering TCPIP
resources PR #478
- add VICP INSTR to the supported interface for TCPIP keep alive attr PR #477
- add read_stb method for TCPIP HiSLIP client PR #429
- fix usbtmc implementation to respect section 3.3 of the spec PR #449
Read now reads from usb until a "short packet" or if all data (`transfer_size`) PR #465
Expand Down
2 changes: 1 addition & 1 deletion pyvisa_py/tcpip.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def list_resources() -> List[str]:
# Get broadcast address for each interface
for interface, snics in psutil.net_if_addrs().items():
for snic in snics:
if snic.family is socket.AF_INET:
if snic.family is socket.AF_INET and snic.netmask is not None:
addr = snic.address
mask = snic.netmask
network = ipaddress.IPv4Network(addr + "/" + mask, strict=False)
Expand Down

0 comments on commit 3eb0986

Please sign in to comment.