Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Add KASSERTs in in_undefer_cksum_tcpudp.



details:   https://anonhg.NetBSD.org/src/rev/f0eff90ec8ab
branches:  trunk
changeset: 320535:f0eff90ec8ab
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Jul 11 06:25:05 2018 +0000

description:
Add KASSERTs in in_undefer_cksum_tcpudp.

diffstat:

 sys/netinet/in_offload.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 21172bf4d292 -r f0eff90ec8ab sys/netinet/in_offload.c
--- a/sys/netinet/in_offload.c  Wed Jul 11 06:00:34 2018 +0000
+++ b/sys/netinet/in_offload.c  Wed Jul 11 06:25:05 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in_offload.c,v 1.10 2018/07/11 06:00:34 maxv Exp $     */
+/*     $NetBSD: in_offload.c,v 1.11 2018/07/11 06:25:05 maxv Exp $     */
 
 /*
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.10 2018/07/11 06:00:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.11 2018/07/11 06:25:05 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/mbuf.h>
@@ -239,6 +239,10 @@
        struct ip *ip;
        uint16_t csum, offset;
 
+       KASSERT((m->m_flags & M_PKTHDR) != 0);
+       KASSERT((m->m_pkthdr.csum_flags & (M_CSUM_TCPv4|M_CSUM_UDPv4)) != 0);
+       KASSERT((m->m_pkthdr.csum_flags & (M_CSUM_TCPv6|M_CSUM_UDPv6)) == 0);
+
        ip = mtod(m, struct ip *);
        offset = ip->ip_hl << 2;
 



Home | Main Index | Thread Index | Old Index