Skip to content

Commit c20b391

Browse files
bscottmpkoning2
authored andcommitted
ETH_MAC indirection erratum
Pervasive misuse of "ETH_MAC *" (a pointer to an ETH_MAC, aka a 6 element unsigned char array) when a simple "ETH_MAC" is correct. The best example of this was eth_mac_fmt() in sim_ether.c with the following prototype: t_stat eth_mac_fmt (ETH_MAC* const mac, char* strmac) The first parameter is a pointer to an array of 6 unsigned characters, whereas it really just wants to be a pointer to the first element of the array: t_stat eth_mac_scan (const ETH_MAC mac, char* strmac) The "ETH_MAC *" indirection error also results in subtle memcpy() and memcmp() issues, e.g.: void network_func(DEVICE *dev, ETH_MAC *mac) { ETH_MAC other_mac; /* ...code... */ /* memcpy() bug: */ memcpy(other_mac, mac, sizeof(ETH_MAC)); /* or worse: */ memcpy(mac, other_mac, sizeof(ETH_MAC)); } eth_copy_mac() and eth_mac_cmp() replace calls to memcpy() and memcmp() that copy or compare Ethernet MAC addresses. These are type-enforcing functions, i.e., the parameters are ETH_MAC-s, to avoid the subtle memcpy() and memcmp() bugs. This fix solves at least one Heisenbug in _eth_close() while free()-ing write request buffers (and possibly other Heisenbugs.)
1 parent 73e5df3 commit c20b391

File tree

10 files changed

+256
-225
lines changed

10 files changed

+256
-225
lines changed

3B2/3b2_ni.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ t_stat ni_setmac(UNIT *uptr, int32 val, CONST char* cptr, void* desc)
557557
UNUSED(desc);
558558

559559
status = SCPE_OK;
560-
status = eth_mac_scan_ex(&ni.macs[NI_NIC_MAC], cptr, uptr);
560+
status = eth_mac_scan_ex(ni.macs[NI_NIC_MAC], cptr, uptr);
561561

562562
if (status == SCPE_OK) {
563563
eth_filter(ni.eth, ni.filter_count, ni.macs, 0, 0);
@@ -577,7 +577,7 @@ t_stat ni_showmac(FILE* st, UNIT* uptr, int32 val, CONST void* desc)
577577
UNUSED(val);
578578
UNUSED(desc);
579579

580-
eth_mac_fmt(&ni.macs[NI_NIC_MAC], buffer);
580+
eth_mac_fmt(ni.macs[NI_NIC_MAC], buffer);
581581
fprintf(st, "MAC=%s", buffer);
582582
return SCPE_OK;
583583
}
@@ -591,12 +591,12 @@ t_stat ni_show_filters(FILE* st, UNIT* uptr, int32 val, CONST void* desc)
591591
UNUSED(val);
592592
UNUSED(desc);
593593

594-
eth_mac_fmt(&ni.macs[NI_NIC_MAC], buffer);
594+
eth_mac_fmt(ni.macs[NI_NIC_MAC], buffer);
595595
fprintf(st, "Physical Address=%s\n", buffer);
596596
if (ni.filter_count > 0) {
597597
fprintf(st, "Filters:\n");
598598
for (i=0; i < ni.filter_count; i++) {
599-
eth_mac_fmt((ETH_MAC *) ni.macs[i], buffer);
599+
eth_mac_fmt(ni.macs[i], buffer);
600600
fprintf(st, "[%2d]: %s\n", i, buffer);
601601
}
602602
fprintf(st, "\n");
@@ -948,7 +948,7 @@ t_stat ni_attach(UNIT *uptr, CONST char *cptr)
948948
return status;
949949
}
950950

951-
status = eth_check_address_conflict(ni.eth, &ni.macs[NI_NIC_MAC]);
951+
status = eth_check_address_conflict(ni.eth, ni.macs[NI_NIC_MAC]);
952952
if (status != SCPE_OK) {
953953
sim_debug(DBG_ERR, &ni_dev, "ni_attach failure: mac check\n");
954954
eth_close(ni.eth);

PDP10/kl10_nia.c

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,8 @@ void nia_start()
573573
nia_rh.wcr);
574574
nia_data.pia = (int)(nia_rh.buf & 7);
575575
nia_data.status |= NIA_MRN;
576-
memcpy(&nia_data.macs[0], &nia_data.mac, sizeof (ETH_MAC));
577-
memcpy(&nia_data.macs[1], &broadcast_ethaddr, sizeof(ETH_MAC));
576+
eth_copy_mac(nia_data.macs[0], nia_data.mac);
577+
eth_copy_mac(nia_data.macs[1], broadcast_ethaddr);
578578
}
579579

580580
void nia_stop()
@@ -634,16 +634,14 @@ void nia_disable()
634634
/*
635635
* Copy a MAC address from string to memory word.
636636
*/
637-
void nia_cpy_mac(uint64 word1, uint64 word2, ETH_MAC *mac)
637+
void nia_cpy_mac(uint64 word1, uint64 word2, ETH_MAC mac)
638638
{
639-
ETH_MAC m;
640-
m[0] = (unsigned char)((word1 >> 28) & 0xff);
641-
m[1] = (unsigned char)((word1 >> 20) & 0xff);
642-
m[2] = (unsigned char)((word1 >> 12) & 0xff);
643-
m[3] = (unsigned char)((word1 >> 4) & 0xff);
644-
m[4] = (unsigned char)((word2 >> 28) & 0xff);
645-
m[5] = (unsigned char)((word2 >> 20) & 0xff);
646-
memcpy(mac, &m, sizeof(ETH_MAC));
639+
mac[0] = (unsigned char)((word1 >> 28) & 0xff);
640+
mac[1] = (unsigned char)((word1 >> 20) & 0xff);
641+
mac[2] = (unsigned char)((word1 >> 12) & 0xff);
642+
mac[3] = (unsigned char)((word1 >> 4) & 0xff);
643+
mac[4] = (unsigned char)((word2 >> 28) & 0xff);
644+
mac[5] = (unsigned char)((word2 >> 20) & 0xff);
647645
}
648646

649647
/*
@@ -903,9 +901,9 @@ void nia_load_mcast()
903901
t_addr addr = nia_data.mcast_addr;
904902

905903
/* Start with our own address. */
906-
memcpy(&nia_data.macs[n], &nia_data.mac, sizeof (ETH_MAC));
904+
eth_copy_mac(nia_data.macs[n], nia_data.mac);
907905
n++;
908-
memcpy(&nia_data.macs[n], &broadcast_ethaddr, sizeof (ETH_MAC));
906+
eth_copy_mac(nia_data.macs[n], broadcast_ethaddr);
909907
n++;
910908
for (i = 0; i < 17; i++) {
911909
uint64 word1, word2;
@@ -919,12 +917,12 @@ void nia_load_mcast()
919917
return;
920918
}
921919
if (word2 & 1) {
922-
nia_cpy_mac(word1, word2, &nia_data.macs[n]);
920+
nia_cpy_mac(word1, word2, nia_data.macs[n]);
923921
n++;
924922
}
925923
}
926924
for(i = 0; i< n; i++) {
927-
eth_mac_fmt(&nia_data.macs[i], buffer);
925+
eth_mac_fmt(nia_data.macs[i], buffer);
928926
sim_debug(DEBUG_DETAIL, &nia_dev, "NIA load mcast%d: %s\n",i,buffer);
929927
}
930928
nia_data.macs_n = n - 2;
@@ -1021,12 +1019,12 @@ void nia_packet_debug(struct nia_device *nia, const char *action,
10211019

10221020
if (!(nia_dev.dctrl & DEBUG_ARP))
10231021
return;
1024-
eth_mac_fmt(&arp->ethhdr.src, eth_src);
1025-
eth_mac_fmt(&arp->ethhdr.dest, eth_dst);
1026-
eth_mac_fmt(&arp->shwaddr, arp_shwaddr);
1022+
eth_mac_fmt(arp->ethhdr.src, eth_src);
1023+
eth_mac_fmt(arp->ethhdr.dest, eth_dst);
1024+
eth_mac_fmt(arp->shwaddr, arp_shwaddr);
10271025
memcpy(&in_addr, &arp->sipaddr, sizeof(in_addr));
10281026
strlcpy(arp_sipaddr, ipv4_inet_ntoa(in_addr), sizeof(arp_sipaddr));
1029-
eth_mac_fmt(&arp->dhwaddr, arp_dhwaddr);
1027+
eth_mac_fmt(arp->dhwaddr, arp_dhwaddr);
10301028
memcpy(&in_addr, &arp->dipaddr, sizeof(in_addr));
10311029
strlcpy(arp_dipaddr, ipv4_inet_ntoa(in_addr), sizeof(arp_dipaddr));
10321030
sim_debug(DEBUG_ARP, &nia_dev,
@@ -1142,10 +1140,10 @@ int nia_send_pkt(uint64 cmd)
11421140
nia_error(EBSERR);
11431141
return 0;
11441142
}
1145-
nia_cpy_mac(word1, word2, &dest);
1146-
memcpy(hdr->dest, dest, sizeof(ETH_MAC));
1143+
nia_cpy_mac(word1, word2, dest);
1144+
eth_copy_mac(hdr->dest, dest);
11471145
/* Copy our address over */
1148-
memcpy(hdr->src, nia_data.mac, sizeof(ETH_MAC));
1146+
eth_copy_mac(hdr->src, nia_data.mac);
11491147
/* Set packet length */
11501148
nia_data.snd_buff.len = len + sizeof(struct nia_eth_hdr);
11511149
/* Preappend length if asking for pad */
@@ -1319,7 +1317,7 @@ t_stat nia_cmd_srv(UNIT * uptr)
13191317
nia_error(EBSERR);
13201318
return SCPE_OK;
13211319
}
1322-
nia_cpy_mac(word1, word2, &nia_data.mac);
1320+
nia_cpy_mac(word1, word2, nia_data.mac);
13231321
if (Mem_read_word(nia_data.cmd_entry + 6, &word1, 0)) {
13241322
nia_error(EBSERR);
13251323
return SCPE_OK;
@@ -1331,7 +1329,7 @@ t_stat nia_cmd_srv(UNIT * uptr)
13311329
nia_data.prmsc = (int)(word1 & 1);
13321330
nia_data.h4000 = (int)((word1 & 2) != 0);
13331331
nia_data.amc = (int)((word1 & 4) != 0);
1334-
memcpy(&nia_data.macs[0], &nia_data.mac, sizeof (ETH_MAC));
1332+
eth_copy_mac(nia_data.macs[0], nia_data.mac);
13351333
if (nia_recv_uptr->flags & UNIT_ATT)
13361334
eth_filter (&nia_data.etherface, nia_data.macs_n + 2,
13371335
nia_data.macs, 0, 0);
@@ -1549,7 +1547,7 @@ t_stat nia_rec_srv(UNIT * uptr)
15491547
t_stat nia_show_mac (FILE* st, UNIT* uptr, int32 val, CONST void* desc)
15501548
{
15511549
char buffer[20];
1552-
eth_mac_fmt(&nia_data.mac, buffer);
1550+
eth_mac_fmt(nia_data.mac, buffer);
15531551
fprintf(st, "MAC=%s", buffer);
15541552
return SCPE_OK;
15551553
}
@@ -1561,7 +1559,7 @@ t_stat nia_set_mac (UNIT* uptr, int32 val, CONST char* cptr, void* desc)
15611559
if (!cptr) return SCPE_IERR;
15621560
if (uptr->flags & UNIT_ATT) return SCPE_ALATT;
15631561

1564-
status = eth_mac_scan_ex(&nia_data.mac, cptr, uptr);
1562+
status = eth_mac_scan_ex(nia_data.mac, cptr, uptr);
15651563
if (status != SCPE_OK)
15661564
return status;
15671565

@@ -1594,16 +1592,16 @@ t_stat nia_attach(UNIT* uptr, CONST char* cptr)
15941592
if (tptr == NULL) return SCPE_MEM;
15951593
strcpy(tptr, cptr);
15961594

1597-
memcpy(&nia_data.macs[0], &nia_data.mac, sizeof (ETH_MAC));
1595+
eth_copy_mac(nia_data.macs[0], nia_data.mac);
15981596
memcpy(&nia_data.macs[1], &broadcast_ethaddr, 6);
15991597
status = eth_open(&nia_data.etherface, cptr, &nia_dev, DEBUG_ETHER);
16001598
if (status != SCPE_OK) {
16011599
free(tptr);
16021600
return status;
16031601
}
1604-
eth_mac_fmt(&nia_data.mac, buf); /* format ethernet mac address */
1602+
eth_mac_fmt(nia_data.mac, buf); /* format ethernet mac address */
16051603
if (SCPE_OK != eth_check_address_conflict (&nia_data.etherface,
1606-
&nia_data.mac)) {
1604+
nia_data.mac)) {
16071605
eth_close(&nia_data.etherface);
16081606
free(tptr);
16091607
return sim_messagef (SCPE_NOATT,

PDP10/kx10_imp.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ void imp_packet_in(struct imp_device *imp);
521521
void imp_send_packet (struct imp_device *imp_data, int len);
522522
void imp_free_packet(struct imp_device *imp, struct imp_packet *p);
523523
struct imp_packet * imp_get_packet(struct imp_device *imp);
524-
void imp_arp_update(struct imp_device *imp, in_addr_T ipaddr, ETH_MAC *ethaddr, int age);
524+
void imp_arp_update(struct imp_device *imp, in_addr_T ipaddr, ETH_MAC ethaddr, int age);
525525
void imp_arp_arpin(struct imp_device *imp, ETH_PACK *packet);
526526
void imp_arp_arpout(struct imp_device *imp, in_addr_T ipaddr);
527527
struct arp_entry * imp_arp_lookup(struct imp_device *imp, in_addr_T ipaddr);
@@ -1430,7 +1430,7 @@ imp_packet_in(struct imp_device *imp)
14301430
/* Process as IP if it is for us */
14311431
if (ip_hdr->ip_dst == imp_data.ip || ip_hdr->ip_dst == 0) {
14321432
/* Add mac address since we will probably need it later */
1433-
imp_arp_update(imp, ip_hdr->ip_src, &hdr->src, 0);
1433+
imp_arp_update(imp, ip_hdr->ip_src, hdr->src, 0);
14341434
/* Clear beginning of message */
14351435
memset(&imp->rbuffer[0], 0, 256);
14361436
imp->rbuffer[0] = 0xf;
@@ -1955,12 +1955,12 @@ void imp_packet_debug(struct imp_device *imp, const char *action, ETH_PACK *pack
19551955

19561956
if (!(imp_dev.dctrl & DEBUG_ARP))
19571957
return;
1958-
eth_mac_fmt(&arp->ethhdr.src, eth_src);
1959-
eth_mac_fmt(&arp->ethhdr.dest, eth_dst);
1960-
eth_mac_fmt(&arp->shwaddr, arp_shwaddr);
1958+
eth_mac_fmt(arp->ethhdr.src, eth_src);
1959+
eth_mac_fmt(arp->ethhdr.dest, eth_dst);
1960+
eth_mac_fmt(arp->shwaddr, arp_shwaddr);
19611961
memcpy(&in_addr, &arp->sipaddr, sizeof(in_addr));
19621962
strlcpy(arp_sipaddr, ipv4_inet_ntoa(in_addr), sizeof(arp_sipaddr));
1963-
eth_mac_fmt(&arp->dhwaddr, arp_dhwaddr);
1963+
eth_mac_fmt(arp->dhwaddr, arp_dhwaddr);
19641964
memcpy(&in_addr, &arp->dipaddr, sizeof(in_addr));
19651965
strlcpy(arp_dipaddr, ipv4_inet_ntoa(in_addr), sizeof(arp_dipaddr));
19661966
sim_debug(DEBUG_ARP, &imp_dev,
@@ -2013,7 +2013,7 @@ void imp_packet_debug(struct imp_device *imp, const char *action, ETH_PACK *pack
20132013
memcpy(&ipaddr, &dhcp->giaddr, sizeof(ipaddr));
20142014
sim_debug(DEBUG_DHCP, &imp_dev, ", giaddr=%s", ipv4_inet_ntoa(ipaddr));
20152015
}
2016-
eth_mac_fmt((ETH_MAC*)&dhcp->chaddr, mac_buf);
2016+
eth_mac_fmt(dhcp->chaddr, mac_buf);
20172017
sim_debug(DEBUG_DHCP, &imp_dev, ", chaddr=%s Options: ", mac_buf);
20182018
while (*opt != DHCP_OPTION_END) {
20192019
int opt_len;
@@ -2129,7 +2129,7 @@ void imp_write(struct imp_device *imp, ETH_PACK *packet) {
21292129
* Update the ARP table, first use free entry, else use oldest.
21302130
*/
21312131
void
2132-
imp_arp_update(struct imp_device *imp, in_addr_T ipaddr, ETH_MAC *ethaddr, int age)
2132+
imp_arp_update(struct imp_device *imp, in_addr_T ipaddr, ETH_MAC ethaddr, int age)
21332133
{
21342134
struct arp_entry *tabptr;
21352135
int i;
@@ -2141,8 +2141,8 @@ imp_arp_update(struct imp_device *imp, in_addr_T ipaddr, ETH_MAC *ethaddr, int a
21412141

21422142
if (tabptr->ipaddr != 0) {
21432143
if (tabptr->ipaddr == ipaddr) {
2144-
if (0 != memcmp(&tabptr->ethaddr, ethaddr, sizeof(ETH_MAC))) {
2145-
memcpy(&tabptr->ethaddr, ethaddr, sizeof(ETH_MAC));
2144+
if (0 != eth_mac_cmp(tabptr->ethaddr, ethaddr)) {
2145+
eth_copy_mac(tabptr->ethaddr, ethaddr);
21462146
eth_mac_fmt(ethaddr, mac_buf);
21472147
sim_debug(DEBUG_ARP, &imp_dev,
21482148
"updating entry for IP %s to %s\n",
@@ -2178,7 +2178,7 @@ imp_arp_update(struct imp_device *imp, in_addr_T ipaddr, ETH_MAC *ethaddr, int a
21782178
}
21792179

21802180
/* Now save the entry */
2181-
memcpy(&tabptr->ethaddr, ethaddr, sizeof(ETH_MAC));
2181+
eth_copy_mac(tabptr->ethaddr, ethaddr);
21822182
tabptr->ipaddr = ipaddr;
21832183
tabptr->age = age;
21842184
eth_mac_fmt(ethaddr, mac_buf);
@@ -2204,7 +2204,7 @@ void imp_arp_age(struct imp_device *imp)
22042204
if (tabptr->age > IMP_ARP_MAX_AGE) {
22052205
char mac_buf[20];
22062206

2207-
eth_mac_fmt(&tabptr->ethaddr, mac_buf);
2207+
eth_mac_fmt(tabptr->ethaddr, mac_buf);
22082208
sim_debug(DEBUG_ARP, &imp_dev,
22092209
"discarding ARP entry for IP %s %s after %d seconds\n",
22102210
ipv4_inet_ntoa(*((struct in_addr *)&tabptr->ipaddr)), mac_buf, IMP_ARP_MAX_AGE);
@@ -2232,7 +2232,7 @@ imp_arp_arpin(struct imp_device *imp, ETH_PACK *packet)
22322232
return;
22332233
arp = (struct arp_hdr *)(&packet->msg[0]);
22342234
op = ntohs(arp->opcode);
2235-
imp_arp_update(imp, arp->sipaddr, &arp->shwaddr, 0);
2235+
imp_arp_update(imp, arp->sipaddr, arp->shwaddr, 0);
22362236

22372237
switch (op) {
22382238
case ARP_REQUEST:
@@ -2249,7 +2249,7 @@ imp_arp_arpin(struct imp_device *imp, ETH_PACK *packet)
22492249
arp->ethhdr.type = htons(ETHTYPE_ARP);
22502250
packet->len = sizeof(struct arp_hdr);
22512251
imp_write(imp, packet);
2252-
eth_mac_fmt(&arp->dhwaddr, mac_buf);
2252+
eth_mac_fmt(arp->dhwaddr, mac_buf);
22532253
sim_debug(DEBUG_ARP, &imp_dev, "replied to received request for IP %s from %s\n",
22542254
ipv4_inet_ntoa(*((struct in_addr *)&imp->ip)), mac_buf);
22552255
}
@@ -2260,7 +2260,7 @@ imp_arp_arpin(struct imp_device *imp, ETH_PACK *packet)
22602260
if (arp->dipaddr == imp->ip) {
22612261
struct imp_packet *nq = NULL; /* New send queue */
22622262

2263-
eth_mac_fmt(&arp->shwaddr, mac_buf);
2263+
eth_mac_fmt(arp->shwaddr, mac_buf);
22642264
memcpy(&in_addr, &arp->sipaddr, sizeof(in_addr));
22652265
sim_debug(DEBUG_ARP, &imp_dev, "received reply for IP %s as %s\n",
22662266
ipv4_inet_ntoa(in_addr), mac_buf);
@@ -2351,12 +2351,12 @@ t_stat imp_set_arp (UNIT* uptr, int32 val, CONST char* cptr, void* desc)
23512351

23522352
cptr = get_glyph (cptr, abuf, '=');
23532353
if (cptr && *cptr) {
2354-
if (SCPE_OK != eth_mac_scan (&mac_addr, cptr)) /* scan string for mac, put in mac */
2354+
if (SCPE_OK != eth_mac_scan (mac_addr, cptr)) /* scan string for mac, put in mac */
23552355
return sim_messagef(SCPE_ARG, "Invalid MAC address: %s\n", abuf);
23562356
} else
23572357
return sim_messagef(SCPE_ARG, "MAC address empty\n");
23582358
if (ipv4_inet_aton (abuf, (struct in_addr *)&ip)) {
2359-
imp_arp_update(&imp_data, ip, &mac_addr, ARP_DONT_AGE);
2359+
imp_arp_update(&imp_data, ip, mac_addr, ARP_DONT_AGE);
23602360
return SCPE_OK;
23612361
}
23622362
return sim_messagef(SCPE_ARG, "Invalid IP Address: %s\n", abuf);
@@ -2377,7 +2377,7 @@ t_stat imp_show_arp (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
23772377
if (tabptr->ipaddr == 0)
23782378
continue;
23792379

2380-
eth_mac_fmt(&tabptr->ethaddr, buf); /* format ethernet mac address */
2380+
eth_mac_fmt(tabptr->ethaddr, buf); /* format ethernet mac address */
23812381
if (tabptr->age == ARP_DONT_AGE)
23822382
fprintf (st, "%-17s%-19s%s\n",
23832383
ipv4_inet_ntoa(*((struct in_addr *)&tabptr->ipaddr)),
@@ -2457,7 +2457,7 @@ imp_do_send_dhcp(struct imp_device *imp,
24572457
packet->len = len + sizeof(struct ip_hdr);
24582458
imp_write(imp, packet);
24592459

2460-
eth_mac_fmt (&pkt->ethhdr.dest, mac_buf);
2460+
eth_mac_fmt (pkt->ethhdr.dest, mac_buf);
24612461
memcpy(&in_addr, &udp_hdr.ip_dst, sizeof(in_addr));
24622462
sim_debug(DEBUG_DHCP, &imp_dev,
24632463
"client sent %s packet to: %s:%d(%s)\n",
@@ -2574,7 +2574,7 @@ imp_do_dhcp_client(struct imp_device *imp, ETH_PACK *read_buffer)
25742574
}
25752575
}
25762576

2577-
eth_mac_fmt(&eth->src, mac_buf);
2577+
eth_mac_fmt(eth->src, mac_buf);
25782578
memcpy(&in_addr, &udp_hdr.ip_src, sizeof(in_addr));
25792579
sim_debug(DEBUG_DHCP, &imp_dev,
25802580
"client incoming %s packet: dhcp_state=%s - wait_time=%d from: %s:%d(%s)\n",
@@ -2617,7 +2617,7 @@ imp_do_dhcp_client(struct imp_device *imp, ETH_PACK *read_buffer)
26172617
break;
26182618
}
26192619
/* Record a static ARP for the DHCP server */
2620-
imp_arp_update(imp, dhcpip, &eth->src, ARP_DONT_AGE);
2620+
imp_arp_update(imp, dhcpip, eth->src, ARP_DONT_AGE);
26212621

26222622
/* Broadcast an ARP Reply with the assigned IP Address */
26232623
memset(&arp_pkt, 0, sizeof(ETH_PACK));
@@ -2948,7 +2948,7 @@ t_stat imp_show_mpx (FILE *st, UNIT *uptr, int32 val, CONST void *desc)
29482948
t_stat imp_show_mac (FILE* st, UNIT* uptr, int32 val, CONST void* desc)
29492949
{
29502950
char buffer[20];
2951-
eth_mac_fmt(&imp_data.mac, buffer);
2951+
eth_mac_fmt(imp_data.mac, buffer);
29522952
fprintf(st, "MAC=%s", buffer);
29532953
return SCPE_OK;
29542954
}
@@ -2960,7 +2960,7 @@ t_stat imp_set_mac (UNIT* uptr, int32 val, CONST char* cptr, void* desc)
29602960
if (!cptr) return SCPE_IERR;
29612961
if (uptr->flags & UNIT_ATT) return SCPE_ALATT;
29622962

2963-
status = eth_mac_scan_ex(&imp_data.mac, cptr, uptr);
2963+
status = eth_mac_scan_ex(imp_data.mac, cptr, uptr);
29642964
if (status != SCPE_OK)
29652965
return status;
29662966

@@ -3160,8 +3160,8 @@ t_stat imp_attach(UNIT* uptr, CONST char* cptr)
31603160
free(tptr);
31613161
return status;
31623162
}
3163-
eth_mac_fmt(&imp_data.mac, buf); /* format ethernet mac address */
3164-
if (SCPE_OK != eth_check_address_conflict (&imp_data.etherface, &imp_data.mac)) {
3163+
eth_mac_fmt(imp_data.mac, buf); /* format ethernet mac address */
3164+
if (SCPE_OK != eth_check_address_conflict (&imp_data.etherface, imp_data.mac)) {
31653165
eth_close(&imp_data.etherface);
31663166
free(tptr);
31673167
return sim_messagef (SCPE_NOATT, "%s: MAC Address Conflict on LAN for address %s\n",
@@ -3215,7 +3215,7 @@ t_stat imp_attach(UNIT* uptr, CONST char* cptr)
32153215
imp_arp_arpin(&imp_data, &read_buffer);
32163216
} while (read_buffer.len > 0);
32173217
if ((arp = imp_arp_lookup(&imp_data, imp_data.gwip)))
3218-
imp_arp_update(&imp_data, imp_data.gwip, &arp->ethaddr, ARP_DONT_AGE);
3218+
imp_arp_update(&imp_data, imp_data.gwip, arp->ethaddr, ARP_DONT_AGE);
32193219
}
32203220

32213221
eth_set_async (&imp_data.etherface, 0); /* Allow Asynchronous inbound packets */

0 commit comments

Comments
 (0)