From ef8eccff786bc2bea5add63fba1e6f666f392b4a Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 3 Apr 2026 17:10:51 +0200 Subject: [PATCH] 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. --- test/integration/device_raw_socket.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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" -- 2.47.3