mirror of
https://github.com/simh/simh.git
synced 2026-03-05 02:45:19 +00:00
Base vmnet support covers bridged network interfaces and locally accessible TAP network connections. These reflect the vmnet bridged and host behaviors which are leveraged under the covers, but configured using the original sim_ether commands. The resulting bridged case behaves like the Windows network connections do (with direct access to and from the local LAN as well as the host system) using the natural interface name. NAT behaviors are specifically supported using the original SLiRP code since the vmnet support depends on simulators primarily getting IPv4 addressing via DHCP, but essentially no simh simulators actually had OS network code which used DHCP and all merely used static network address setup. The vmnet (shared/NAT) support can't be configured to operate with the same DHCP and static IP addresses provided by the original SLiRP implementation and to avoid the need to specifically change hard coded simulator IPv4 addresses before things could work. - Detect which network interfaces are WiFi (when possible) and thus not useful candidates for bridging. - Cleanly report when running as root is needed. - Avoid allowing network connections to interfaces which aren't actually connected to a network. - Add support to explicitly set TAP network host side network interface's IPv4 address and netmask. This optional support is provided specifically for the Apple vmnet case, but not for other platforms using TAP network connections due to the various ways that must be handled with external commands. - Add host system's IPv4 address, netmask, media type and connection state to interface descriptions visible via SHOW ETHERNET. Some system environments may have a significant number of potential network interfaces, most of which aren't interesting to connect simulators to. Knowing which interfaces are actually in useful states helps users select the correct device. The vmnet aspect of this functionality was originally inspired by Calvin Buckley's pull request to the open-simh repository. That solution wouldn't actually operate well certainly for NAT cases due to the forced DHCP to non-configurable address blocks and the lack of any way to support static addresses TCP or UDP port mapping.
53 lines
1.5 KiB
C
53 lines
1.5 KiB
C
#ifndef SIM_SLIRP_H
|
|
#define SIM_SLIRP_H
|
|
|
|
#if defined(HAVE_SLIRP_NETWORK) || defined(HAVE_VMNET_NETWORK)
|
|
|
|
#include "sim_defs.h"
|
|
|
|
struct redir_tcp_udp {
|
|
struct in_addr inaddr;
|
|
int is_udp;
|
|
int port;
|
|
int lport;
|
|
struct redir_tcp_udp *next;
|
|
};
|
|
|
|
struct sim_net_attributes {
|
|
char *args;
|
|
int nat_type;
|
|
struct in_addr vnetwork;
|
|
struct in_addr vnetmask;
|
|
int maskbits;
|
|
struct in_addr vgateway;
|
|
int dhcpmgmt;
|
|
struct in_addr vdhcp_start;
|
|
struct in_addr vdhcp_end;
|
|
struct in_addr vnameserver;
|
|
char *boot_file;
|
|
char *tftp_path;
|
|
char *dns_search;
|
|
char **dns_search_domains;
|
|
struct redir_tcp_udp *rtcp;
|
|
};
|
|
|
|
|
|
typedef struct sim_net_attributes NAT;
|
|
typedef struct sim_slirp SLIRP;
|
|
|
|
typedef void (*packet_callback)(void *opaque, const unsigned char *buf, int len);
|
|
|
|
SLIRP *sim_slirp_open (const char *args, void *opaque, packet_callback callback, DEVICE *dptr, uint32 dbit, char *errbuf, size_t errbuf_size);
|
|
void sim_slirp_close (SLIRP *slirp);
|
|
int sim_slirp_send (SLIRP *slirp, const char *msg, size_t len, int flags);
|
|
int sim_slirp_select (SLIRP *slirp, int ms_timeout);
|
|
void sim_slirp_dispatch (SLIRP *slirp);
|
|
void sim_slirp_show (SLIRP *slirp, FILE *st);
|
|
int sim_nat_parse_args (NAT *nat, const char *args, int nat_type, char *errbuf, size_t errbuf_size);
|
|
t_stat sim_nat_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr);
|
|
void sim_nat_show (NAT *nat, FILE *st);
|
|
|
|
#endif /* HAVE_SLIRP_NETWORK */
|
|
|
|
#endif
|