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

ETHER: Coalesce Ethernet devices with consistent hierarchical attach help

Migrate platform dependencies into sim_ether's help rather that
scattered amongst each functional Ethernet device.
This commit is contained in:
Mark Pizzolato 2025-10-10 17:53:57 -10:00
parent a074ebae8c
commit 85e1957fd0
7 changed files with 202 additions and 254 deletions

View File

@ -1081,31 +1081,9 @@ t_stat ni_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr)
" Please note, however, that the %D driver for AT&T System V R3 UNIX\n" " Please note, however, that the %D driver for AT&T System V R3 UNIX\n"
" always sets a MAC in the AT&T range through a software command.\n" " always sets a MAC in the AT&T range through a software command.\n"
"1 Attaching\n" "1 Attaching\n"
" The %D card must be attached to a LAN device to communicate with systems\n" " %1A\n"
" on the LAN.\n" ETH_PLATFORM_SCP_DETAILS
"\n" /****************************************************************************/
" To get a list of available devices on your host platform, use the command:\n"
"\n"
"+sim> SHOW ETH\n"
"\n"
" After enabling the card, it can be attached to one of the host's\n"
" Ethernet devices with the ATTACH command. For example, depending on your\n"
" platform:\n"
"\n"
"+sim> ATTACH %D eth0\n"
"+sim> ATTACH %D en0\n"
"1 Dependencies\n"
#if defined(_WIN32)
" The NPcap or WinPcap package must be installed in order to enable\n"
" communication with the host system or other computers on the local LAN.\n"
"\n"
" The NPcap package is available from https://github.com/nmap/npcap\n"
" The WinPcap package is available from http://www.winpcap.org/\n"
#else
" To build simulators with the ability to communicate to other computers\n"
" on the local LAN, the libpcap development package must be installed on\n"
" the system which builds the simulator.\n"
#endif
"1 Performance\n" "1 Performance\n"
" The simulated NI device is capable of much faster transfer speeds than\n" " The simulated NI device is capable of much faster transfer speeds than\n"
" the real NI card in a 3B2, which was limited to a 10 Mbit pipe shared\n" " the real NI card in a 3B2, which was limited to a 10 Mbit pipe shared\n"

View File

@ -3298,47 +3298,7 @@ const char helpString[] =
"\n" "\n"
/****************************************************************************/ /****************************************************************************/
"2 Attach\n" "2 Attach\n"
" The device must be attached to a LAN device to communicate with systems\n" " %2A\n"
" on that LAN\n"
"\n"
"+sim> SHOW %D ETH\n"
"+ETH devices:\n"
#if defined(_WIN32)
"+ eth0 \\Device\\NPF_{A6F81789-B849-4220-B09B-19760D401A38} (Local Area Connection)\n"
"+ eth1 udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)\n"
"+sim> ATTACH %D eth0\n"
#else
"+ eth0 en0 (No description available)\n"
"+ eth1 tap:tapN (Integrated Tun/Tap support)\n"
"+ eth2 udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)\n"
"+sim> ATTACH %D eth0\n"
"+sim> ATTACH %D en0\n"
#endif
"+sim> ATTACH %D udp:1234:remote.host.com:1234\n"
"\n"
"2 Examples\n\n"
" Given a simulator that only wants to talk IP to the outside world use\n"
" the following example:\n"
" \n"
"+sim> ATTACH %D NAT:\n"
" \n"
" Given a simulator that only wants to talk IP but also wants to allow\n"
" incoming telnet use the following example:\n"
" \n"
"+sim> ATTACH %D NAT:tcp=2323:10.0.2.15:23\n"
" \n"
" This allows connections to host port 2323 to reach port 23 on the\n"
" simulated which is configured with IP Address 10.0.2.15\n"
"\n"
" Given a simulator that only wants to talk IP but also wants to allow\n"
" incoming telnet and ftp use the following example:\n"
" \n"
"+sim> ATTACH %D NAT:tcp=2323:10.0.2.15:23,tcp=2121:10.0.2.15:21\n"
" \n"
" This allows connections to host port 2323 to reach port 23 on the\n"
" simulated which is configured with IP Address 10.0.2.15 and connections\n"
" to host port 2121 to reach port 21 on the simulated system.\n"
"\n"
"1 Monitoring\n" "1 Monitoring\n"
" The %D device configuration and state can be displayed with one of the\n" " The %D device configuration and state can be displayed with one of the\n"
" available show commands.\n" " available show commands.\n"
@ -3376,35 +3336,7 @@ const char helpString[] =
"+sim> SET %D DEBUG\n" "+sim> SET %D DEBUG\n"
"\n" "\n"
/****************************************************************************/ /****************************************************************************/
"1 Dependencies\n" ETH_PLATFORM_SCP_DETAILS
#if defined(_WIN32)
" The NPcap or WinPcap package must be installed in order to enable\n"
" communication with the host system or other computers on the local LAN.\n"
"\n"
" The NPcap package is available from https://github.com/nmap/npcap\n"
" The WinPcap package is available from http://www.winpcap.org/\n"
#else
" To build simulators with the ability to communicate to other computers\n"
" on the local LAN, the libpcap development package must be installed on\n"
" the system which builds the simulator.\n"
"\n"
#endif
"1 Privileges Required\n"
#if defined(_WIN32)
" Windows systems can attach the simulated %D device to the local LAN\n"
" network interface without any special privileges as long as the\n"
" WinPcap package has been previously installed on the host system.\n"
#else
" Linux, MacOS and most other Unix like systems require root privilege\n"
" to access network interfaces on the host system.\n"
#endif
"1 Host Computer Communications\n"
#if defined(_WIN32)
" On Windows using the WinPcap interface, the simulated %D device\n"
" can be used to communicate with the host computer on the same LAN\n"
" which it is attached to.\n"
#else
#endif
/****************************************************************************/ /****************************************************************************/
"1 Performance\n" "1 Performance\n"
" On modern host systems and networks, the simulated DEQNA/DELQA/DELQA-T\n" " On modern host systems and networks, the simulated DEQNA/DELQA/DELQA-T\n"
@ -3426,8 +3358,7 @@ const char helpString[] =
"++XS VAX simulators\n" "++XS VAX simulators\n"
"++NI AT&T 3b2 simulator\n" "++NI AT&T 3b2 simulator\n"
"++NIA-20 KL10 simulator\n" "++NIA-20 KL10 simulator\n"
"\n" "\n";
;
return scp_help (st, dptr, uptr, flag, helpString, cptr); return scp_help (st, dptr, uptr, flag, helpString, cptr);
} }

View File

@ -1996,47 +1996,7 @@ const char helpString[] =
"\n" "\n"
/****************************************************************************/ /****************************************************************************/
"2 Attach\n" "2 Attach\n"
" The device must be attached to a LAN device to communicate with systems\n" " %2A\n"
" on that LAN\n"
"\n"
"+sim> SHOW %D ETH\n"
"+ETH devices:\n"
#if defined(_WIN32)
"+ eth0 \\Device\\NPF_{A6F81789-B849-4220-B09B-19760D401A38} (Local Area Connection)\n"
"+ eth1 udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)\n"
"+sim> ATTACH %D eth0\n"
#else
"+ eth0 en0 (No description available)\n"
"+ eth1 tap:tapN (Integrated Tun/Tap support)\n"
"+ eth2 udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)\n"
"+sim> ATTACH %D eth0\n"
"+sim> ATTACH %D en0\n"
#endif
"+sim> ATTACH %D udp:1234:remote.host.com:1234\n"
"\n"
"2 Examples\n\n"
" Given a simulator that only wants to talk IP to the outside world use\n"
" the following example:\n"
" \n"
"+sim> ATTACH %D NAT:\n"
" \n"
" Given a simulator that only wants to talk IP but also wants to allow\n"
" incoming telnet use the following example:\n"
" \n"
"+sim> ATTACH %D NAT:tcp=2323:10.0.2.15:23\n"
" \n"
" This allows connections to host port 2323 to reach port 23 on the\n"
" simulated which is configured with IP Address 10.0.2.15\n"
"\n"
" Given a simulator that only wants to talk IP but also wants to allow\n"
" incoming telnet and ftp use the following example:\n"
" \n"
"+sim> ATTACH %D NAT:tcp=2323:10.0.2.15:23,tcp=2121:10.0.2.15:21\n"
" \n"
" This allows connections to host port 2323 to reach port 23 on the\n"
" simulated which is configured with IP Address 10.0.2.15 and connections\n"
" to host port 2121 to reach port 21 on the simulated system.\n"
"\n"
"1 Monitoring\n" "1 Monitoring\n"
" The %D device configuration and state can be displayed with one of the\n" " The %D device configuration and state can be displayed with one of the\n"
" available show commands.\n" " available show commands.\n"
@ -2056,35 +2016,7 @@ const char helpString[] =
"+sim> SET %D DEBUG\n" "+sim> SET %D DEBUG\n"
"\n" "\n"
/****************************************************************************/ /****************************************************************************/
"1 Dependencies\n" ETH_PLATFORM_SCP_DETAILS
#if defined(_WIN32)
" The NPcap or WinPcap package must be installed in order to enable\n"
" communication with the host system or other computers on the local LAN.\n"
"\n"
" The NPcap package is available from https://github.com/nmap/npcap\n"
" The WinPcap package is available from http://www.winpcap.org/\n"
#else
" To build simulators with the ability to communicate to other computers\n"
" on the local LAN, the libpcap development package must be installed on\n"
" the system which builds the simulator.\n"
"\n"
#endif
"1 Privileges Required\n"
#if defined(_WIN32)
" Windows systems can attach the simulated %D device to the local LAN\n"
" network interface without any special privileges as long as the\n"
" WinPcap package has been previously installed on the host system.\n"
#else
" Linux, MacOS and most other Unix like systems require root privilege\n"
" to access network interfaces on the host system.\n"
#endif
"1 Host Computer Communications\n"
#if defined(_WIN32)
" On Windows using the WinPcap interface, the simulated %D device\n"
" can be used to communicate with the host computer on the same LAN\n"
" which it is attached to.\n"
#else
#endif
/****************************************************************************/ /****************************************************************************/
"1 Performance\n" "1 Performance\n"
" On modern host systems and networks, the simulated DEUNA/DELUA\n" " On modern host systems and networks, the simulated DEUNA/DELUA\n"
@ -2106,8 +2038,7 @@ const char helpString[] =
"++XS VAX simulators\n" "++XS VAX simulators\n"
"++NI AT&T 3b2 simulator\n" "++NI AT&T 3b2 simulator\n"
"++NIA-20 KL10 simulator\n" "++NIA-20 KL10 simulator\n"
"\n" "\n";
;
return scp_help (st, dptr, uptr, flag, helpString, cptr); return scp_help (st, dptr, uptr, flag, helpString, cptr);
} }

View File

@ -1080,6 +1080,10 @@ t_stat eth_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const cha
fprintf (st, "This simulator was not built with ethernet device support\n"); fprintf (st, "This simulator was not built with ethernet device support\n");
return SCPE_OK; return SCPE_OK;
} }
const char *eth_attach_scp_help_string (DEVICE *dptr)
{
return "";
}
t_stat eth_check_address_conflict (ETH_DEV* dev, t_stat eth_check_address_conflict (ETH_DEV* dev,
ETH_MAC* const mac) ETH_MAC* const mac)
{return SCPE_NOFNC;} {return SCPE_NOFNC;}
@ -1393,7 +1397,6 @@ static t_bool eth_vde_network_available = FALSE;
const char *eth_capabilities(void) const char *eth_capabilities(void)
{ {
static char capabilities[CBUFSIZE] = ""; static char capabilities[CBUFSIZE] = "";
char cap_env[2*CBUFSIZE];
if (capabilities[0] != '\0') if (capabilities[0] != '\0')
return capabilities; return capabilities;
@ -1427,8 +1430,6 @@ const char *eth_capabilities(void)
strlcat (capabilities, ":NAT", sizeof (capabilities)); strlcat (capabilities, ":NAT", sizeof (capabilities));
#endif #endif
strlcat (capabilities, ":UDP", sizeof (capabilities)); strlcat (capabilities, ":UDP", sizeof (capabilities));
snprintf (cap_env, sizeof(cap_env), "SIM_ETHER_CAPABILITIES=%s", capabilities);
sim_set_environment (0, cap_env);
return capabilities; return capabilities;
} }
@ -3553,55 +3554,86 @@ strlcat (version, pcap_lib_version(), sizeof (version));
return version; return version;
} }
t_stat eth_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr) const char *eth_attach_scp_help_string (DEVICE *dptr)
{ {
fprintf (st, "%s attach help\n\n", dptr->name); static char *eth_device_help_string = NULL;
fprintf (st, " sim> SHOW ETHERNET\n");
fprintf (st, " Ethernet Packet Info: %s\n", eth_version()); if ((eth_device_help_string != NULL) &&
fprintf (st, " ETH devices:\n"); (strstr (eth_device_help_string, dptr->name) == NULL)) {
free (eth_device_help_string);
eth_device_help_string = NULL;
}
if (eth_device_help_string == NULL) {
MFILE *f = MOpen ();
if (f != NULL) {
Mprintf (f, " The device must be attached to a LAN device to communicate with systems\n");
Mprintf (f, " on that LAN.\n\n");
Mprintf (f, "+sim> SHOW ETHERNET\n");
Mprintf (f, "+Ethernet Packet Info: %s\n", eth_version());
Mprintf (f, "+ETH devices:\n");
#if defined(_WIN32)
Mprintf (f, "+eth0 \\Device\\NPF_{A6F81789-B849-4220-B09B-19760D401A38} (Local Area Connection)\n");
Mprintf (f, "+eth1 udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)\n");
#if defined(HAVE_SLIRP_NETWORK)
Mprintf (f, "+eth3 nat:{optional-nat-parameters} (Integrated NAT (SLiRP) support)\n");
#endif
#else
#if defined(HAVE_VMNET_NETWORK) #if defined(HAVE_VMNET_NETWORK)
fprintf (st, " eth0 en0 (Integrated bridged network (vmnet) support\n"); Mprintf (f, "+eth0 en0 (Integrated bridged network (vmnet) support\n");
fprintf (st, " Host IPv4 Address: 192.168.86.114/24\n"); Mprintf (f, " Host IPv4 Address: 192.168.86.114/24\n");
fprintf (st, " LinkType: Ethernet\n"); Mprintf (f, " LinkType: Ethernet\n");
fprintf (st, " MediaState: connected)\n"); Mprintf (f, " MediaState: connected)\n");
fprintf (st, " eth1 en1 (Integrated bridged network (vmnet) support\n"); Mprintf (f, "+eth1 en1 (Integrated bridged network (vmnet) support\n");
fprintf (st, " LinkType: WiFi\n"); Mprintf (f, " LinkType: WiFi\n");
fprintf (st, " MediaState: disconnected)\n"); Mprintf (f, " MediaState: disconnected)\n");
fprintf (st, " eth2 tap:tapN{,HOSTIP=address/masklen} (Integrated host-only (vmnet) support)\n"); Mprintf (f, "+eth2 tap:tapN{,HOSTIP=address/masklen} (Integrated host-only (vmnet) support)\n");
#if defined(USE_VMNET_SHARED_AS_NAT) #if defined(USE_VMNET_SHARED_AS_NAT)
fprintf (st, " eth3 nat:{optional-nat-parameters} (Integrated NAT (vmnet) support)\n"); Mprintf (f, "+eth3 nat:{optional-nat-parameters} (Integrated NAT (vmnet) support)\n");
#else #else
#if defined(HAVE_SLIRP_NETWORK) #if defined(HAVE_SLIRP_NETWORK)
fprintf (st, " eth3 nat:{optional-nat-parameters} (Integrated NAT (SLiRP) support)\n"); Mprintf (f, "+eth3 nat:{optional-nat-parameters} (Integrated NAT (SLiRP) support)\n");
#endif #endif
#endif #endif
#else /* !defined(HAVE_VMNET_NETWORK) */ #else /* !defined(HAVE_VMNET_NETWORK) */
fprintf (st, " eth0 en0 (No description available)\n"); Mprintf (f, "+eth0 en0 (No description available)\n");
#if defined(HAVE_TAP_NETWORK) #if defined(HAVE_TAP_NETWORK)
fprintf (st, " eth1 tap:tapN (Integrated Tun/Tap support)\n"); Mprintf (f, "+eth1 tap:tapN (Integrated Tun/Tap support)\n");
#endif #endif
#if defined(HAVE_VDE_NETWORK) #if defined(HAVE_VDE_NETWORK)
if (eth_vde_network_available) if (eth_vde_network_available)
fprintf (st, " eth2 vde:device{:switch-port-number} (Integrated VDE support)\n"); Mprintf (f, "+eth2 vde:device{:switch-port-number} (Integrated VDE support)\n");
#endif #endif
#if defined(HAVE_SLIRP_NETWORK) #if defined(HAVE_SLIRP_NETWORK)
fprintf (st, " eth3 nat:{optional-nat-parameters} (Integrated NAT (SLiRP) support)\n"); Mprintf (f, "+eth3 nat:{optional-nat-parameters} (Integrated NAT (SLiRP) support)\n");
#endif #endif
#endif /* !defined(HAVE_VMNET_NETWORK) */ #endif /* !defined(HAVE_VMNET_NETWORK) */
fprintf (st, " eth4 udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)\n"); Mprintf (f, "+eth4 udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)\n");
fprintf (st, " sim> ATTACH %s eth0\n\n", dptr->name); Mprintf (f, "+sim> ATTACH %s eth0\n\n", dptr->name);
fprintf (st, "or equivalently:\n\n"); Mprintf (f, " or equivalently:\n\n");
fprintf (st, " sim> ATTACH %s en0\n\n", dptr->name); Mprintf (f, "+sim> ATTACH %s en0\n\n", dptr->name);
fprintf (st, "Additionally:\n\n");
fprintf (st, " sim> ATTACH %s en1\n", dptr->name);
fprintf (st, " %%SIM-ERROR: Eth: OS device en1 is disconnected\n");
fprintf (st, "To force a connection to a currently disconnected device:\n\n");
fprintf (st, " sim> ATTACH -F %s en1\n", dptr->name);
fprintf (st, " %%SIM-INFO: Eth: OS device en1 is disconnected\n");
fprintf (st, " %%SIM-INFO: Eth: opened OS device en1 - Integrated bridged network (vmnet) support\n\n");
#if defined(HAVE_SLIRP_NETWORK) || defined(HAVE_VMNET_NETWORK)
sim_nat_attach_help (st, dptr, uptr, flag, cptr);
#endif #endif
Mprintf (f, "\n Additionally:\n\n");
Mprintf (f, "+sim> ATTACH %s en1\n", dptr->name);
Mprintf (f, "+%%SIM-ERROR: Eth: OS device en1 is disconnected\n\n");
Mprintf (f, " To force a connection to a currently disconnected device:\n\n");
Mprintf (f, "+sim> ATTACH -F %s en1\n", dptr->name);
Mprintf (f, "+%%SIM-INFO: Eth: OS device en1 is disconnected\n");
Mprintf (f, "+%%SIM-INFO: Eth: opened OS device en1 - Integrated bridged network (vmnet) support\n\n");
#if defined(HAVE_SLIRP_NETWORK) || defined(HAVE_VMNET_NETWORK)
Mprintf (f, "%s", sim_nat_attach_scp_help (dptr));
#endif
eth_device_help_string = MFileData (f);
MClose (f);
}
}
return eth_device_help_string;
}
t_stat eth_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr)
{
fprintf (st, "%s attach help\n\n", dptr->name);
scp_help (st, dptr, uptr, flag, eth_attach_scp_help_string (dptr), cptr);
return SCPE_OK; return SCPE_OK;
} }

View File

@ -348,6 +348,8 @@ t_stat eth_open (ETH_DEV* dev, const char* name, /* open ethernet interfa
DEVICE* dptr, uint32 dbit); DEVICE* dptr, uint32 dbit);
t_stat eth_close (ETH_DEV* dev); /* close ethernet interface */ t_stat eth_close (ETH_DEV* dev); /* close ethernet interface */
t_stat eth_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr); t_stat eth_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr);
const char *eth_attach_scp_help_string (DEVICE *dptr);
const char *eth_attach_flat_help_string (DEVICE *dptr);
t_stat eth_write (ETH_DEV* dev, ETH_PACK* packet, /* write synchronous packet; */ t_stat eth_write (ETH_DEV* dev, ETH_PACK* packet, /* write synchronous packet; */
ETH_PCALLBACK routine); /* callback when done */ ETH_PCALLBACK routine); /* callback when done */
int eth_read (ETH_DEV* dev, ETH_PACK* packet, /* read single packet; */ int eth_read (ETH_DEV* dev, ETH_PACK* packet, /* read single packet; */
@ -407,6 +409,60 @@ t_stat sim_ether_test (DEVICE *dptr, const char *cptr); /* unit test routine */
#define SIM_TEST(xxx) #define SIM_TEST(xxx)
#endif #endif
/****************************************************************************/
#if defined(_WIN32)
#define ETH_PLATFORM_SCP_DEPENDENCIES \
"1 Dependencies\n" \
" The NPcap or WinPcap package must be installed in order to enable\n" \
" communication with the host system or other computers on the local LAN.\n" \
"\n" \
" The NPcap package is available from https://github.com/nmap/npcap\n" \
" The WinPcap package is available from http://www.winpcap.org/\n"
#else /* !defined(_WIN32) */
#define ETH_PLATFORM_SCP_DEPENDENCIES \
"1 Dependencies\n" \
" To build simulators with the ability to communicate to other computers\n" \
" on the local LAN, the libpcap development package must be installed on\n" \
" the system which builds the simulator.\n" \
"\n"
#endif /* defined(_WIN32) */
/****************************************************************************/
#if defined(_WIN32)
#define ETH_PLATFORM_SCP_PRIVILEGES \
"1 Privileges Required\n" \
" Windows systems can attach the simulated %D device to the local LAN\n" \
" network interface without any special privileges as long as the\n" \
" Npcap or WinPcap package has been previously installed on the host system.\n"
#else /* !defined(_WIN32) */
#define ETH_PLATFORM_SCP_PRIVILEGES \
"1 Privileges Required\n" \
" Linux, macOS and most other Unix like systems require root privilege\n" \
" to access network interfaces on the host system.\n"
#endif /* defined(_WIN32) */
/****************************************************************************/
#if defined(_WIN32)
#define ETH_PLATFORM_SCP_HOST_COMMUNICATIONS \
"1 Host Computer Communications\n" \
" On Windows using the WinPcap interface, the simulated %D device\n" \
" can be used to communicate with the host computer on the same LAN\n" \
" which it is attached to.\n"
#else /* !defined(_WIN32) */
#if defined(HAVE_VMNET_NETWORK)
#define ETH_PLATFORM_SCP_HOST_COMMUNICATIONS \
"1 Host Computer Communications\n" \
" On macOS using the LAN or WiFi interfaces, the simulated %D device\n" \
" can be used to communicate with the host computer and other computers\n" \
" on the same LAN as well as reaching beyond across the Internet.\n"
#else /* !defined(HAVE_VMNET_NETWORK) */
#define ETH_PLATFORM_SCP_HOST_COMMUNICATIONS
#endif /* defined(HAVE_VMNET_NETWORK) */
#endif /* defined(_WIN32) */
/****************************************************************************/
#define ETH_PLATFORM_SCP_DETAILS ETH_PLATFORM_SCP_DEPENDENCIES \
ETH_PLATFORM_SCP_PRIVILEGES \
ETH_PLATFORM_SCP_HOST_COMMUNICATIONS
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -662,54 +662,74 @@ while (rtmp) {
} }
} }
t_stat sim_nat_attach_help(FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr) const char *sim_nat_attach_scp_help(DEVICE *dptr)
{ {
fprintf (st, "%s", return "1 NAT options:\n"
"NAT options:\n" "+DHCP{=dhcp_start_address} Enables DHCP server and specifies\n"
" DHCP{=dhcp_start_address} Enables DHCP server and specifies\n" "++++++++++guest LAN DHCP start IP address\n"
" guest LAN DHCP start IP address\n" "+BOOTFILE=bootfilename specifies DHCP returned Boot Filename\n"
" BOOTFILE=bootfilename specifies DHCP returned Boot Filename\n" "+TFTP=tftp-base-path Enables TFTP server and specifies\n"
" TFTP=tftp-base-path Enables TFTP server and specifies\n" "++++++++++base file path\n"
" base file path\n" "+NAMESERVER=nameserver_ipaddres specifies DHCP nameserver IP address\n"
" NAMESERVER=nameserver_ipaddres specifies DHCP nameserver IP address\n" "+DNS=nameserver_ipaddres specifies DHCP nameserver IP address\n"
" DNS=nameserver_ipaddres specifies DHCP nameserver IP address\n" "+DNSSEARCH=domain{:domain{:domain}} specifies DNS Domains search suffixes\n"
" DNSSEARCH=domain{:domain{:domain}} specifies DNS Domains search suffixes\n" "+GATEWAY=host_ipaddress{/masklen} specifies LAN gateway IP address\n"
" GATEWAY=host_ipaddress{/masklen} specifies LAN gateway IP address\n" "+NETWORK=network_ipaddress{/masklen} specifies LAN network address\n"
" NETWORK=network_ipaddress{/masklen} specifies LAN network address\n" "+UDP=port:address:address's-port maps host UDP port to guest port\n"
" UDP=port:address:address's-port maps host UDP port to guest port\n" "+TCP=port:address:address's-port maps host TCP port to guest port\n"
" TCP=port:address:address's-port maps host TCP port to guest port\n" "+NODHCP disables DHCP server\n\n"
" NODHCP disables DHCP server\n\n" " Default NAT Options: GATEWAY=10.0.2.2, masklen=24(netmask is 255.255.255.0)\n"
"Default NAT Options: GATEWAY=10.0.2.2, masklen=24(netmask is 255.255.255.0)\n" "++++++DHCP=10.0.2.15, NAMESERVER=10.0.2.3\n"
" DHCP=10.0.2.15, NAMESERVER=10.0.2.3\n" "+Nameserver defaults to proxy traffic to host system's active nameserver\n\n"
" Nameserver defaults to proxy traffic to host system's active nameserver\n\n" " The 'address' field in the UDP and TCP port mappings are the simulated\n"
"The 'address' field in the UDP and TCP port mappings are the simulated\n" " (guest) system's IP address which, if DHCP allocated, would default to\n"
"(guest) system's IP address which, if DHCP allocated would default to\n" " 10.0.2.15 or could be statically configured to any address including\n"
"10.0.2.15 or could be statically configured to any address including\n" " 10.0.2.4 thru 10.0.2.14.\n\n"
"10.0.2.4 thru 10.0.2.14.\n\n" "1 NAT limitations\n\n"
"NAT limitations\n\n" " There are four limitations of NAT mode which users should be aware of:\n\n"
"There are four limitations of NAT mode which users should be aware of:\n\n" "+1) ICMP protocol limitations:\n"
" 1) ICMP protocol limitations:\n" "++Some frequently used network debugging tools (e.g. ping or traceroute)\n"
" Some frequently used network debugging tools (e.g. ping or tracerouting)\n" "++rely on the ICMP protocol for sending/receiving messages. While some\n"
" rely on the ICMP protocol for sending/receiving messages. While some\n" "++ICMP support is available on some hosts (ping may or may not work),\n"
" ICMP support is available on some hosts (ping may or may not work),\n" "++some other tools may not work reliably.\n\n"
" some other tools may not work reliably.\n\n" "+2) Receiving of UDP broadcasts is not reliable:\n"
" 2) Receiving of UDP broadcasts is not reliable:\n" "++The guest does not reliably receive broadcasts, since, in order to save\n"
" The guest does not reliably receive broadcasts, since, in order to save\n" "++resources, it only listens for a certain amount of time after the guest\n"
" resources, it only listens for a certain amount of time after the guest\n" "++has sent UDP data on a particular port.\n\n"
" has sent UDP data on a particular port.\n\n" "+3) Protocols such as GRE, DECnet, LAT and Clustering are unsupported:\n"
" 3) Protocols such as GRE, DECnet, LAT and Clustering are unsupported:\n" "++Protocols other than TCP and UDP are not supported.\n\n"
" Protocols other than TCP and UDP are not supported.\n\n" "+4) Forwarding host ports < 1024 impossible:\n"
" 4) Forwarding host ports < 1024 impossible:\n" "++On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is not possible\n"
" On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is not possible\n" "++to bind to ports below 1024 from applications that are not run by root.\n"
" to bind to ports below 1024 from applications that are not run by root.\n" "++As a result, if you try to configure such a port forwarding, the attach\n"
" As a result, if you try to configure such a port forwarding, the attach\n" "++will fail.\n\n"
" will fail.\n\n" " These limitations normally don't affect standard network use. But the\n"
"These limitations normally don't affect standard network use. But the\n" " presence of NAT has also subtle effects that may interfere with protocols\n"
"presence of NAT has also subtle effects that may interfere with protocols\n" " that are normally working. One example is NFS, where the server is often\n"
"that are normally working. One example is NFS, where the server is often\n" " configured to refuse connections from non-privileged ports (i.e. ports not\n"
"configured to refuse connections from non-privileged ports (i.e. ports not\n" " below 1024).\n\n"
"below 1024).\n" "1 NAT Examples\n\n"
); " Given a simulator that only wants to talk IP to the outside world use\n"
return SCPE_OK; " the following example:\n"
" \n"
"+sim> ATTACH %D NAT:\n"
" \n"
" Given a simulator that only wants to talk IP but also wants to allow\n"
" incoming telnet use the following example:\n"
" \n"
"+sim> ATTACH %D NAT:tcp=2323:10.0.2.15:23\n"
" \n"
" This allows connections to host port 2323 to reach port 23 on the\n"
" simulated which is configured with IP Address 10.0.2.15\n"
"\n"
" Given a simulator that only wants to talk IP but also wants to allow\n"
" incoming telnet and ftp use the following example:\n"
" \n"
"+sim> ATTACH %D NAT:tcp=2323:10.0.2.15:23,tcp=2121:10.0.2.15:21\n"
" \n"
" This allows connections to host port 2323 to reach port 23 on the\n"
" simulated which is configured with IP Address 10.0.2.15 and connections\n"
" to host port 2121 to reach port 21 on the simulated system.\n"
"\n";
} }

View File

@ -44,7 +44,7 @@ int sim_slirp_select (SLIRP *slirp, int ms_timeout);
void sim_slirp_dispatch (SLIRP *slirp); void sim_slirp_dispatch (SLIRP *slirp);
void sim_slirp_show (SLIRP *slirp, FILE *st); 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); 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); const char *sim_nat_attach_scp_help(DEVICE *dptr);
void sim_nat_show (NAT *nat, FILE *st); void sim_nat_show (NAT *nat, FILE *st);
#endif /* HAVE_SLIRP_NETWORK */ #endif /* HAVE_SLIRP_NETWORK */