From nobody Mon Dec 26 20:07:14 2022 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 4NgpjH08tKz1HZZl; Mon, 26 Dec 2022 20:07:15 +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 4NgpjG47bxz3wh7; Mon, 26 Dec 2022 20:07:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672085234; 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=4SMf7TvvXksKpoy+r9hm/0I+ZE8GB4Y2U+xxwxbFWRw=; b=GrxJulP86NSidHCuFiYJ3gQBWlKNwfUxAC5uhRfZHbIXj4o3WYcn4reRgm3bc3WKyxsKLY vpW6nKP9VddBsEp3yPlKZY8mu9uv00V2tzFfD+V9FOGw3es6Xr0TySBLLO+BmxeSDiwL5T sLkd5M0Nj68JOz/8wMnIHWp3ibPK//oBjBYtDqaloYfDDWibe3f4BlukmkzdwPNDUxn4W8 fk0ycur6vckie3TyWb9Tc3dzJEAI3SWTT+r74yxMqoHK4dXOoRghGvpwQ0NxbdubABCTkD +GNEspYhn13hGntba/BKHTWVWatipFSd8cJyzh9Zm2w0inHAdmC1dpaM8jywiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672085234; 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=4SMf7TvvXksKpoy+r9hm/0I+ZE8GB4Y2U+xxwxbFWRw=; b=kpkDeL6x2lXWQU/WnIw3tKOgzLV7ZchXSZLsI4o7RTrT9S/E6ab7pXlCXNOpO0RWOGzAzu kK/pyr2kPMYyLs3WyoplU9OyjHrXzopbo81CSEeDVIlGL5Xsb5DhRuFVfPIEqSoGVqACEm LCA6RxfuQklTiclazaNisZgm2DkRpWGIZVaKwEr2Of1rB6I/dCHE1GbjLghpSuY54ROcA0 FFPqRQOAAJM0KhY2mzE8J11ktR1A2NKz9aeSXeHDEvKilMUm+XggREH3x7SnDsWEsKc5/T wGRuVj+teDPSa3U5A95aDG5gQZTQhuCyf2ajltfOGPuUrSuwSFk6d+bOiYQt+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672085234; a=rsa-sha256; cv=none; b=FdfcpyG40/OkNFpL2J+CywmOshOlmRCk+C3G/rjRAXt2LD9fN68B+NAEx+kXpuEEX6q3CY 3kQuc3Zu8MYiN8zDzb21Cgc+/VSMXoaTABk/vzhQVokoB7HHuEdneKz9jCD7RWwe2M7LaQ uMLcLJeXEXcI/PQg+IHufiixk9OPeiUk2X2xZuzzlzPGEUV5q0z8zMrN13U9RQkTQnuYGy qBUK1vLAu0ryWhuWQN6OmgsdHcldf76RIwSB5cocNKELxa3rt466vd4OhWYEVrCorp59Aj eWMjAvs4jW8hOvz86DtZ7qSUrExy8QpB7IccZT+9joSRFkL9cudEys8U/lrHBg== 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 4NgpjG3CDTzkBZ; Mon, 26 Dec 2022 20:07:14 +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 2BQK7EYw083297; Mon, 26 Dec 2022 20:07:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BQK7ESP083296; Mon, 26 Dec 2022 20:07:14 GMT (envelope-from git) Date: Mon, 26 Dec 2022 20:07:14 GMT Message-Id: <202212262007.2BQK7ESP083296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 5e4ae3061f27 - main - tests/divert: use PF_DIVERT 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e4ae3061f27039ccc13b4d08004bdaf369f291c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=5e4ae3061f27039ccc13b4d08004bdaf369f291c commit 5e4ae3061f27039ccc13b4d08004bdaf369f291c Author: Gleb Smirnoff AuthorDate: 2022-12-26 19:10:15 +0000 Commit: Gleb Smirnoff CommitDate: 2022-12-26 20:02:45 +0000 tests/divert: use PF_DIVERT Now all Python ports has been patched to support PF_DIVERT, and Python kinda promises to add support in 3.12 [1]. This reverts commit 322b5b7c16666c40d2763f18c1a51e6f0580d4e9. [1] https://github.com/python/cpython/pull/96536#issuecomment-1303974686 --- tests/sys/common/divert.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/sys/common/divert.py b/tests/sys/common/divert.py index 94e20a03571f..061f787d1b7a 100755 --- a/tests/sys/common/divert.py +++ b/tests/sys/common/divert.py @@ -29,16 +29,13 @@ # -import socket +from socket import socket, PF_DIVERT, SOCK_RAW import logging logging.getLogger("scapy").setLevel(logging.CRITICAL) import scapy.all as sc import argparse -IPPROTO_DIVERT = 258 - - def parse_args(): parser = argparse.ArgumentParser(description='divert socket tester') parser.add_argument('--dip', type=str, help='destination packet IP') @@ -52,14 +49,14 @@ def parse_args(): def ipdivert_ip_output_remote_success(args): packet = sc.IP(dst=args.dip) / sc.ICMP(type='echo-request') - with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s: + with socket(PF_DIVERT, SOCK_RAW, 0) as s: s.bind(('0.0.0.0', args.divert_port)) s.sendto(bytes(packet), ('0.0.0.0', 0)) def ipdivert_ip6_output_remote_success(args): packet = sc.IPv6(dst=args.dip) / sc.ICMPv6EchoRequest() - with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s: + with socket(PF_DIVERT, SOCK_RAW, 0) as s: s.bind(('0.0.0.0', args.divert_port)) s.sendto(bytes(packet), ('0.0.0.0', 0)) @@ -67,7 +64,7 @@ def ipdivert_ip6_output_remote_success(args): def ipdivert_ip_input_local_success(args): """Sends IPv4 packet to OS stack as inbound local packet.""" packet = sc.IP(dst=args.dip,src=args.sip) / sc.ICMP(type='echo-request') - with socket.socket(socket.AF_INET, socket.SOCK_RAW, IPPROTO_DIVERT) as s: + with socket(PF_DIVERT, SOCK_RAW, 0) as s: s.bind(('0.0.0.0', args.divert_port)) s.sendto(bytes(packet), (args.dip, 0))