psutil icon indicating copy to clipboard operation
psutil copied to clipboard

net_if_addr should return interface index

Open kochelmonster opened this issue 5 years ago • 3 comments

Some socket options (e.g. IPV6_MULTICAST_IF) need the interface index. In the current implementation of net_if_addr this information get lost. Please either add an "ifn" field to the snicaddr tuple or return an OrderedDict with the orignal iface order.

kochelmonster avatar Sep 15 '19 22:09 kochelmonster

What's that? What's the use case? Does ifconfig report it?

giampaolo avatar Nov 20 '19 10:11 giampaolo

socket.IPV6_JOIN_GROUP needs the interface index.

kochelmonster avatar Nov 21 '19 17:11 kochelmonster

@kochelmonster did you find a way to get the interface index? The interface names returned by psutil don't match socket.if_nameindex for me on Windows.

It's included in the table psutil queries for interface info on Windows, but I'm not sure if that's true for other operating systems.

Gracecr avatar Aug 07 '23 16:08 Gracecr