1
0
mirror of https://github.com/open-simh/simh.git synced 2026-01-11 23:53:30 +00:00

179 Commits

Author SHA1 Message Date
Paul Koning
c064bb6676 Revert vmnet support, PR #443
This reverts commits 361ef76d through 6fd146ae.
2025-08-27 15:52:55 -04:00
B. Scott Michel
c20b391eea ETH_MAC indirection erratum
Pervasive misuse of "ETH_MAC *" (a pointer to an ETH_MAC, aka a 6
element unsigned char array) when a simple "ETH_MAC" is correct.  The
best example of this was eth_mac_fmt() in sim_ether.c with the following
prototype:

    t_stat eth_mac_fmt (ETH_MAC* const mac, char* strmac)

The first parameter is a pointer to an array of 6 unsigned characters,
whereas it really just wants to be a pointer to the first element of the
array:

    t_stat eth_mac_scan (const ETH_MAC mac, char* strmac)

The "ETH_MAC *" indirection error also results in subtle memcpy() and
memcmp() issues, e.g.:

    void network_func(DEVICE *dev, ETH_MAC *mac)
    {
      ETH_MAC other_mac;

      /* ...code... */

      /* memcpy() bug: */
      memcpy(other_mac, mac, sizeof(ETH_MAC));

      /* or worse: */
      memcpy(mac, other_mac, sizeof(ETH_MAC));
    }

eth_copy_mac() and eth_mac_cmp() replace calls to memcpy() and memcmp()
that copy or compare Ethernet MAC addresses. These are type-enforcing
functions, i.e., the parameters are ETH_MAC-s, to avoid the subtle
memcpy() and memcmp() bugs.

This fix solves at least one Heisenbug in _eth_close() while free()-ing
write request buffers (and possibly other Heisenbugs.)
2025-08-17 16:02:56 -04:00
Calvin Buckley
6fd146ae66 Keep track of generated vmnet MAC addr
The vmnet interface created for a simh instance has its own MAC address.
It doesn't seem too useful to for simh itself (you can just use whatever
MAC address and send/receive frames with that), but it does make
referencing it in other places (i.e. SHOW ETHERNET vs. ifconfig) easier.

The generated MAC address is provided at interface creation time; while
we could look it up earlier like with pcap, this seems more efficient.
2025-08-17 15:25:22 -04:00
Calvin Buckley
c1c2259b13 Move vmnet below the definition of MAX to avoid redefinition 2025-08-17 15:25:22 -04:00
Calvin Buckley
f30d7fc2ed Check for macOS 10.15 to used bridge mode, make usage clear
Bridged devices require macOS 10.15 to work correctly. Check if we're on
macOS 10.15 at runtime (so a newer SDK can be used to make simh binaries
that target older macOS), and at compile time (so an older SDK can be
used to build simh).

Also make it so vmnet: for host only is deprecated; you must explicitly
provide either host, shared, or a bridged device name.
2025-08-17 15:25:22 -04:00
Calvin Buckley
2fa8a63a6a Allow for shared/bridged mode, show in SHOW ETHERNET
Show the allowed bridged network devices SHOW ETHERNET, as well as the
shared/host networking modes. It also shows shared/host/device name for
bridge in i.e. "HELP XS" output as well.

Shared, bridged, and host modes have other options for configuration;
i.e. isolation, IP ranges, etc. Some of these are not well documented,
so should look into these. Bridged mode needs macOS 10.15.
2025-08-17 15:25:22 -04:00
Calvin Buckley
361ef76dbc Initial support for vmnet.framework
On macOS, tap devices for L2 networking are not supported out of the
box. While a kext can be added to provide tap support, the kext
experience is not very good; Apple has strongly recommended against
their usage.

As a replacement that's documented and recommended, Apple introduced the
vmnet framework, intended for emulators and virtualization software
explicitly. This API requires macOS 10.10, with bridged network support
coming in macOS 10.15.

This introduces basic support for vmnet.framework in SIMH. I've tested
it by booting an emulated MicroVAX 3800 from an emulated InfoServer 150,
where it was able to reach OpenVMS 7.3 standalone BACKUP.
2025-08-17 15:25:22 -04:00
Peter Schorn
0f6bcb9682 SIMH: Fix spelling errors in comments and strings 2024-07-11 12:29:53 +02:00
Steven A. Falco
5904fceddc The use of egrep is deprecated
On Fedora40, I get warnings that egrep is deprecated.  Replacing "egrep"
with "grep -E" eliminates the warnings, and is functionally identical.
2024-06-17 14:00:05 -04:00
Mark Pizzolato
7a6a325580 ETHER: Make sure SET NOASYNC is effective for Ethernet devices
- Make sure that asynchronous mode can't be changed if devices using
   sim_ether are already attached.
- Add missing DEV_ETHER type flag for the only sim_ether using device
   that didn't already have it.
2024-02-01 12:54:53 -05:00
B. Scott Michel
b588b4c28c ETHER: Add stub for clean compiles when building without network support 2022-09-19 12:17:48 -07:00
Mark Pizzolato
becceeb889 ETHER: Assure there's enough space to fetch the system GUID on Windows 2022-03-17 12:17:40 -07:00
Mark Pizzolato
4fa0eaad99 ETHER: Correct reversed supported version check for Npcap 2022-03-12 14:28:24 -08:00
Mark Pizzolato
5465707d77 PDP11, VAX: Fix Coverity issues in XQ and XU devices 2022-03-11 12:34:59 -08:00
Mark Pizzolato
660e2b9f3f ETHER: Add stub to support shared code with simh v3.x code base 2022-02-20 09:01:54 -08:00
Mark Pizzolato
e6ebf96f05 ETHER: Fix stub unit test routine declaration when sim_ether isn't used 2022-02-07 23:08:20 -08:00
Mark Pizzolato
a4054f33b8 SCP: Add command argument passed into library unit test routines 2022-02-07 04:21:16 -08:00
Mark Pizzolato
7756a38e31 ETHER: Silence stderr when determining NIC hardware addresses
As reported in #1112
2022-01-10 04:08:44 -08:00
Paul Koning
5cd1e8b7ac TMXR, PDP11, PDP10, VAX: Add DDCMP sync framer support
This adds support for the "framer" device, which is a USB-connected
device built around a Raspberry Pico that connects to a synchronous
line, either RS-232 or DEC "integral modem" coax connection.  It
implements the framing portion of DDCMP: clock recovery for the
integral modem case, byte sync, and DDCMP frame handling including
CRC.  The actual DDCMP protocol state machine, with its handling of
sequencing, timeout and retransmit, etc. is left to the host
software.  All the design files for the framer may be found at
https://github.com/pkoning2/ddcmp .

This commit adds code to drive the framer from the TMXR library,
allowing it to be used either from simulated DMC-11 or simulated
DUP-11 devices.  Both have been tested, using RSTS/E, RSX-11/M+, and
TOPS-20.

Fixed the one-digit limit on eth<n> device names, the limit is now 2.
2022-01-08 14:24:42 -08:00
Mark Pizzolato
8b33921c92 PDP11, VAX, ETHER: Generalize XQ device address filtering
Add optional enabling of broadcast address to hash based filter model.
LANCE based devices which use its AUTODIN II based hash generally
match the broadcast address independent of the contents of the
multicast hash.

This change to XQ mostly undoes the prior change to pdp11_xq and
brings the functionality into sim_ether so that it is generally available
for future ethernet devices.
2021-12-14 11:39:18 -08:00
Mark Pizzolato
c5cd38afbf SCP, makefile: Rename build conditional HAVE_DLOPEN to SIM_HAVE_DLOPEN
Some dependent packages on some platforms may also define HAVE_DLOPEN
and that definition may have different syntax or semantics.  This change
avoids the potential symbol conflict.

As reported in #1098
2021-12-04 17:44:57 -08:00
Mark Pizzolato
4c64878f7c ETHER: When opening an unused interface , avoid invoking non existent programs 2021-08-28 13:15:54 -07:00
Mark Pizzolato
153d849c13 ETHER: When gathering host NIC address, avoid invoking non existent programs
Historically on *nix platforms ifconfig was used to find the host system's
interface MAC address.  This isn't always available on all systems since
it's being replaced by the ip command.  We now only invoke commands
that exist.
2021-08-28 05:01:47 -07:00
Mark Pizzolato
3597772a08 TMXR, ETHER: Silence potential compiler warnings 2021-06-08 13:39:20 -07:00
Mark Pizzolato
e82910570f ETHER: Add support to determine host NIC address without ifconfig
- Recent Linux versions don't install ifconfig by default and now use
  the new ip command for network details.
- Avoid writing command results to a temp file and use popen instead.
2021-01-31 12:56:05 -08:00
Mark Pizzolato
beaa1e7387 ETHER: Properly support builds when pcap isn't available 2020-12-24 21:38:22 -08:00
Mark Pizzolato
bcaf577d21 ETHER: Reorg for warning free build with and without Ethernet support 2020-12-11 07:18:59 -08:00
Mark Pizzolato
2f38b5f779 ETHER: Proper cleanup while getting Linux system id 2020-12-11 07:18:43 -08:00
Lars Brinkhoff
970fb8ec95 PDP10, ETHER, VIDEO, VAX: Fix set but unused variables. 2020-11-25 04:50:47 -08:00
Mark Pizzolato
31606161ce SCP: Avoid potential compiler warnings
Essentially all are non-functional problems but silencing them is a good idea
2020-10-09 05:09:41 -07:00
Mark Pizzolato
5e46b298f1 ETHER: Silence several Coverity warnings.
Most were noise and non-issues, but the change from fclose() to
pclose() was absolutely needed.

A false positive remains regarding tun variable going out of scope.
Under the conditions where a resource leak could occur, the tun
variable is saved in *fd_handle and thus not leaked.
2020-08-08 17:52:04 -07:00
Mark Pizzolato
782ee133df ETHER: Update comments and network notes to describe Npcap support 2020-06-13 14:40:17 -07:00
Mark Pizzolato
8c57893675 ETHER: Avoid potential compiler warning about version string overrun
gcc 9.3.0 on Ubuntu 20.04 somehow knows that the length of the
string pcap_lib_version() returns can be 256 bytes long.  It then
generates a warning about truncation potential.  The problematic
code path will only be executed on Windows with an old version of
Npcap, but the compiler can't know that.  Make the local buffer
larger to silence the resulting noise.
2020-05-08 05:28:52 -07:00
Mark Pizzolato
07c274ac97 ETHER: Restore support fir Windows Npcap as Ethernet packet API
Version of Npcap 0.9990 restores full WinPcap functionality

As discussed in nmap/nmap#1929 and nmap/nmap#1343
2020-04-06 10:36:31 -07:00
Ryo Kogulé
7fe9434528 ETHER: Fix tap support on OS/X
As reported in #823
2020-03-22 09:19:25 -07:00
Mark Pizzolato
b3214fcb59 ETHER: Emit advice when asynch operation is attempted without USE_READER_THREAD 2020-03-10 19:53:25 -07:00
Mark Pizzolato
de335bfd6a ETHER: Silence Coverity indicated potential issues 2020-03-07 22:36:24 -08:00
Mark Pizzolato
565596a5af ETHER: Minor adjustments for building on the simh 3.x codebase 2020-03-06 15:32:12 -08:00
Mark Pizzolato
721e2f42c5 ETHER: Report Windows Npcap as unsupported in the Ethernet version string
Current versions of Npcap can talk directly to the host system's network
stack.  This defect was just discovered.  Fortunately, WinPcap 4.1.3 works
as needed and is still functional on Windows 10.

As discussed in nmap/nmap#1929 and nmap/nmap#1343
2020-02-19 01:39:13 -08:00
Mark Pizzolato
27ebb9a8ee ETHER: Fix typo in comment 2020-02-16 17:13:38 -08:00
Mark Pizzolato
9ba85568ac ETHER: Review and revise code to address Coverity endianness concerns 2020-01-30 21:46:20 -08:00
Mark Pizzolato
15590be464 ETHER: Avoid potential memory leak on network shutdown. 2020-01-30 04:26:36 -08:00
Mark Pizzolato
829e64ae67 ETHER: Fix Coverity identified issues
- Let dynamically loaded (Shared Library) routines do argument checking
  if they've been successfully loaded.
- Properly cast file descriptors into SOCKET when stored in the fd_handle
- Clean up error paths when opening tun/tap transports - potential leaks.
- Avoid possible string overflow when opening a tap device on Linux
- Try another way to ignore a return from fread() without getting
  warnings.
2020-01-30 02:26:20 -08:00
Mark Pizzolato
30c182a10c ETHER: Clean compile warning on Windows compiled as C++ 2020-01-29 11:33:41 -08:00
Mark Pizzolato
c88a450628 ETHER: Restore missing _eth_devices() stub when networking is disabled 2020-01-23 23:42:28 -08:00
Mark Pizzolato
ff0ee479a2 ETHER: Simplify error messages when dynamic libpcap loading fails
Only issue load failure message once per execution.
2020-01-23 22:40:18 -08:00
Mark Pizzolato
b18912cda8 SCP: Silence GCC optimizer warnings about unused function results 2019-12-30 15:33:51 -08:00
Mark Pizzolato
108291b3d4 ETHER: Fix fault when parsing bad NAT: parameters adding better error reporting 2019-09-05 17:40:16 -07:00
Mark Pizzolato
7398e63b00 ETHER: Only reference pcap_lib_version() when HAVE_PCAP_NETWORK is defined 2019-09-03 00:39:09 -07:00
Mark Pizzolato
a031e69881 ETHER: Fix additional race when closing a NAT(slirp) network connected device 2019-08-23 23:55:41 -07:00