diff --git a/src/core/inet_chksum.c b/src/core/inet_chksum.c index f47d3c5b..8bc42c14 100644 --- a/src/core/inet_chksum.c +++ b/src/core/inet_chksum.c @@ -259,11 +259,10 @@ lwip_standard_chksum(void *dataptr, int len) /** Parts of the pseudo checksum which are common to IPv4 and IPv6 */ static u16_t -inet_cksum_pseudo_base(struct pbuf *p, u8_t proto, u16_t proto_len, u16_t chksum_base) +inet_cksum_pseudo_base(struct pbuf *p, u8_t proto, u16_t proto_len, u32_t acc) { struct pbuf *q; u8_t swapped = 0; - u32_t acc = chksum_base; /* iterate through all pbuf in chain */ for(q = p; q != NULL; q = q->next) { @@ -325,7 +324,7 @@ inet_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len, acc = FOLD_U32T(acc); acc = FOLD_U32T(acc); - return inet_cksum_pseudo_base(p, proto, proto_len, (u16_t)acc); + return inet_cksum_pseudo_base(p, proto, proto_len, acc); } #if LWIP_IPV6 /** @@ -359,19 +358,18 @@ ip6_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len, acc = FOLD_U32T(acc); acc = FOLD_U32T(acc); - return inet_cksum_pseudo_base(p, proto, proto_len, (u16_t)acc); + return inet_cksum_pseudo_base(p, proto, proto_len, acc); } #endif /* LWIP_IPV6 */ /** Parts of the pseudo checksum which are common to IPv4 and IPv6 */ static u16_t inet_cksum_pseudo_partial_base(struct pbuf *p, u8_t proto, u16_t proto_len, - u16_t chksum_len, u16_t chksum_base) + u16_t chksum_len, u32_t acc) { struct pbuf *q; u8_t swapped = 0; u16_t chklen; - u32_t acc = chksum_base; /* iterate through all pbuf in chain */ for(q = p; (q != NULL) && (chksum_len > 0); q = q->next) { @@ -438,7 +436,7 @@ inet_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len, acc = FOLD_U32T(acc); acc = FOLD_U32T(acc); - return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, (u16_t)acc); + return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc); } #if LWIP_IPV6 @@ -475,7 +473,7 @@ ip6_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len, acc = FOLD_U32T(acc); acc = FOLD_U32T(acc); - return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, (u16_t)acc); + return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc); } #endif /* LWIP_IPV6 */