Opened 11 months ago

Last modified 11 months ago

#28593 new enhancement

On macOS/iOS, experiment with SystemConfiguration.framework to get a list of network interfaces

Reported by: rl1987 Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: macos ios
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by rl1987)

To get a list of network interfaces, we use platform-specific API (GetAdaptersAddresses()) on Windows and getifaddrs() on Unix/Linux if possible. Failing that, Tor can also call ioctl().

On Darwin, there's a platform API to get and enumerate network interfaces.

See: https://developer.apple.com/documentation/systemconfiguration/1517090-scnetworkinterfacecopyall?language=objc

We should experiment with that and decide if we want to use it as a primary way to get network interfaces on macOS/iOS.

Child Tickets

Change History (3)

comment:1 Changed 11 months ago by rl1987

Description: modified (diff)

comment:2 Changed 11 months ago by teor

Do we already link to SystemConfiguration.framework?
If not, this kind of platform-specific code could cause dependency issues.
(Apple is better with dependencies than Microsoft, but they have caused us issues in the past few macOS releases.)

Also, the configuration keys don't seem to be documented anywhere. (I can't find out how to get the IPv4 or IPv6 address.)
https://developer.apple.com/documentation/systemconfiguration/1517352-scnetworkprotocolgetconfiguratio?language=objc

This will make writing code that's portable across macOS versions really difficult: how will we know the macOS version when keys were added?

comment:3 Changed 11 months ago by nickm

Milestone: Tor: unspecified
Note: See TracTickets for help on using tickets.