Skip to content

Conversation

mderoy
Copy link

@mderoy mderoy commented Jun 12, 2018

Inital WIP commit. Still needs more changes, testing, etc.
we should probably upstream this once we're done.

manually tested output of this against .netFW

(Scripting Upgrade) Fixed an issue where GetIPv4Properties could throw an exception when called on the loopback network interface (case 1027045)

public void Test()
{
	var interfaces = NetworkInterface.GetAllNetworkInterfaces();
	foreach (NetworkInterface ni in interfaces)
	{
		var ipv4Properties = ni.GetIPProperties().GetIPv4Properties();
		UnityEngine.Debug.Log(ni.Name + " " + ipv4Properties.Index);
		var isDHCP = ipv4Properties.IsDhcpEnabled;
		UnityEngine.Debug.Log("isDHCP " + isDHCP);
		var iswins = ipv4Properties.UsesWins;
		UnityEngine.Debug.Log("UsesWins " + iswins);



		var dhcpserveraddrcol = ni.GetIPProperties().DhcpServerAddresses;
		foreach (var dhcp in dhcpserveraddrcol)
			UnityEngine.Debug.Log("dhcpserver " + dhcp.Address);
		var gatewayipaddressinformationcol = ni.GetIPProperties().GatewayAddresses;
		foreach (var gateway in gatewayipaddressinformationcol)
			UnityEngine.Debug.Log("gatewayserver " + gateway.Address);
		var unicastipaddresinformationcol = ni.GetIPProperties().UnicastAddresses;
		foreach (var unicast in unicastipaddresinformationcol)
			UnityEngine.Debug.Log("unicastserver " + unicast.Address);
		var winsipaddresscol = ni.GetIPProperties().WinsServersAddresses;
		foreach (var ftw in winsipaddresscol)
			UnityEngine.Debug.Log("winsserver " + ftw.Address);
	}
}

@mderoy mderoy requested review from joshpeterson and joncham June 13, 2018 21:39
@mderoy mderoy force-pushed the unity-master-fix-ip-exceptions branch from a031d1d to e745dcb Compare June 14, 2018 13:46
…xOutOfRangeException: No adapter found for index
@mderoy mderoy force-pushed the unity-master-fix-ip-exceptions branch from e745dcb to 5311365 Compare July 17, 2018 14:42
@mderoy mderoy changed the title WIP: Fix issue where loopback interface causes exception Fix issue where loopback interface causes exception Aug 22, 2018
@mderoy
Copy link
Author

mderoy commented Aug 27, 2018

They've accepted these changes upstream. I'll merge now. should be same changes as upstream (except where upstream moved a few things around)

@mderoy mderoy changed the title Fix issue where loopback interface causes exception Fix issue where loopback interface causes exception 1027045 Aug 27, 2018
@mderoy mderoy merged commit e772233 into unity-master Aug 27, 2018
@mderoy mderoy deleted the unity-master-fix-ip-exceptions branch August 27, 2018 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants