Add diagnostic checks for hardware-assisted checksum related flags in
the mbuf which supposed to get sent out: - Complain in ip_output() if any of the IPv6 related flags are set. - Complain in ip6_output() if any of the IPv4 related flags are set. - Complain in both functions if the flags indicate that both a TCP and UCP checksum should be calculated by the hardware.
This commit is contained in:
parent
2fbd5d820a
commit
9563ec16dc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_output.c,v 1.162 2006/05/15 00:05:17 christos Exp $ */
|
||||
/* $NetBSD: ip_output.c,v 1.163 2006/07/12 13:11:27 tron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
|
@ -98,7 +98,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.162 2006/05/15 00:05:17 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.163 2006/07/12 13:11:27 tron Exp $");
|
||||
|
||||
#include "opt_pfil_hooks.h"
|
||||
#include "opt_inet.h"
|
||||
|
@ -265,7 +265,19 @@ ip_output(struct mbuf *m0, ...)
|
|||
|
||||
#ifdef DIAGNOSTIC
|
||||
if ((m->m_flags & M_PKTHDR) == 0)
|
||||
panic("ip_output no HDR");
|
||||
panic("ip_output: no HDR");
|
||||
|
||||
if ((m->m_pkthdr.csum_flags &
|
||||
(M_CSUM_TCPv6|M_CSUM_UDPv6|M_CSUM_TSOv6)) != 0) {
|
||||
panic("ip_output: IPv6 checksum offload flags: %d",
|
||||
m->m_pkthdr.csum_flags);
|
||||
}
|
||||
|
||||
if ((m->m_pkthdr.csum_flags & (M_CSUM_TCPv4|M_CSUM_UDPv4)) ==
|
||||
(M_CSUM_TCPv4|M_CSUM_UDPv4)) {
|
||||
panic("ip_output: conflicting checksum offload flags: %d",
|
||||
m->m_pkthdr.csum_flags);
|
||||
}
|
||||
#endif
|
||||
if (opt) {
|
||||
m = ip_insertoptions(m, opt, &len);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip6_output.c,v 1.99 2006/07/08 19:58:40 rpaulo Exp $ */
|
||||
/* $NetBSD: ip6_output.c,v 1.100 2006/07/12 13:11:27 tron Exp $ */
|
||||
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.99 2006/07/08 19:58:40 rpaulo Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.100 2006/07/12 13:11:27 tron Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_inet6.h"
|
||||
|
@ -188,6 +188,23 @@ ip6_output(m0, opt, ro, flags, im6o, so, ifpp)
|
|||
ip6 = mtod(m, struct ip6_hdr *);
|
||||
#endif /* IPSEC */
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if ((m->m_flags & M_PKTHDR) == 0)
|
||||
panic("ip6_output: no HDR");
|
||||
|
||||
if ((m->m_pkthdr.csum_flags &
|
||||
(M_CSUM_TCPv4|M_CSUM_UDPv4|M_CSUM_TSOv4)) != 0) {
|
||||
panic("ip6_output: IPv4 checksum offload flags: %d",
|
||||
m->m_pkthdr.csum_flags);
|
||||
}
|
||||
|
||||
if ((m->m_pkthdr.csum_flags & (M_CSUM_TCPv6|M_CSUM_UDPv6)) ==
|
||||
(M_CSUM_TCPv6|M_CSUM_UDPv6)) {
|
||||
panic("ip6_output: conflicting checksum offload flags: %d",
|
||||
m->m_pkthdr.csum_flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
M_CSUM_DATA_IPv6_HL_SET(m->m_pkthdr.csum_data, sizeof(struct ip6_hdr));
|
||||
|
||||
#define MAKE_EXTHDR(hp, mp) \
|
||||
|
|
Loading…
Reference in New Issue