Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144617137
D15222.id41954.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D15222.id41954.diff
View Options
Index: sys/netinet/ip_output.c
===================================================================
--- sys/netinet/ip_output.c
+++ sys/netinet/ip_output.c
@@ -80,6 +80,10 @@
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
#include <netinet/ip_options.h>
+
+#include <netinet/udp.h>
+#include <netinet/udp_var.h>
+
#ifdef SCTP
#include <netinet/sctp.h>
#include <netinet/sctp_crc32.h>
@@ -928,14 +932,22 @@
in_delayed_cksum(struct mbuf *m)
{
struct ip *ip;
- uint16_t csum, offset, ip_len;
+ struct udphdr *uh;
+ uint16_t csum, offset, cklen = 0;
ip = mtod(m, struct ip *);
offset = ip->ip_hl << 2 ;
- ip_len = ntohs(ip->ip_len);
- csum = in_cksum_skip(m, ip_len, offset);
- if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0)
- csum = 0xffff;
+
+ if (m->m_pkthdr.csum_flags & CSUM_UDP) {
+ uh = (struct udphdr *)((caddr_t)ip + offset);
+ cklen = ntohs(uh->uh_ulen);
+ csum = in_cksum_skip(m, cklen + offset, offset);
+ if (csum == 0)
+ csum = 0xffff;
+ } else {
+ cklen = ntohs(ip->ip_len);
+ csum = in_cksum_skip(m, cklen, offset);
+ }
offset += m->m_pkthdr.csum_data; /* checksum offset */
/* find the mbuf in the chain where the checksum starts*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 11, 7:38 AM (1 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28642183
Default Alt Text
D15222.id41954.diff (1 KB)
Attached To
Mode
D15222: Use UDP len when calculating UDP checksums
Attached
Detach File
Event Timeline
Log In to Comment