mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Fix bug #50883: struct eth_addr alignment does not fit with ETHADDR16_COPY
... by simply removing ETHADDR16_COPY since noone advocated to keep it
This commit is contained in:
parent
500598658d
commit
006bb84368
@ -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).
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user