patch #8027: Completed HW checksuming for IPv4 and IPv6 ICMP's

This commit is contained in:
Simon Goldschmidt
2014-01-17 22:32:36 +01:00
parent 8ae472821f
commit 018719d9d3
8 changed files with 334 additions and 296 deletions

View File

@@ -133,6 +133,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n"));
goto lenerr;
}
#if CHECKSUM_CHECK_ICMP
if (inet_chksum_pbuf(p) != 0) {
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo\n"));
pbuf_free(p);
@@ -140,6 +141,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
snmp_inc_icmpinerrors();
return;
}
#endif
#if LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN
if (pbuf_header(p, (PBUF_IP_HLEN + PBUF_LINK_HLEN))) {
/* p is not big enough to contain link headers
@@ -324,7 +326,9 @@ icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
/* calculate checksum */
icmphdr->chksum = 0;
#if CHECKSUM_GEN_ICMP
icmphdr->chksum = inet_chksum(icmphdr, q->len);
#endif
ICMP_STATS_INC(icmp.xmit);
/* increase number of messages attempted to send */
snmp_inc_icmpoutmsgs();

View File

@@ -578,7 +578,9 @@ ip_reass(struct pbuf *p)
IPH_OFFSET_SET(fraghdr, 0);
IPH_CHKSUM_SET(fraghdr, 0);
/* @todo: do we need to set calculate the correct checksum? */
#if CHECKSUM_GEN_IP
IPH_CHKSUM_SET(fraghdr, inet_chksum(fraghdr, IP_HLEN));
#endif /* CHECKSUM_GEN_IP */
p = ipr->p;
@@ -818,7 +820,9 @@ ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest)
IPH_OFFSET_SET(iphdr, htons(tmp));
IPH_LEN_SET(iphdr, htons(cop + IP_HLEN));
IPH_CHKSUM_SET(iphdr, 0);
#if CHECKSUM_GEN_IP
IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN));
#endif /* CHECKSUM_GEN_IP */
#if IP_FRAG_USES_STATIC_BUF
if (last) {