diff --git a/Netch/Controllers/TUNController.cs b/Netch/Controllers/TUNController.cs index 09daf7a8..f9d0f91a 100644 --- a/Netch/Controllers/TUNController.cs +++ b/Netch/Controllers/TUNController.cs @@ -91,6 +91,7 @@ public class TUNController : Guard, IModeController var tunIndex = _tunNetworkInterface.GetIndex(); _tun = NetRoute.TemplateBuilder(_tunConfig.Gateway, tunIndex); + Global.MainForm.StatusText(i18N.Translate("Assign Unicast IP")); if (!RouteHelper.CreateUnicastIP(AddressFamily.InterNetwork, _tunConfig.Address, (byte)Utils.Utils.SubnetToCidr(_tunConfig.Netmask), diff --git a/Netch/Interops/RouteHelper.cs b/Netch/Interops/RouteHelper.cs index 32de632b..ef24cce2 100644 --- a/Netch/Interops/RouteHelper.cs +++ b/Netch/Interops/RouteHelper.cs @@ -49,11 +49,10 @@ public static unsafe class RouteHelper { if (type != MIB_NOTIFICATION_TYPE.MibInitialNotification) { - // TODO pass error NTSTATUS state; if ((state = GetUnicastIpAddressEntry(row)) != 0) { - Log.Error("CreateUnicastIpAddressEntry failed: {0}", state); + Log.Error("GetUnicastIpAddressEntry failed: {State}", state.Value); return; } @@ -79,11 +78,16 @@ public static unsafe class RouteHelper NTSTATUS state; if ((state = CreateUnicastIpAddressEntry(&addr)) != 0) { - Log.Error("CreateUnicastIpAddressEntry failed: {0}", state); + Log.Error("CreateUnicastIpAddressEntry failed: {State}", state.Value); + return false; + } + + if (!obj.WaitOne(TimeSpan.FromSeconds(10))) + { + Log.Error("Wait unicast IP usable timeout"); return false; } - obj.WaitOne(); return true; } finally