summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2023-07-04 10:48:20 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2023-07-04 10:48:20 +0000
commitffea90a11c273eab4d9ee5d9146c513d0c3e25ba (patch)
treef203911b1a69b3b71aecd12e78201ee76d2bb91c /sys/netinet
parentd92f2243903e00d02bc1428b38ea7244c47f1640 (diff)
Remove redundant code when calculating checksum.
OK jmatthew@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_output.c4
-rw-r--r--sys/netinet/tcp_output.c5
2 files changed, 3 insertions, 6 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 86288bc8892..0e56ffb3f11 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.388 2023/05/22 16:08:34 bluhm Exp $ */
+/* $OpenBSD: ip_output.c,v 1.389 2023/07/04 10:48:19 bluhm Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -1801,7 +1801,7 @@ in_hdr_cksum_out(struct mbuf *m, struct ifnet *ifp)
struct ip *ip = mtod(m, struct ip *);
ip->ip_sum = 0;
- if (ifp && in_ifcap_cksum(m, ifp, IFCAP_CSUM_IPv4)) {
+ if (in_ifcap_cksum(m, ifp, IFCAP_CSUM_IPv4)) {
SET(m->m_pkthdr.csum_flags, M_IPV4_CSUM_OUT);
} else {
ipstat_inc(ips_outswcsum);
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index c7111b143ec..fabd9d332ae 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.138 2023/05/15 16:34:56 bluhm Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.139 2023/07/04 10:48:19 bluhm Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -1295,7 +1295,6 @@ tcp_chopper(struct mbuf *m0, struct mbuf_list *ml, struct ifnet *ifp,
/* copy and adjust IP header, calculate checksum */
SET(m->m_pkthdr.csum_flags, M_TCP_CSUM_OUT);
- mhth->th_sum = 0;
if (ip) {
struct ip *mhip;
@@ -1328,10 +1327,8 @@ tcp_chopper(struct mbuf *m0, struct mbuf_list *ml, struct ifnet *ifp,
}
/* adjust IP header, calculate checksum */
SET(m0->m_pkthdr.csum_flags, M_TCP_CSUM_OUT);
- th->th_sum = 0;
if (ip) {
ip->ip_len = htons(m0->m_pkthdr.len);
- ip->ip_sum = 0;
in_hdr_cksum_out(m0, ifp);
in_proto_cksum_out(m0, ifp);
}