gns3-server
gns3-server copied to clipboard
fix: binding to wrong interface in windows
My computer has 3 Ethernet adapter as below:
- Ethernet (Intel Gigabit Network)
- VMware Network Adapter VMnet1 (VMware Virtual Ethernet Adapter for VMnet1)
- VMware Network Adapter VMnet8 (VMware Virtual Ethernet Adapter for VMnet8)
When I'm binding the interface to "Ethernet", the connection always binding to VMnet8.
I dive into the source code, and found the interface search algorithm uses "in" operator and not early return first result.
So It's runs to "Ethernet" in interface["netcard"] and match the last network adapter. (Because VMware Virtual Ethernet Adapter for VMnet8)
This PR fixes the issue, and using "exact match" in interface["name"], then using in operator to find in interface["netcard"] if first case not found anything.
"The algorithm" has problems. The algorithm that gave me problems that I ran into is different than yours - I think. Long story short, my algorithm was after uninstalling vmware ws and switching to virtualbox. It took me 3 weeks to figure out that during the uninstalling vmware that I checked "Keep configuration settings", so I have to investigate that aspect of my problem but your code gave me a 16 hour head start on where to begin looking.
Hi @grossmj, could you review this PR? Let me know if there is anything needs to be changed.
Hi @grossmj, could you review this PR? Let me know if there is anything needs to be changed.
Looks good 👍 Sorry for the delay