net: arp: Remove in_addr/in6_addr from packed net_arp_hdr struct
Replace unpacked in_addr/in6_addr structures with raw buffers in net_arp_hdr struct, to prevent compiler warnings about unaligned access. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
0da228c57c
commit
bbdeef4ac4
5 changed files with 69 additions and 41 deletions
|
@ -739,6 +739,18 @@ static inline bool net_ipv4_is_ll_addr(const struct in_addr *addr)
|
|||
#define net_ipaddr_copy(dest, src) \
|
||||
UNALIGNED_PUT(UNALIGNED_GET(src), dest)
|
||||
|
||||
/**
|
||||
* @brief Copy an IPv4 address raw buffer
|
||||
*
|
||||
* @param dest Destination IP address.
|
||||
* @param src Source IP address.
|
||||
*/
|
||||
static inline void net_ipv4_addr_copy_raw(uint8_t *dest,
|
||||
const uint8_t *src)
|
||||
{
|
||||
net_ipaddr_copy((struct in_addr *)dest, (const struct in_addr *)src);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare two IPv4 addresses
|
||||
*
|
||||
|
@ -753,6 +765,21 @@ static inline bool net_ipv4_addr_cmp(const struct in_addr *addr1,
|
|||
return UNALIGNED_GET(&addr1->s_addr) == UNALIGNED_GET(&addr2->s_addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare two raw IPv4 address buffers
|
||||
*
|
||||
* @param addr1 Pointer to IPv4 address buffer.
|
||||
* @param addr2 Pointer to IPv4 address buffer.
|
||||
*
|
||||
* @return True if the addresses are the same, false otherwise.
|
||||
*/
|
||||
static inline bool net_ipv4_addr_cmp_raw(const uint8_t *addr1,
|
||||
const uint8_t *addr2)
|
||||
{
|
||||
return net_ipv4_addr_cmp((const struct in_addr *)addr1,
|
||||
(const struct in_addr *)addr2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare two IPv6 addresses
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue