From ce9d227ca689b46a6aa4422dff4111342cf0c0e5 Mon Sep 17 00:00:00 2001 From: bluhm Date: Mon, 8 Aug 2022 23:00:51 +0000 Subject: [PATCH] If interface drivers had enabled transmit offloading of the payload checksum, IPv6 fragments contained invalid checksum. For fragments the protocol checksum has to be calculated before fragmentation. Hardware cannot do this as it is too late. Do it earlier in software. tested and OK mbuhl@ --- sys/netinet6/ip6_output.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 8fbac583874..355aa3edc4a 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.269 2022/06/29 22:45:24 bluhm Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.270 2022/08/08 23:00:51 bluhm Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -728,6 +728,12 @@ reroute: if (mtu > IPV6_MAXPACKET) mtu = IPV6_MAXPACKET; + /* + * If we are doing fragmentation, we can't defer TCP/UDP + * checksumming; compute the checksum and clear the flag. + */ + in6_proto_cksum_out(m, NULL); + /* * Change the next header field of the last header in the * unfragmentable part. -- 2.20.1