summaryrefslogtreecommitdiffstats
path: root/tests/topotests/munet/linux.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 04:24:34 +0000
commit137ce8dd46d313f15ee93ddbb5428d702aa61ed8 (patch)
treea49f76849019651842962dff2197b705e33831e7 /tests/topotests/munet/linux.py
parentReleasing progress-linux version 9.1-0.1~progress7.99u1. (diff)
downloadfrr-137ce8dd46d313f15ee93ddbb5428d702aa61ed8.tar.xz
frr-137ce8dd46d313f15ee93ddbb5428d702aa61ed8.zip
Merging upstream version 10.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/topotests/munet/linux.py')
-rw-r--r--tests/topotests/munet/linux.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/topotests/munet/linux.py b/tests/topotests/munet/linux.py
index 417f745..519c55f 100644
--- a/tests/topotests/munet/linux.py
+++ b/tests/topotests/munet/linux.py
@@ -132,8 +132,17 @@ def pidfd_open(pid, flags=0):
return fd
+# Runtime patch if kernel supports the call.
if not hasattr(os, "pidfd_open"):
- os.pidfd_open = pidfd_open
+ try:
+ import platform
+
+ kversion = [int(x) for x in platform.release().split("-")[0].split(".")]
+ kvok = kversion[0] > 5 or (kversion[0] == 5 and kversion[1] >= 4)
+ except ValueError:
+ kvok = False
+ if kvok:
+ os.pidfd_open = pidfd_open
def setns(fd, nstype): # noqa: D402