summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r--sys/netinet/ip_output.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index dfd4cc19d63..34cbe2ee9e8 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.106 2001/06/23 03:10:21 provos Exp $ */
+/* $OpenBSD: ip_output.c,v 1.107 2001/06/23 05:55:40 angelos Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -586,15 +586,29 @@ sendit:
}
#endif /* IPSEC */
+ /* Catch routing changes wrt. hardware checksumming for TCP or UDP. */
+ if (m->m_pkthdr.csum & M_TCPV4_CSUM_OUT &&
+ !(ifp->if_capabilities & IFCAP_CSUM_TCPv4)) {
+ /* XXX Compute TCP checksum */
+ m->m_pkthdr.csum &= ~M_TCPV4_CSUM_OUT; /* Clear */
+ }
+
+ if (m->m_pkthdr.csum & M_UDPV4_CSUM_OUT &&
+ !(ifp->if_capabilities & IFCAP_CSUM_UDPv4)) {
+ /* XXX Compute UDP checksum */
+ m->m_pkthdr.csum &= ~M_UDPV4_CSUM_OUT; /* Clear */
+ }
+
/*
* If small enough for interface, can just send directly.
*/
if ((u_int16_t)ip->ip_len <= ifp->if_mtu) {
ip->ip_len = htons((u_int16_t)ip->ip_len);
ip->ip_off = htons((u_int16_t)ip->ip_off);
- if (ifp->if_capabilities & IFCAP_CSUM_IPv4)
+ if (ifp->if_capabilities & IFCAP_CSUM_IPv4) {
m->m_pkthdr.csum |= M_IPV4_CSUM_OUT;
- else {
+ ipstat.ips_outhwcsum++;
+ } else {
ip->ip_sum = 0;
ip->ip_sum = in_cksum(m, hlen);
}
@@ -602,19 +616,6 @@ sendit:
goto done;
}
- /* Catch routing changes. */
- if (m->m_pkthdr.csum & M_TCPV4_CSUM_OUT &&
- !(ifp->if_capabilities & IFCAP_CSUM_TCPv4)) {
- /* XXX Compute TCP checksum */
- m->m_pkthdr.csum &= ~M_TCPV4_CSUM_OUT; /* Clear */
- }
-
- if (m->m_pkthdr.csum & M_UDPV4_CSUM_OUT &&
- !(ifp->if_capabilities & IFCAP_CSUM_UDPv4)) {
- /* XXX Compute UDP checksum */
- m->m_pkthdr.csum &= ~M_UDPV4_CSUM_OUT; /* Clear */
- }
-
/*
* Too large for interface; fragment if possible.
* Must be able to put at least 8 bytes per fragment.