From nobody Mon Nov 06 16:45:50 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SPHKW2nJsz50DqM; Mon, 6 Nov 2023 16:45:51 +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 4SPHKV4JFJz4GqF; Mon, 6 Nov 2023 16:45:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699289150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WcUPUKeXmR+qcTjA1FZcJKefty9biovp69tz49DFcQI=; b=GLSK3ejeuMYYoBIzk5HiDiQaOmeRgKOQ7fEF8BV3Lkpw4Zr5OsxJDFDpVDgOdI3gDS13V+ F5Xnn52bBdsO9CY02IBBJuWRDyUIRmPFOVT3WHIzZBZoch010lp2Jo1mYvzalgGa5XCCGe nf4DpZHPVjOAstR8zzeUSVDJJ68qKfwaHsblTBfoi9JMxUG6BWZfljfz4Ense1ocbad4wz 2UBwXBYKPi/mzKJT/wjO4TadJ3xvGTASr0p1Quv4LZkXpIeTG9VxZrc0FF5sY54W7YKB8R 99Qa7SYLwc225QAVP/2fCxEKPyrkMqywP99uIvKfHGdvf3nSA3qLQmPU9nSSmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699289150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WcUPUKeXmR+qcTjA1FZcJKefty9biovp69tz49DFcQI=; b=ypYJblOEvfnLgTgYhE8GD56neB4TOaYwmXIWD+kc1XI+HK/xPN+xy6Qc24KAtR2I+f6/5L iRxc2C2zzovVOUJVVOFYAO1maVSXAoo46SCcLdTM4SQCS92ya8LR+quRSCC8Sy/3fKz00b d5SkH4NcdxxWXBEQVuzqwQVyNen4XexMwiNUr9lKRAOzcMRWZuGYjzah0P56Zc1HDaSWx5 5iMTW+TgqJt2mJpNtY26OJBEGSCywXkWvgc+aD+fN1VPjfBjuMWSVS/9HLmbV7Fz4NAd1i g4UCDLzV9BJCVOSldiWmDtVBAsI5yzZ4VY715Ek4koGde46NQRCjLevY3WTNOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699289150; a=rsa-sha256; cv=none; b=DGlAR6jZcPNiIsj30lLuxG/3y44C8xBsUaLpsSfdkDzEQTzfnytq62cV63Y6V64oGBd2kr 8wt0GSeFGp+pfF+O4btmpzDWPF0q2jNFwnAv8NqzS/Tmb4tLyf8CVuOAaf1+PjZUmIb/1/ YjZKZ99BMAZzsTjee2cEgsTVCAwqr3l+qggNfFPlIK6AXp6Q78KD+oy0zyixAQhUGCqoIz TVdxar4+d36OYpPnhjeKe6x9/2Tr8VodxewI9xLCB3hfnsVR5P1GlC4Jh/4OwOMr+BH460 DcoIT+UV9Yyp0Rg1Hw5fnDnPtSP9RH5lTlPtDXBmftDTPODG+SFM8+Dq8MG0Vw== 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 4SPHKV3BxJz14s; Mon, 6 Nov 2023 16:45:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A6GjoBc058286; Mon, 6 Nov 2023 16:45:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A6GjoN3058284; Mon, 6 Nov 2023 16:45:50 GMT (envelope-from git) Date: Mon, 6 Nov 2023 16:45:50 GMT Message-Id: <202311061645.3A6GjoN3058284@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b9e2bb1d6e41 - stable/14 - ping tests: Test IHL/quoted data/inner packet paths List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/14 X-Git-Reftype: branch X-Git-Commit: b9e2bb1d6e414137aa3a980dddc6559fe52393e9 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b9e2bb1d6e414137aa3a980dddc6559fe52393e9 commit b9e2bb1d6e414137aa3a980dddc6559fe52393e9 Author: Jose Luis Duran AuthorDate: 2023-02-11 14:17:46 +0000 Commit: Mark Johnston CommitDate: 2023-11-06 16:45:43 +0000 ping tests: Test IHL/quoted data/inner packet paths Commit 46d7b45a267b3d78c5054b210ff7b6c55bfca42b introduced these code paths. Test and document them. - Add inner packet too short test - Add inner IHL too short test - Add quoted data too short test - Add IHL too short test - Add max inner packet IHL without payload test Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/863 Differential Revision: https://reviews.freebsd.org/D38528 (cherry picked from commit 20012a3a1a045bfe02bb64063cf0aba4d82471cb) --- sbin/ping/tests/test_ping.py | 112 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/sbin/ping/tests/test_ping.py b/sbin/ping/tests/test_ping.py index b501b8a606bf..93d45a1e3d7b 100644 --- a/sbin/ping/tests/test_ping.py +++ b/sbin/ping/tests/test_ping.py @@ -1030,6 +1030,118 @@ round-trip min/avg/max/stddev = /// ms }, id="_0_0_opts_NOP", ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 3, + "icmp_code": 1, + "ihl": 0x4, + }, + { + "returncode": 2, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 0 packets received, 100.0% packet loss +""", + "stderr": "", # "IHL too short" message not shown + "redacted": False, + }, + id="_IHL_too_short", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 3, + "icmp_code": 1, + "special": "no-payload", + }, + { + "returncode": 2, + "stdout": """\ +PATTERN: 0x01 +PING 192.0.2.2 (192.0.2.2): 56 data bytes + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 0 packets received, 100.0% packet loss +""", + "stderr": """\ +ping: quoted data too short (28 bytes) from 192.0.2.2 +""", + "redacted": False, + }, + id="_quoted_data_too_short", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 3, + "icmp_code": 1, + "oip_ihl": 0x4, + }, + { + "returncode": 2, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 0 packets received, 100.0% packet loss +""", + "stderr": "", # "inner IHL too short" message not shown + "redacted": False, + }, + id="_inner_IHL_too_short", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 3, + "icmp_code": 1, + "oip_ihl": 0xF, + }, + { + "returncode": 2, + "stdout": """\ +PING 192.0.2.2 (192.0.2.2): 56 data bytes + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 0 packets received, 100.0% packet loss +""", + "stderr": """\ +ping: inner packet too short (84 bytes) from 192.0.2.2 +""", + "redacted": False, + }, + id="_inner_packet_too_short", + ), + pytest.param( + { + "src": "192.0.2.1", + "dst": "192.0.2.2", + "icmp_type": 3, + "icmp_code": 1, + "oip_ihl": 0xF, + "special": "no-payload", + }, + { + "returncode": 2, + "stdout": """\ +PATTERN: 0x01 +PING 192.0.2.2 (192.0.2.2): 56 data bytes + +--- 192.0.2.2 ping statistics --- +1 packets transmitted, 0 packets received, 100.0% packet loss +""", + "stderr": "", + "redacted": False, + }, + id="_max_inner_packet_ihl_without_payload", + ), pytest.param( { "src": "192.0.2.1",