From 7ccd1f9e4c37502b0db682a8f282e4186ad97b66 Mon Sep 17 00:00:00 2001 From: Josh Dersch Date: Thu, 21 Feb 2019 18:31:14 -0800 Subject: [PATCH] Tweaks for ncap (replacement for winpcap), small fix for ethernet controller. --- D/Ethernet/EthernetController.cs | 3 ++- D/Ethernet/HostEthernet.cs | 3 ++- D/UI/ConfigurationDialog.cs | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/D/Ethernet/EthernetController.cs b/D/Ethernet/EthernetController.cs index 452de85..7b9c60c 100644 --- a/D/Ethernet/EthernetController.cs +++ b/D/Ethernet/EthernetController.cs @@ -320,6 +320,7 @@ namespace D.Ethernet // Throw out input data and stop the receiver _fifo.Clear(); + _inputPacket.Clear(); _inAttn = false; _rxMode_ = true; StopReceiver(); @@ -546,7 +547,7 @@ namespace D.Ethernet if (!_enableRcv || !_turnOff_) { // - // Receiver is offjust drop the packet on the floor. + // Receiver is off, just drop the packet on the floor. // if (Log.Enabled) Log.Write(LogComponent.EthernetControl, "Ethernet receiver is off; dropping this packet."); diff --git a/D/Ethernet/HostEthernet.cs b/D/Ethernet/HostEthernet.cs index 2d247a5..edd0307 100644 --- a/D/Ethernet/HostEthernet.cs +++ b/D/Ethernet/HostEthernet.cs @@ -81,7 +81,8 @@ namespace D.Ethernet // // We use the friendly name to make it easier to specify in config files. // - if (((WinPcapDevice)device).Interface.FriendlyName.ToLowerInvariant() == name.ToLowerInvariant()) + if (!string.IsNullOrWhiteSpace(((WinPcapDevice)device).Interface.FriendlyName) && + ((WinPcapDevice)device).Interface.FriendlyName.ToLowerInvariant() == name.ToLowerInvariant()) { AttachInterface(device); break; diff --git a/D/UI/ConfigurationDialog.cs b/D/UI/ConfigurationDialog.cs index ebfd039..9e1e968 100644 --- a/D/UI/ConfigurationDialog.cs +++ b/D/UI/ConfigurationDialog.cs @@ -137,8 +137,11 @@ namespace D.UI { foreach (WinPcapDevice device in CaptureDeviceList.Instance) { - EthernetInterfaceListBox.Items.Add( - new EthernetInterface(device.Interface.FriendlyName, device.Interface.Description)); + if (!string.IsNullOrWhiteSpace(device.Interface.FriendlyName)) + { + EthernetInterfaceListBox.Items.Add( + new EthernetInterface(device.Interface.FriendlyName, device.Interface.Description)); + } } } else