Fixed bug #29763 (CHECKSUM_GEN_IP_INLINE), added macro LWIP_MAKE_U16() that's improved for endianess

This commit is contained in:
goldsimon 2010-05-04 18:59:52 +00:00
parent 4b7288e8f4
commit abc36471d9
2 changed files with 7 additions and 1 deletions

View File

@ -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 */

View File

@ -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 */