Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 May 2021 12:59:54 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e183dd501caf - stable/13 - traceroute6: Properly calculate UDP checksum
Message-ID:  <202105061259.146CxsIN007088@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e183dd501caf03751c96c7c0683ccc3a6c0cd27d

commit e183dd501caf03751c96c7c0683ccc3a6c0cd27d
Author:     Zhenlei Huang <zlei.huang@gmail.com>
AuthorDate: 2021-05-03 16:46:19 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-05-06 12:59:19 +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
    Differential Revision:  https://reviews.freebsd.org/D30042
    
    (cherry picked from commit 1d712c05370dca8cbf81d1ecd9acd606fdcacaf4)
---
 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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105061259.146CxsIN007088>