mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 14:29:39 +00:00
Fixed bug #30402: CHECKSUM_GEN_IP_INLINE does not add IP options
This commit is contained in:
parent
9f457d3331
commit
714a43b18c
@ -225,6 +225,9 @@ HISTORY
|
||||
|
||||
++ Bugfixes:
|
||||
|
||||
2010-07-10: Simon Goldschmidt
|
||||
* ip.c: Fixed bug #30402: CHECKSUM_GEN_IP_INLINE does not add IP options
|
||||
|
||||
2010-06-30: Simon Goldschmidt
|
||||
* api_msg.c: fixed bug #30300 (shutdown parameter was not initialized in
|
||||
netconn_delete)
|
||||
|
@ -591,7 +591,7 @@ err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
struct ip_hdr *iphdr;
|
||||
ip_addr_t dest_addr;
|
||||
#if CHECKSUM_GEN_IP_INLINE
|
||||
u32_t chk_sum;
|
||||
u32_t chk_sum = 0;
|
||||
#endif /* CHECKSUM_GEN_IP_INLINE */
|
||||
|
||||
/* pbufs passed to IP must have a ref-count of 1 as their payload pointer
|
||||
@ -606,6 +606,9 @@ err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
#if IP_OPTIONS_SEND
|
||||
u16_t optlen_aligned = 0;
|
||||
if (optlen != 0) {
|
||||
#if CHECKSUM_GEN_IP_INLINE
|
||||
int i;
|
||||
#endif /* CHECKSUM_GEN_IP_INLINE */
|
||||
/* round up to a multiple of 4 */
|
||||
optlen_aligned = ((optlen + 3) & ~3);
|
||||
ip_hlen += optlen_aligned;
|
||||
@ -621,6 +624,11 @@ err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest,
|
||||
/* zero the remaining bytes */
|
||||
memset(((char*)p->payload) + optlen, 0, optlen_aligned - optlen);
|
||||
}
|
||||
#if CHECKSUM_GEN_IP_INLINE
|
||||
for (i = 0; i < optlen_aligned; i += sizeof(u16_t)) {
|
||||
chk_sum += ((u16_t*)p->payload)[i];
|
||||
}
|
||||
#endif /* CHECKSUM_GEN_IP_INLINE */
|
||||
}
|
||||
#endif /* IP_OPTIONS_SEND */
|
||||
/* generate IP header */
|
||||
@ -639,7 +647,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 = LWIP_MAKE_U16(proto, ttl);
|
||||
chk_sum += LWIP_MAKE_U16(proto, ttl);
|
||||
#endif /* CHECKSUM_GEN_IP_INLINE */
|
||||
|
||||
/* dest cannot be NULL here */
|
||||
|
Loading…
Reference in New Issue
Block a user