ETHER: issue explanatory messages when rejecting invalid MAC addresses.

This commit is contained in:
Mark Pizzolato 2016-05-24 08:45:28 -07:00
parent 2d907980f1
commit 3dcd5124e9
2 changed files with 11 additions and 8 deletions

View file

@ -30,6 +30,8 @@
#### Beta SAGE-II and PDQ-3 simulators from Holger Veit #### Beta SAGE-II and PDQ-3 simulators from Holger Veit
#### Intel Systems 8010 and 8020 simulators from Bill Beech
### New Host Platform support - HP-UX and AIX ### New Host Platform support - HP-UX and AIX
### Simulator Front Panel API ### Simulator Front Panel API
@ -70,8 +72,8 @@ A remote console session will close when an EOF character is entered (i.e. ^D or
directly communicate to a remote device via UDP (i.e. a built-in HECnet bridge). directly communicate to a remote device via UDP (i.e. a built-in HECnet bridge).
XQ and XU devices (DEQNA, DELQA, DELQA-T, DEUNA and DELQA) devices can now XQ and XU devices (DEQNA, DELQA, DELQA-T, DEUNA and DELQA) devices can now
optionally throttle outgoing packets which is useful when communicating with optionally throttle outgoing packets which is useful when communicating with
legacy systems on a local LAN which can easily get over run when packets legacy systems (real hardware) on a local LAN which can easily get over run
arrive too fast. when packets arrive too fast.
MicroVAX 3900 has QVSS (VCB01) board available. MicroVAX 3900 has QVSS (VCB01) board available.
MicroVAX 3900 and MicroVAX II have SET CPU AUTOBOOT option MicroVAX 3900 and MicroVAX II have SET CPU AUTOBOOT option
MicroVAX 3900 has a SET CPU MODEL=(MicroVAX|VAXServer|VAXStation) command to change between system types MicroVAX 3900 has a SET CPU MODEL=(MicroVAX|VAXServer|VAXStation) command to change between system types
@ -130,6 +132,7 @@ Host platforms which have libSDL available can leverage this functionality.
older systems. Throttling of simulated traffic delivered to the LAN older systems. Throttling of simulated traffic delivered to the LAN
can be used to mitigate this problem. can be used to mitigate this problem.
* Reliable MAC address conflict detection. * Reliable MAC address conflict detection.
* Automatic unique default MAC address assignment.
#### Disk Extensions #### Disk Extensions
RAW Disk Access (including CDROM) RAW Disk Access (including CDROM)

View file

@ -410,7 +410,7 @@ t_stat eth_mac_scan_ex (ETH_MAC* mac, const char* strmac, UNIT *uptr)
/* Allow generated MAC address */ /* Allow generated MAC address */
/* XX:XX:XX:XX:XX:XX{/bits{>file}} */ /* XX:XX:XX:XX:XX:XX{/bits{>file}} */
/* bits (if specified) must be <= 32 */ /* bits (if specified) must be from 16 thru 48 */
memset (&state, 0, sizeof(state)); memset (&state, 0, sizeof(state));
_eth_get_system_id (state.system_id, sizeof(state.system_id)); _eth_get_system_id (state.system_id, sizeof(state.system_id));
@ -433,7 +433,7 @@ t_stat eth_mac_scan_ex (ETH_MAC* mac, const char* strmac, UNIT *uptr)
if (cptr) { if (cptr) {
state.bits = (uint32)strtotv (cptr + 1, &tptr, 10); state.bits = (uint32)strtotv (cptr + 1, &tptr, 10);
if ((state.bits < 16) || (state.bits > 48)) if ((state.bits < 16) || (state.bits > 48))
return SCPE_ARG; return sim_messagef (SCPE_ARG, "Invalid MAC address bits specifier '%d'. Valid values are from 16 thru 48\n", state.bits);
} }
else else
state.bits = 48; state.bits = 48;
@ -443,10 +443,10 @@ t_stat eth_mac_scan_ex (ETH_MAC* mac, const char* strmac, UNIT *uptr)
if ((6 != sscanf(strmac, "%x:%x:%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5])) && if ((6 != sscanf(strmac, "%x:%x:%x:%x:%x:%x", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5])) &&
(6 != sscanf(strmac, "%x.%x.%x.%x.%x.%x", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5])) && (6 != sscanf(strmac, "%x.%x.%x.%x.%x.%x", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5])) &&
(6 != sscanf(strmac, "%x-%x-%x-%x-%x-%x", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))) (6 != sscanf(strmac, "%x-%x-%x-%x-%x-%x", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5])))
return SCPE_ARG; return sim_messagef (SCPE_ARG, "Invalid MAC address format: '%s'\n", strmac);
for (i=0; i<6; i++) for (i=0; i<6; i++)
if (a[i] > 0xFF) if (a[i] > 0xFF)
return SCPE_ARG; return sim_messagef (SCPE_ARG, "Invalid MAC address byte value: %02X\n", a[i]);
else { else {
uint32 mask, shift; uint32 mask, shift;
@ -464,14 +464,14 @@ t_stat eth_mac_scan_ex (ETH_MAC* mac, const char* strmac, UNIT *uptr)
!memcmp(newmac, ones, sizeof(ETH_MAC)) || /* broadcast */ !memcmp(newmac, ones, sizeof(ETH_MAC)) || /* broadcast */
(newmac[0] & 0x01) /* multicast */ (newmac[0] & 0x01) /* multicast */
) )
return SCPE_ARG; return sim_messagef (SCPE_ARG, "Can't use Broadcast or MultiCast address as interface MAC address\n");
/* new mac is OK */ /* new mac is OK */
/* optionally save */ /* optionally save */
if (state.file[0]) { /* Save File specified? */ if (state.file[0]) { /* Save File specified? */
f = fopen (state.file, "w"); f = fopen (state.file, "w");
if (f == NULL) if (f == NULL)
return SCPE_ARG; return sim_messagef (SCPE_ARG, "Can't open MAC address configuration file '%s'.\n", state.file);
eth_mac_fmt (&newmac, filebuf); eth_mac_fmt (&newmac, filebuf);
fprintf (f, "%s/48\n", filebuf); fprintf (f, "%s/48\n", filebuf);
fprintf (f, "system-id: %s\n", state.system_id); fprintf (f, "system-id: %s\n", state.system_id);