From owner-dev-commits-src-main@freebsd.org Mon May 3 17:55:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D222E638E33; Mon, 3 May 2021 17:55:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYrHL4FcHz3JlD; Mon, 3 May 2021 17:55:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A71322906; Mon, 3 May 2021 17:55:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143Htgmt046865; Mon, 3 May 2021 17:55:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143HtgvE046864; Mon, 3 May 2021 17:55:42 GMT (envelope-from git) Date: Mon, 3 May 2021 17:55:42 GMT Message-Id: <202105031755.143HtgvE046864@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1d712c05370d - main - traceroute6: Properly calculate UDP checksum MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d712c05370dca8cbf81d1ecd9acd606fdcacaf4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 17:55:43 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1d712c05370dca8cbf81d1ecd9acd606fdcacaf4 commit 1d712c05370dca8cbf81d1ecd9acd606fdcacaf4 Author: Zhenlei Huang AuthorDate: 2021-05-03 16:46:19 +0000 Commit: Mark Johnston CommitDate: 2021-05-03 17:24:30 +0000 traceroute6: Properly calculate UDP checksum The revision D25604 capsicumize traceroute6. For UDP the send socket was changed from SOCK_DGRAM to SOCK_RAW and thus the UDP checksum need be calculated by application itself other than the kernel. outpacket is filled with zeros by line 707, thus the first round the UDP checksum is correct. But subsequent rounds outudp->uh_sum will be left with garbage. PR: 255507 Reviewed by: ae, markj, tuexen MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30042 --- usr.sbin/traceroute6/traceroute6.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 8449a9861302..a071c084ad07 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1118,6 +1118,7 @@ send_probe(int seq, u_long hops) outudp->uh_sport = htons(ident); outudp->uh_dport = htons(port+seq); outudp->uh_ulen = htons(datalen); + outudp->uh_sum = 0; outudp->uh_sum = udp_cksum(&Src, &Dst, outpacket, datalen); break; case IPPROTO_NONE: