Closed ljonsson closed 6 years ago
Correct assessment and I fully agree this behavior is problematic. Eventually there should be a configuration for this, but in the mean time interfaces should be picked at random, testing only one at a time (if none is selected via the, not yet witten, argparse cli).
Any ideas on how to determine type of interface? I'd rather avoid name based guessing which seems problematic. Possibly detection based on the interfaces backend kernel driver? I suspect naming varies too much between distros and can be tweaked via udev and such. Thoughs?
I know for example on the Mac the 'en' prefix is assigned to wireless, wired, and thunderbolt interfaces. And right now, the code doesn't separate any OS. Which also needs cleaned up.
I'd use the interface that is associated with the default route. In most cases that should lead to the internet, even if it may route through a vpn interface on the way.
Eventually that should lead to a feature request for the ifcfg pypi module.
There is a default_interface() function in ifcfg, unfortunately it is broken on MacOS (always returns None).
PR added. Need to submit an enhancement request to ifcfg to fix default_interface() for MacOS and others that use "default" instead of "0.0.0.0" to signify default routes.
Link to PR: #19
Resolved as of 1c4eccca8355565, in combination with upstream fixes from the python-ifcfg module. Thanks for all your hard work on this @ljonsson.
Go ahead and test this again and close unless you see some remaining issue.
It seems that a speedtest is run on all interfaces that have an IP address, except lo. For example, a workstation that has an active VPN connection will have a utunX interface. Should try and be more careful about picking the right interface and only run the speedtest there.