From: Guus Sliepen Date: Fri, 3 Apr 2026 15:10:51 +0000 (+0200) Subject: Skip raw socket test if we don't have the required privileges X-Git-Url: https://www.tinc-vpn.org/git/?a=commitdiff_plain;h=ef8eccff786bc2bea5add63fba1e6f666f392b4a;p=tinc Skip raw socket test if we don't have the required privileges This can happen in an unprivileged container where it looks like we are root, but we don't have NET_RAW privileges. --- diff --git a/test/integration/device_raw_socket.py b/test/integration/device_raw_socket.py index d536390e..b2bbf114 100755 --- a/test/integration/device_raw_socket.py +++ b/test/integration/device_raw_socket.py @@ -4,6 +4,7 @@ import sys import subprocess as subp +import socket from testlib import check, util from testlib.log import log @@ -15,6 +16,13 @@ from testlib.external import veth_add, move_dev, ping util.require_root() util.require_command("ip", "link") +try: + s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.IPPROTO_IP) + print("Success!") +except PermissionError: + log.info("This test requires raw socket privileges") + sys.exit(77) + FAKE_DEV = "cqhqdr7knaLzYeMSdy" IP_NETNS = "10.198.96.1"