diff --git a/Contralto/Configuration.cs b/Contralto/Configuration.cs index 75fedd0..80fe981 100644 --- a/Contralto/Configuration.cs +++ b/Contralto/Configuration.cs @@ -88,8 +88,7 @@ namespace Contralto { // Initialize things to defaults. HostAddress = 0x22; - - AlternateBootType = AlternateBootType.Disk; + BootAddress = 0; BootFile = 0; @@ -112,6 +111,13 @@ namespace Contralto } ReadConfiguration(); + + // Special case: On first startup, AlternateBoot will come back as "None" which + // is an invalid UI setting; default to Ethernet in this case. + if (AlternateBootType == AlternateBootType.None) + { + AlternateBootType = AlternateBootType.Ethernet; + } } /// diff --git a/Contralto/IO/EthernetController.cs b/Contralto/IO/EthernetController.cs index e751b71..6bba325 100644 --- a/Contralto/IO/EthernetController.cs +++ b/Contralto/IO/EthernetController.cs @@ -37,8 +37,7 @@ namespace Contralto.IO _receiverLock = new System.Threading.ReaderWriterLockSlim(); - _fifo = new Queue(); - Reset(); + _fifo = new Queue(); _fifoTransmitWakeupEvent = new Event(_fifoTransmitDuration, null, OutputFifoCallback); @@ -74,10 +73,17 @@ namespace Contralto.IO _nextPackets = new Queue(); _inputPollEvent = new Event(_inputPollPeriod, null, InputHandler); + + Reset(); } public void Reset() - { + { + _nextPackets.Clear(); + _inputPollActive = false; + _countdownWakeup = false; + _outputIndex = 0; + ResetInterface(); } diff --git a/Contralto/IO/HostEthernetEncapsulation.cs b/Contralto/IO/HostEthernetEncapsulation.cs index 3cc6978..2e86bf1 100644 --- a/Contralto/IO/HostEthernetEncapsulation.cs +++ b/Contralto/IO/HostEthernetEncapsulation.cs @@ -95,7 +95,7 @@ namespace Contralto.IO _callback = callback; // Now that we have a callback we can start receiving stuff. - Open(true /* promiscuous */, int.MaxValue); + Open(false /* not promiscuous */, int.MaxValue); BeginReceive(); } @@ -125,7 +125,6 @@ namespace Contralto.IO throw new InvalidOperationException("Raw packet data must contain at least two bytes for addressing."); } - // // Outgoing packet contains 1 extra word (2 bytes) containing // the prepended packet length (one word) @@ -150,7 +149,7 @@ namespace Contralto.IO // // Grab the source and destination host addresses from the packet we're sending - // and build 10mbit versions. + // and build 10mbit versions as necessary. // byte destinationHost = packetBytes[2]; byte sourceHost = packetBytes[3]; @@ -160,7 +159,7 @@ namespace Contralto.IO Conversion.ToOctal(destinationHost), length); - MacAddress destinationMac = Get10mbitDestinationMacFrom3mbit(destinationHost); + MacAddress destinationMac = new MacAddress(_10mbitBroadcast); MacAddress sourceMac = new MacAddress((UInt48)(_10mbitMACPrefix | Configuration.HostAddress)); // Build the outgoing packet; place the source/dest addresses, type field and the raw data. @@ -190,7 +189,7 @@ namespace Contralto.IO // Filter out packets intended for the emulator, forward them on, drop everything else. // if ((int)p.Ethernet.EtherType == _3mbitFrameType && // encapsulated 3mbit frames - (p.Ethernet.Source.ToValue() != (UInt48)(_10mbitMACPrefix | Configuration.HostAddress))) // and not sent by this emulator + (p.Ethernet.Source.ToValue() != (UInt48)(_10mbitMACPrefix | Configuration.HostAddress))) // and not sent by this emulator { Log.Write(LogComponent.HostNetworkInterface, "Received encapsulated 3mbit packet."); _callback(p.Ethernet.Payload.ToMemoryStream()); @@ -241,25 +240,7 @@ namespace Contralto.IO Log.Write(LogComponent.HostNetworkInterface, "Receiver thread started."); _communicator.ReceivePackets(-1, ReceiveCallback); - } - - private MacAddress Get10mbitDestinationMacFrom3mbit(byte destinationHost) - { - MacAddress destinationMac; - - if (destinationHost == _3mbitBroadcast) - { - // 3mbit broadcast gets translated to 10mbit broadcast - destinationMac = new MacAddress(_10mbitBroadcast); - } - else - { - // Build 10mbit address from 3mbit - destinationMac = new MacAddress((UInt48)(_10mbitMACPrefix | destinationHost)); // emulator destination address - } - - return destinationMac; - } + } private LivePacketDevice _interface; private PacketCommunicator _communicator; @@ -278,7 +259,6 @@ namespace Contralto.IO /// private UInt48 _10mbitMACPrefix = 0x0000aa010200; // 00-00-AA is the Xerox vendor code, used just to be cute. - private UInt48 _10mbitBroadcast = (UInt48)0xffffffffffff; - private const int _3mbitBroadcast = 0; + private UInt48 _10mbitBroadcast = (UInt48)0xffffffffffff; } } diff --git a/Contralto/UI/SystemOptions.cs b/Contralto/UI/SystemOptions.cs index 37beb56..eeeb5db 100644 --- a/Contralto/UI/SystemOptions.cs +++ b/Contralto/UI/SystemOptions.cs @@ -132,6 +132,7 @@ namespace Contralto.UI // Add all interfaces that PCAP knows about. case PacketInterfaceType.EthernetEncapsulation: + if (Configuration.HostRawEthernetInterfacesAvailable) { foreach (LivePacketDevice device in LivePacketDevice.AllLocalMachine) {