Commit d51a413
DEV9: allow a configurable / generated MAC address
The PS2 SMAP MAC lives in the first four words of the DEV9 EEPROM. The
built-in default image hardcodes 76:6D:61:63:30:31 ("vmac01"), and it is
only replaced when the user happens to have an eeprom.dat next to the
binary. Every install without one therefore presents an identical MAC.
Two instances bridged onto the same LAN are an address collision: switch
MAC tables flap and DHCP hands out a single lease. Nothing on the network
can tell two emulated consoles apart.
Add DEV9Options::Mac and DEV9Options::AutoMac. On init, and only when the
built-in image is in use, write the configured MAC into the EEPROM and fix
the checksum. A user supplied eeprom.dat is never touched.
When no MAC is configured and AutoMac is set, generate one, persist it via
the host settings and reuse it from then on. Generated once rather than per
boot: re-rolling on every launch would break DHCP leases and switch MAC
tables, which are the problems this is meant to fix. Generated addresses
clear the multicast bit and set the locally administered bit so they cannot
be mistaken for a vendor assigned address.
EEPROM words 0-2 hold the MAC and word 3 holds their 16-bit sum:
0x6D76 + 0x6361 + 0x3130 = 0x10207, truncated to 0x0207, which is exactly
the checksum stored in the existing default.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent e1dd0a0 commit d51a413
3 files changed
Lines changed: 107 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1066 | 1066 | | |
1067 | 1067 | | |
1068 | 1068 | | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
1069 | 1077 | | |
1070 | 1078 | | |
1071 | 1079 | | |
| |||
1079 | 1087 | | |
1080 | 1088 | | |
1081 | 1089 | | |
| 1090 | + | |
| 1091 | + | |
1082 | 1092 | | |
1083 | 1093 | | |
1084 | 1094 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
73 | 107 | | |
74 | 108 | | |
75 | 109 | | |
| |||
159 | 193 | | |
160 | 194 | | |
161 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
162 | 226 | | |
163 | 227 | | |
164 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1323 | 1323 | | |
1324 | 1324 | | |
1325 | 1325 | | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
1326 | 1334 | | |
1327 | 1335 | | |
1328 | 1336 | | |
| |||
1446 | 1454 | | |
1447 | 1455 | | |
1448 | 1456 | | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
1449 | 1482 | | |
1450 | 1483 | | |
1451 | 1484 | | |
| |||
0 commit comments