From nobody Wed Oct 11 18:01:03 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 4S5LDH40Nyz4wTZq; Wed, 11 Oct 2023 18:01:03 +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 4S5LDH3P9Nz4PST; Wed, 11 Oct 2023 18:01:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697047263; 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=LRbevuwDE1v8VZ8kof9vPzgxOjzVK44VFQ0/yyXqLao=; b=hvhzqq5U80CqH9hMhyayTB/xOQMuYYhOCPx67UJx5Vte9seRzASOlIo/N+4sCqIRX4408n yhxql5aO7tzfV55+2mVWxuyM7gkRY7wjYtToKPF3EmMiNyhNS1an3UcEhYsTHbVleOVBd8 oSoJFfjAK8/gDEnB3Z2DeyXHS6ozL/LX2a5rHQlVrIaebKUVvXmueRNrsK27cFvocrlVdi TuSNje8Y8AMOaPUA3p5hjgy4L5SGCCnH/1ST0J90Y7aDvq1o4g5tvmhedz/LuaXLvkbRBF 9DOrdn+igv4O+ZA0KsiZXqKSCA+8A5399gX/7mvlpTr/FlCZCUwvy8qGK6lkmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697047263; a=rsa-sha256; cv=none; b=KwlGKBwJv6+zhPA/BotyjfHjZ+JtlNici7vg5dqHnP6lYZ6BltU3+WWhEL9zGCyPJXNBVh Ex0Nmm0blXxaqaLVESfa6SLNb8WKonsHvhByPMkWrUyTAAEimSyXARq8b28QMxYwCRiFju gyWdlk3C3+D//2PRdktCbvltGaDAu+VRYmf0fCl4orhePm8CK3KjcnU9ArWy0nArfHQTph 9/RUOo5qofO1X3NKDkDHD3pc+okChaXEnAl6kLmRERbjZKd57mJmsk4YHwp1mw8x9dtP3L bKQ5vRHB33utuJhOjOePhJVMKC2/nNhLUMVDFNvwe+hWBkHofQop3tI77mAKiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697047263; 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=LRbevuwDE1v8VZ8kof9vPzgxOjzVK44VFQ0/yyXqLao=; b=hh7kHOtTZNkCIErTZDpjtXHjIovUHh2QivFDDPreRAy8r+fAJreA5XLBqB4jXNy8z0nOzW iCAL8EdoYC+9aIf4FrhxtsVxFZza9+c+nS6xMczcDwCJ/jwD8X0r2hCHjJPlUHEwEMhfCV YO806GJs/404W/ZIaDScyfVZwuvlbfH2oIR+oS1s7UClrcr94rBsKEElVYR+0Wcu08u2UA lgdQf4qGUKdaLg4TaYZ7oB90vtZmcQk0xmlMMgenXX0T2DbjJO9rLt+qIXYkXm4rBO24fm G+JfRkZYwX150jYh0V2NI9sr6gQ5/msGDA+6aZJUrhzxw6qyGuey2Moh5enzwA== 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 4S5LDH2C7lzWWT; Wed, 11 Oct 2023 18:01:03 +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 39BI13oD053667; Wed, 11 Oct 2023 18:01:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39BI13D1053664; Wed, 11 Oct 2023 18:01:03 GMT (envelope-from git) Date: Wed, 11 Oct 2023 18:01:03 GMT Message-Id: <202310111801.39BI13D1053664@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: 20012a3a1a04 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 20012a3a1a045bfe02bb64063cf0aba4d82471cb Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=20012a3a1a045bfe02bb64063cf0aba4d82471cb commit 20012a3a1a045bfe02bb64063cf0aba4d82471cb Author: Jose Luis Duran AuthorDate: 2023-02-11 14:17:46 +0000 Commit: Mark Johnston CommitDate: 2023-10-11 17:48:27 +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 --- 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 26a69b62f8fb..c311a77d6bb8 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",