Author: cem
Date: Thu Oct 17 17:19:16 2019
New Revision: 353688
URL: https://svnweb.freebsd.org/changeset/base/353688

Log:
  debugnet(4): Check hardware-validated UDP checksums
  
  Similar to INET checksums, lazily validate UDP checksums when the driver has
  already performed the check for us.  Like debugnet(4) INET checksums,
  validation in software is left as future work.
  
  Reviewed by:  markj
  Differential Revision:        https://reviews.freebsd.org/D21745

Modified:
  head/sys/net/debugnet_inet.c

Modified: head/sys/net/debugnet_inet.c
==============================================================================
--- head/sys/net/debugnet_inet.c        Thu Oct 17 17:02:50 2019        
(r353687)
+++ head/sys/net/debugnet_inet.c        Thu Oct 17 17:19:16 2019        
(r353688)
@@ -196,6 +196,15 @@ debugnet_handle_ip(struct debugnet_pcb *pcb, struct mb
                return;
        }
 
+       if ((m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) != 0) {
+               if ((m->m_pkthdr.csum_flags & CSUM_DATA_VALID) == 0) {
+                       DNETDEBUG("bad UDP checksum\n");
+                       return;
+               }
+       } else {
+               /* XXX */ ;
+       }
+
        /* UDP custom is to have packet length not include IP header. */
        ip->ip_len -= hlen;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to