]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: suggest 4Mb /proc/sys/net/core/{wmem_max,rmem_max} for rootless
authorThomas Haller <thaller@redhat.com>
Fri, 15 Sep 2023 15:54:02 +0000 (17:54 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 18 Sep 2023 10:08:26 +0000 (12:08 +0200)
2Mb was not enough to pass "tests/shell/testcases/sets/0030add_many_elements_interval_0"
in an unprivileged/rootless namespace.

Instead, bump the suggestion to 4Mb, which lets the test pass.

Note that the 4Mb are only the recommended value when running the test
as rootless, and is used to autodetect NFT_TEST_HAS_SOCKET_LIMITS=y.
You can set whatever values are suitable for your environment, and
explicitly indicate whether the limits are appropriate or not via
NFT_TEST_HAS_SOCKET_LIMITS=n|y.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
tests/shell/run-tests.sh

index 1527b2a6455cd5e34d8fa42b4fecf17b4ead73bd..d11b4a63b6d17197f71cc03f8c664747a6c0841d 100755 (executable)
@@ -180,7 +180,7 @@ usage() {
        echo "                 with rootless the test would fail. Tests will check for [ "\$NFT_TEST_HAS_SOCKET_LIMITS" = y ]"
        echo "                 and skip. You may set NFT_TEST_HAS_SOCKET_LIMITS=n if you ensure those limits are"
        echo "                 suitable to run the test rootless. Otherwise will be autodetected."
-       echo "                 Set /proc/sys/net/core/{wmem_max,rmem_max} to at least 2MB to get them to pass automatically."
+       echo "                 Set /proc/sys/net/core/{wmem_max,rmem_max} to at least 4MB to get them to pass automatically."
        echo " NFT_TEST_UNSHARE_CMD=cmd : when set, this is the command line for an unshare"
        echo "                 command, which is used to sandbox each test invocation. By"
        echo "                 setting it to empty, no unsharing is done."
@@ -391,8 +391,8 @@ export NFT_TEST_HAS_REALROOT
 if [ "$NFT_TEST_HAS_SOCKET_LIMITS" = "" ] ; then
        if [ "$NFT_TEST_HAS_REALROOT" = y ] ; then
                NFT_TEST_HAS_SOCKET_LIMITS=n
-       elif [ "$(cat /proc/sys/net/core/wmem_max 2>/dev/null)" -ge $((2000*1024)) ] 2>/dev/null && \
-            [ "$(cat /proc/sys/net/core/rmem_max 2>/dev/null)" -ge $((2000*1024)) ] 2>/dev/null ; then
+       elif [ "$(cat /proc/sys/net/core/wmem_max 2>/dev/null)" -ge $((4000*1024)) ] 2>/dev/null && \
+            [ "$(cat /proc/sys/net/core/rmem_max 2>/dev/null)" -ge $((4000*1024)) ] 2>/dev/null ; then
                NFT_TEST_HAS_SOCKET_LIMITS=n
        else
                NFT_TEST_HAS_SOCKET_LIMITS=y