gns3-server icon indicating copy to clipboard operation
gns3-server copied to clipboard

fix: binding to wrong interface in windows

Open a60814billy opened this issue 3 years ago • 1 comments

My computer has 3 Ethernet adapter as below:

  1. Ethernet (Intel Gigabit Network)
  2. VMware Network Adapter VMnet1 (VMware Virtual Ethernet Adapter for VMnet1)
  3. 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.

a60814billy avatar Jul 06 '22 06:07 a60814billy

"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.

josephmhiggins avatar Jul 06 '22 13:07 josephmhiggins

Hi @grossmj, could you review this PR? Let me know if there is anything needs to be changed.

a60814billy avatar Sep 28 '22 03:09 a60814billy

Hi @grossmj, could you review this PR? Let me know if there is anything needs to be changed.

Looks good 👍 Sorry for the delay

grossmj avatar Sep 28 '22 15:09 grossmj