There's a problem with a device being listed twice with the same hardware port name which is causing a lot of trouble since the OS X configuration utilities (both GUI System Preferences and command-line tool
networksetup) rely on the method
_SCNetworkInterfaceCreateWithEntity which tries to get an interface by its name but bails if the array
matching_interfaces contains more than one device.
networksetup -listallhardwareports returns the following output:
Hardware Port: H5321 gw Device: usbmodem Ethernet Address: N/A Hardware Port: H5321 gw Device: usbmodem Ethernet Address: N/A Hardware Port: PCI Serial Adapter (22) Device: pci-serial22 Ethernet Address: N/A Hardware Port: H5321 gw Device: wwan Ethernet Address: N/A Hardware Port: Ethernet Device: en0 Ethernet Address: 28:d2:44:05:79:1c Hardware Port: H5321 gw Device: en1 Ethernet Address: 02:15:e0:ec:01:00 Hardware Port: 802.11n WLAN Adapter Device: en2 Ethernet Address: 00:87:23:7a:44:9d Hardware Port: Bluetooth PAN Device: en3 Ethernet Address: f4:b7:e2:e8:4f:78
The culprit in this case is the interface
ls /dev | grep usbmodem
lists the two entities by seperate names (the number of the second one changes upon restart)
cu.usbmodem cu.usbmodem5 tty.usbmodem tty.usbmodem5
the network setup utility is pointing out the problem - the same hardware port name being used twice.
All methods which rely on
configd's implementation fail appending the message
more than one interface matches usbmodem
to the system log, which is why I can't use my WWAN modem.
I think having a way to rename / delete the second hardware port name might solve the problem but I don't know enough about the underlying implementations - I don't know which file or service is responsible for creating the hardware port list in the first place but maybe one of the *NIX gurus know anything about that, taking into consideration that OS X shares part of its code base with BSD.