1
0
mirror of https://github.com/simh/simh.git synced 2026-02-12 02:48:38 +00:00

ETHER: Add support for generated interface MAC addresses

sim> SET XQ MAC=aa:bb:cc:dd:ee:ff{/bits}{>filespec}

where:

- all of the aa:bb:cc:dd:ee:ff values must be hex digits
- bits is the number of bits which are to be taken from the supplied
   MAC aa:bb:cc:dd:ee:ff with legal values from 16 to 48 and a default
   of 48 bits.
- filespec specifies a file which contains the MAC address to be used
   and if it doesn't exist an appropriate generated address will be stored
   in this file and a subsequent SET MAC invocation specifying the same
   file will use the value stored in the file rather than generating a new
   MAC.

As discussed in #317
This commit is contained in:
Mark Pizzolato
2016-05-23 16:56:06 -07:00
parent 63510629d9
commit 2d907980f1
4 changed files with 184 additions and 18 deletions

View File

@@ -685,7 +685,7 @@ t_stat xq_setmac (UNIT* uptr, int32 val, CONST char* cptr, void* desc)
if (!cptr) return SCPE_IERR;
if (uptr->flags & UNIT_ATT) return SCPE_ALATT;
status = eth_mac_scan(&xq->var->mac, cptr);
status = eth_mac_scan_ex(&xq->var->mac, cptr, uptr);
if (status != SCPE_OK)
return status;
@@ -3176,6 +3176,23 @@ const char helpString[] =
"\n"
" The SET MAC command must be done before the %D device is attached to a\n"
" network.\n"
"4 Generated MAC\n"
" Support exists to provide a way to dynamically generate relatively\n"
" unique MAC addresses and to provide a way to save generated addresses\n"
" for subsequent reuse in later simulator invocations.\n"
"\n"
"+sim> SET XQ MAC=AA:BB:CC:DD:EE:FF{/bits}{>filespec}\n"
"\n"
" where:\n"
"+1. All of the AA:BB:CC:DD:EE:FF values must be hex digits\n"
"+2. bits is the number of bits which are to be taken from the\n"
"++ supplied MAC aa:bb:cc:dd:ee:ff with legal values from 16\n"
"++ to 48 and a default of 48 bits.\n"
"+3. filespec specifies a file which contains the MAC address\n"
"++ to be used and if it doesn't exist an appropriate generated\n"
"++ address will be stored in this file and a subsequent SET MAC\n"
"++ invocation specifying the same file will use the value stored\n"
"++ in the file rather than generating a new MAC.\n"
"3 Type\n"
" The type of device being emulated can be changed with the following\n"
" command:\n"

View File

@@ -380,7 +380,7 @@ t_stat xu_setmac (UNIT* uptr, int32 val, CONST char* cptr, void* desc)
if (!cptr) return SCPE_IERR;
if (uptr->flags & UNIT_ATT) return SCPE_ALATT;
status = eth_mac_scan(&xu->var->mac, cptr);
status = eth_mac_scan_ex(&xu->var->mac, cptr, uptr);
return status;
}