@@ -521,7 +521,7 @@ void imp_packet_in(struct imp_device *imp);
521
521
void imp_send_packet (struct imp_device * imp_data , int len );
522
522
void imp_free_packet (struct imp_device * imp , struct imp_packet * p );
523
523
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 );
525
525
void imp_arp_arpin (struct imp_device * imp , ETH_PACK * packet );
526
526
void imp_arp_arpout (struct imp_device * imp , in_addr_T ipaddr );
527
527
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)
1430
1430
/* Process as IP if it is for us */
1431
1431
if (ip_hdr -> ip_dst == imp_data .ip || ip_hdr -> ip_dst == 0 ) {
1432
1432
/* 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 );
1434
1434
/* Clear beginning of message */
1435
1435
memset (& imp -> rbuffer [0 ], 0 , 256 );
1436
1436
imp -> rbuffer [0 ] = 0xf ;
@@ -1955,12 +1955,12 @@ void imp_packet_debug(struct imp_device *imp, const char *action, ETH_PACK *pack
1955
1955
1956
1956
if (!(imp_dev .dctrl & DEBUG_ARP ))
1957
1957
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 );
1961
1961
memcpy (& in_addr , & arp -> sipaddr , sizeof (in_addr ));
1962
1962
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 );
1964
1964
memcpy (& in_addr , & arp -> dipaddr , sizeof (in_addr ));
1965
1965
strlcpy (arp_dipaddr , ipv4_inet_ntoa (in_addr ), sizeof (arp_dipaddr ));
1966
1966
sim_debug (DEBUG_ARP , & imp_dev ,
@@ -2013,7 +2013,7 @@ void imp_packet_debug(struct imp_device *imp, const char *action, ETH_PACK *pack
2013
2013
memcpy (& ipaddr , & dhcp -> giaddr , sizeof (ipaddr ));
2014
2014
sim_debug (DEBUG_DHCP , & imp_dev , ", giaddr=%s" , ipv4_inet_ntoa (ipaddr ));
2015
2015
}
2016
- eth_mac_fmt (( ETH_MAC * ) & dhcp -> chaddr , mac_buf );
2016
+ eth_mac_fmt (dhcp -> chaddr , mac_buf );
2017
2017
sim_debug (DEBUG_DHCP , & imp_dev , ", chaddr=%s Options: " , mac_buf );
2018
2018
while (* opt != DHCP_OPTION_END ) {
2019
2019
int opt_len ;
@@ -2129,7 +2129,7 @@ void imp_write(struct imp_device *imp, ETH_PACK *packet) {
2129
2129
* Update the ARP table, first use free entry, else use oldest.
2130
2130
*/
2131
2131
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 )
2133
2133
{
2134
2134
struct arp_entry * tabptr ;
2135
2135
int i ;
@@ -2141,8 +2141,8 @@ imp_arp_update(struct imp_device *imp, in_addr_T ipaddr, ETH_MAC *ethaddr, int a
2141
2141
2142
2142
if (tabptr -> ipaddr != 0 ) {
2143
2143
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 );
2146
2146
eth_mac_fmt (ethaddr , mac_buf );
2147
2147
sim_debug (DEBUG_ARP , & imp_dev ,
2148
2148
"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
2178
2178
}
2179
2179
2180
2180
/* Now save the entry */
2181
- memcpy ( & tabptr -> ethaddr , ethaddr , sizeof ( ETH_MAC ) );
2181
+ eth_copy_mac ( tabptr -> ethaddr , ethaddr );
2182
2182
tabptr -> ipaddr = ipaddr ;
2183
2183
tabptr -> age = age ;
2184
2184
eth_mac_fmt (ethaddr , mac_buf );
@@ -2204,7 +2204,7 @@ void imp_arp_age(struct imp_device *imp)
2204
2204
if (tabptr -> age > IMP_ARP_MAX_AGE ) {
2205
2205
char mac_buf [20 ];
2206
2206
2207
- eth_mac_fmt (& tabptr -> ethaddr , mac_buf );
2207
+ eth_mac_fmt (tabptr -> ethaddr , mac_buf );
2208
2208
sim_debug (DEBUG_ARP , & imp_dev ,
2209
2209
"discarding ARP entry for IP %s %s after %d seconds\n" ,
2210
2210
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)
2232
2232
return ;
2233
2233
arp = (struct arp_hdr * )(& packet -> msg [0 ]);
2234
2234
op = ntohs (arp -> opcode );
2235
- imp_arp_update (imp , arp -> sipaddr , & arp -> shwaddr , 0 );
2235
+ imp_arp_update (imp , arp -> sipaddr , arp -> shwaddr , 0 );
2236
2236
2237
2237
switch (op ) {
2238
2238
case ARP_REQUEST :
@@ -2249,7 +2249,7 @@ imp_arp_arpin(struct imp_device *imp, ETH_PACK *packet)
2249
2249
arp -> ethhdr .type = htons (ETHTYPE_ARP );
2250
2250
packet -> len = sizeof (struct arp_hdr );
2251
2251
imp_write (imp , packet );
2252
- eth_mac_fmt (& arp -> dhwaddr , mac_buf );
2252
+ eth_mac_fmt (arp -> dhwaddr , mac_buf );
2253
2253
sim_debug (DEBUG_ARP , & imp_dev , "replied to received request for IP %s from %s\n" ,
2254
2254
ipv4_inet_ntoa (* ((struct in_addr * )& imp -> ip )), mac_buf );
2255
2255
}
@@ -2260,7 +2260,7 @@ imp_arp_arpin(struct imp_device *imp, ETH_PACK *packet)
2260
2260
if (arp -> dipaddr == imp -> ip ) {
2261
2261
struct imp_packet * nq = NULL ; /* New send queue */
2262
2262
2263
- eth_mac_fmt (& arp -> shwaddr , mac_buf );
2263
+ eth_mac_fmt (arp -> shwaddr , mac_buf );
2264
2264
memcpy (& in_addr , & arp -> sipaddr , sizeof (in_addr ));
2265
2265
sim_debug (DEBUG_ARP , & imp_dev , "received reply for IP %s as %s\n" ,
2266
2266
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)
2351
2351
2352
2352
cptr = get_glyph (cptr , abuf , '=' );
2353
2353
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 */
2355
2355
return sim_messagef (SCPE_ARG , "Invalid MAC address: %s\n" , abuf );
2356
2356
} else
2357
2357
return sim_messagef (SCPE_ARG , "MAC address empty\n" );
2358
2358
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 );
2360
2360
return SCPE_OK ;
2361
2361
}
2362
2362
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)
2377
2377
if (tabptr -> ipaddr == 0 )
2378
2378
continue ;
2379
2379
2380
- eth_mac_fmt (& tabptr -> ethaddr , buf ); /* format ethernet mac address */
2380
+ eth_mac_fmt (tabptr -> ethaddr , buf ); /* format ethernet mac address */
2381
2381
if (tabptr -> age == ARP_DONT_AGE )
2382
2382
fprintf (st , "%-17s%-19s%s\n" ,
2383
2383
ipv4_inet_ntoa (* ((struct in_addr * )& tabptr -> ipaddr )),
@@ -2457,7 +2457,7 @@ imp_do_send_dhcp(struct imp_device *imp,
2457
2457
packet -> len = len + sizeof (struct ip_hdr );
2458
2458
imp_write (imp , packet );
2459
2459
2460
- eth_mac_fmt (& pkt -> ethhdr .dest , mac_buf );
2460
+ eth_mac_fmt (pkt -> ethhdr .dest , mac_buf );
2461
2461
memcpy (& in_addr , & udp_hdr .ip_dst , sizeof (in_addr ));
2462
2462
sim_debug (DEBUG_DHCP , & imp_dev ,
2463
2463
"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)
2574
2574
}
2575
2575
}
2576
2576
2577
- eth_mac_fmt (& eth -> src , mac_buf );
2577
+ eth_mac_fmt (eth -> src , mac_buf );
2578
2578
memcpy (& in_addr , & udp_hdr .ip_src , sizeof (in_addr ));
2579
2579
sim_debug (DEBUG_DHCP , & imp_dev ,
2580
2580
"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)
2617
2617
break ;
2618
2618
}
2619
2619
/* 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 );
2621
2621
2622
2622
/* Broadcast an ARP Reply with the assigned IP Address */
2623
2623
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)
2948
2948
t_stat imp_show_mac (FILE * st , UNIT * uptr , int32 val , CONST void * desc )
2949
2949
{
2950
2950
char buffer [20 ];
2951
- eth_mac_fmt (& imp_data .mac , buffer );
2951
+ eth_mac_fmt (imp_data .mac , buffer );
2952
2952
fprintf (st , "MAC=%s" , buffer );
2953
2953
return SCPE_OK ;
2954
2954
}
@@ -2960,7 +2960,7 @@ t_stat imp_set_mac (UNIT* uptr, int32 val, CONST char* cptr, void* desc)
2960
2960
if (!cptr ) return SCPE_IERR ;
2961
2961
if (uptr -> flags & UNIT_ATT ) return SCPE_ALATT ;
2962
2962
2963
- status = eth_mac_scan_ex (& imp_data .mac , cptr , uptr );
2963
+ status = eth_mac_scan_ex (imp_data .mac , cptr , uptr );
2964
2964
if (status != SCPE_OK )
2965
2965
return status ;
2966
2966
@@ -3160,8 +3160,8 @@ t_stat imp_attach(UNIT* uptr, CONST char* cptr)
3160
3160
free (tptr );
3161
3161
return status ;
3162
3162
}
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 )) {
3165
3165
eth_close (& imp_data .etherface );
3166
3166
free (tptr );
3167
3167
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)
3215
3215
imp_arp_arpin (& imp_data , & read_buffer );
3216
3216
} while (read_buffer .len > 0 );
3217
3217
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 );
3219
3219
}
3220
3220
3221
3221
eth_set_async (& imp_data .etherface , 0 ); /* Allow Asynchronous inbound packets */
0 commit comments