Skip to contentSkip to conversation

selftests: forwarding: lib: quote the sysctl values

PATCH Applied Hangbin Liu 3 participants 3 messages Feb 8, 2023 – Feb 9, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: forwarding: lib: quote the sysctl values

When set/restore sysctl value, we should quote the value as some keys may have multi values, e.g. net.ipv4.ping_group_range

Fixes f5ae57784ba8 ("selftests: forwarding: lib: Add sysctl_set(), sysctl_restore()")
---
 tools/testing/selftests/net/forwarding/lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/forwarding/lib.sh +2 -2
index 1c4f866de7d7..3d8e4ebda1b6 100755
@@ -914,14 +914,14 @@ sysctl_set()
 	local value=$1; shift
 
 	SYSCTL_ORIG[$key]=$(sysctl -n $key)
-	sysctl -qw $key=$value
+	sysctl -qw $key="$value"
 }
 
 sysctl_restore()
 {
 	local key=$1; shift
 
-	sysctl -qw $key=${SYSCTL_ORIG["$key"]}
+	sysctl -qw $key="${SYSCTL_ORIG[$key]}"
 }
 
 forwarding_enable()
Signature · 1 line
2.38.1
#2 lore raw
In reply to Hangbin Liu
This patch was applied to netdev/net.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Wed, 8 Feb 2023 11:21:10 +0800 you wrote:

When set/restore sysctl value, we should quote the value as some keys may have multi values, e.g. net.ipv4.ping_group_range

Fixes f5ae57784ba8 ("selftests: forwarding: lib: Add sysctl_set(), sysctl_restore()")
---
 tools/testing/selftests/net/forwarding/lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
- [net] selftests: forwarding: lib: quote the sysctl values

    https://git.kernel.org/netdev/net/c/3a082086aa20

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html