From 6edb555dbc124032f16d132ceb3a48201fae2dd7 Mon Sep 17 00:00:00 2001 From: Oleg Bulyzhin Date: Tue, 7 Feb 2006 11:48:10 +0000 Subject: [PATCH] Fix five years old bug in ip_reass(): if we are using 'full' (i.e. including pseudo header) hardware rx checksum offloading ip_reass() fails to calculate TCP/UDP checksum for reassembled packet correctly. This also should fix recent 'NFS over UDP over bge' issue exposed by if_bge.c rev. 1.123 Reviewed by: sam (earlier version), bde Approved by: glebius (mentor) MFC after: 2 weeks --- sys/netinet/ip_input.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 2250116c6ed..00667a529cb 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -988,6 +988,13 @@ found: m->m_pkthdr.csum_data += q->m_pkthdr.csum_data; m_cat(m, q); } + /* + * In order to do checksumming faster we do 'end-around carry' here + * (and not in for{} loop), though it implies we are not going to + * reassemble more than 64k fragments. + */ + m->m_pkthdr.csum_data = + (m->m_pkthdr.csum_data & 0xffff) + (m->m_pkthdr.csum_data >> 16); #ifdef MAC mac_create_datagram_from_ipq(fp, m); mac_destroy_ipq(fp);