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.)
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.
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.
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.
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.
- 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.
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.
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.
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
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.
- 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.
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.
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.
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
- 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.