Blob Blame History Raw
From f9dc97f5161eea0900b9e99bb29e8a4d5cda3109 Mon Sep 17 00:00:00 2001
From: Eric Garver <eric@garver.life>
Date: Mon, 2 Dec 2019 09:08:00 -0500
Subject: [PATCH 05/37] fix: test: CHECK_NAT_COEXISTENCE: only check for kernel
 version

Calling modprobe is problematic inside a container. Just check if the
running kernel is >4.18 as this is when NAT coexistence was fixed.

(cherry picked from commit 2b7d150d4b15b4b3876df0179cd08aaae33f2e38)
(cherry picked from commit fd54fafb9e43f2e0a396b8c502ef81bc738affeb)
---
 src/tests/functions.at | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/tests/functions.at b/src/tests/functions.at
index fc53f591b1bf..31d1a3c187e4 100644
--- a/src/tests/functions.at
+++ b/src/tests/functions.at
@@ -436,13 +436,8 @@ m4_define([CHECK_NAT_COEXISTENCE], [
     m4_if(nftables, FIREWALL_BACKEND, [
         KERNEL_MAJOR=`uname -r | cut -d. -f1`
         KERNEL_MINOR=`uname -r | cut -d. -f2`
-        if test ${KERNEL_MAJOR} -eq 4 && test ${KERNEL_MINOR} -ge 16 || test ${KERNEL_MAJOR} -gt 4; then
-            dnl Only check >=4.16 kernels. Previous versions did not explicitly
-            dnl deny it, but had undefined behavior.
-            AT_SKIP_IF([! modprobe iptable_nat])
-            AT_SKIP_IF([! NS_CMD([nft add table ip foobar])])
-            AT_SKIP_IF([! NS_CMD([nft add chain ip foobar foobar_chain { type nat hook postrouting priority 100 \; }])])
-            NS_CHECK([nft delete table ip foobar])
+        if test ${KERNEL_MAJOR} -eq 4 && test ${KERNEL_MINOR} -ge 18 || test ${KERNEL_MAJOR} -gt 4; then
+            :
         else
             AT_SKIP_IF([true])
         fi
-- 
2.23.0