Files
cubelinux-kernel/tools/testing/selftests/net/netns-sysctl.sh
T
Greg Kroah-Hartman 598cf27219 Linux 6.19.3
Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
Tested-by: Peter Schneider <pschneider1968@googlemail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Salvatore Bonaccorso <carnil@debian.org>
Tested-by: Brett A C Sheffield <bacs@librecast.net>
Tested-by: Mark Brown <broonie@kernel.org>
Tested-by: Luna Jernberg <droidbittin@gmail.com>
Tested-by: Ronald Warsow <rwarsow@gmx.de>
Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
Tested-by: Ron Economos <re@w6rz.net>
Tested-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-02-19 16:33:27 +01:00

41 lines
910 B
Bash
Executable File

#!/bin/bash -e
# SPDX-License-Identifier: GPL-2.0
#
# This test checks that the network buffer sysctls are present
# in a network namespaces, and that they are readonly.
source lib.sh
cleanup() {
cleanup_ns $test_ns
}
trap cleanup EXIT
fail() {
echo "ERROR: $*" >&2
exit 1
}
setup_ns test_ns
for sc in {r,w}mem_{default,max}; do
# check that this is writable in a netns
[ -w "/proc/sys/net/core/$sc" ] ||
fail "$sc isn't writable in the init netns!"
# change the value in the host netns
sysctl -qw "net.core.$sc=300000" ||
fail "Can't write $sc in init netns!"
# check that the value is read from the init netns
[ "$(ip netns exec $test_ns sysctl -n "net.core.$sc")" -eq 300000 ] ||
fail "Value for $sc mismatch!"
# check that this isn't writable in a netns
ip netns exec $test_ns [ -w "/proc/sys/net/core/$sc" ] &&
fail "$sc is writable in a netns!"
done
echo 'Test passed OK'