mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-03 21:32:08 +00:00
Fixed bug #29763 (CHECKSUM_GEN_IP_INLINE), added macro LWIP_MAKE_U16() that's improved for endianess
This commit is contained in:
parent
4b7288e8f4
commit
abc36471d9
@ -597,7 +597,7 @@ err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
IPH_TTL_SET(iphdr, ttl);
|
||||
IPH_PROTO_SET(iphdr, proto);
|
||||
#if CHECKSUM_GEN_IP_INLINE
|
||||
chk_sum = (proto << 8) | ttl;
|
||||
chk_sum = LWIP_MAKE_U16(proto, ttl);
|
||||
#endif /* CHECKSUM_GEN_IP_INLINE */
|
||||
|
||||
/* dest cannot be NULL here */
|
||||
|
@ -47,6 +47,12 @@ extern "C" {
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define LWIP_MAKE_U16(a, b) ((a << 8) | b)
|
||||
#else
|
||||
#define LWIP_MAKE_U16(a, b) ((b << 8) | a)
|
||||
#endif
|
||||
|
||||
#ifdef htons
|
||||
#undef htons
|
||||
#endif /* htons */
|
||||
|
Loading…
Reference in New Issue
Block a user