diff --git a/src/core/ipv4/autoip.c b/src/core/ipv4/autoip.c index 141c03d7..882d0061 100644 --- a/src/core/ipv4/autoip.c +++ b/src/core/ipv4/autoip.c @@ -460,7 +460,7 @@ autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr) */ ip4_addr_t sipaddr, dipaddr; struct eth_addr netifaddr; - ETHADDR16_COPY(netifaddr.addr, netif->hwaddr); + SMEMCPY(netifaddr.addr, netif->hwaddr, ETH_HWADDR_LEN); /* Copy struct ip4_addr_wordaligned to aligned ip4_addr, to support compilers without * structure packing (not using structure copy which breaks strict-aliasing rules). diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c index 122d3e47..d4c9928e 100644 --- a/src/core/ipv4/etharp.c +++ b/src/core/ipv4/etharp.c @@ -464,7 +464,7 @@ etharp_update_arp_entry(struct netif *netif, const ip4_addr_t *ipaddr, struct et LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_update_arp_entry: updating stable entry %"S16_F"\n", (s16_t)i)); /* update address */ - ETHADDR16_COPY(&arp_table[i].ethaddr, ethaddr); + SMEMCPY(&arp_table[i].ethaddr, ethaddr, ETH_HWADDR_LEN); /* reset time stamp */ arp_table[i].ctime = 0; /* this is where we will send out queued packets! */ @@ -1132,8 +1132,8 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr, (netif->hwaddr_len == ETH_HWADDR_LEN)); /* Write the ARP MAC-Addresses */ - ETHADDR16_COPY(&hdr->shwaddr, hwsrc_addr); - ETHADDR16_COPY(&hdr->dhwaddr, hwdst_addr); + SMEMCPY(&hdr->shwaddr, hwsrc_addr, ETH_HWADDR_LEN); + SMEMCPY(&hdr->dhwaddr, hwdst_addr, ETH_HWADDR_LEN); /* Copy struct ip4_addr_wordaligned to aligned ip4_addr, to support compilers without * structure packing. */ IPADDR_WORDALIGNED_COPY_FROM_IP4_ADDR_T(&hdr->sipaddr, ipsrc_addr); diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h index 42659445..6b302bfd 100644 --- a/src/include/lwip/netif.h +++ b/src/include/lwip/netif.h @@ -314,8 +314,6 @@ struct netif { /** maximum transfer unit (in bytes) */ u16_t mtu; /** link level hardware address of this interface */ - /* Ensure hwaddr is 16-bit aligned by placing it behind u16_t value - * because it is accessed via ETHADDR16_COPY() macro in etharp.c and autoip.c */ u8_t hwaddr[NETIF_MAX_HWADDR_LEN]; /** number of bytes used in hwaddr */ u8_t hwaddr_len; diff --git a/src/include/lwip/prot/ethernet.h b/src/include/lwip/prot/ethernet.h index 9f56ba26..b0c88ec0 100644 --- a/src/include/lwip/prot/ethernet.h +++ b/src/include/lwip/prot/ethernet.h @@ -153,12 +153,6 @@ enum eth_type { #define LL_IP6_MULTICAST_ADDR_0 0x33 #define LL_IP6_MULTICAST_ADDR_1 0x33 -/** MEMCPY-like macro to copy to/from struct eth_addr's that are no local - * variables and known to be 16-bit aligned within the protocol header. */ -#ifndef ETHADDR16_COPY -#define ETHADDR16_COPY(dst, src) SMEMCPY(dst, src, ETH_HWADDR_LEN) -#endif - #define eth_addr_cmp(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETH_HWADDR_LEN) == 0) #ifdef __cplusplus diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c index 7270cfd8..5f3175f5 100644 --- a/src/netif/ethernet.c +++ b/src/netif/ethernet.c @@ -297,8 +297,8 @@ ethernet_output(struct netif* netif, struct pbuf* p, ethhdr = (struct eth_hdr*)p->payload; ethhdr->type = eth_type_be; - ETHADDR16_COPY(ðhdr->dest, dst); - ETHADDR16_COPY(ðhdr->src, src); + SMEMCPY(ðhdr->dest, dst, ETH_HWADDR_LEN); + SMEMCPY(ðhdr->src, src, ETH_HWADDR_LEN); LWIP_ASSERT("netif->hwaddr_len must be 6 for ethernet_output!", (netif->hwaddr_len == ETH_HWADDR_LEN));