Skip to content

Commit

Permalink
selftests: forwarding: lib: quote the sysctl values
Browse files Browse the repository at this point in the history
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: f5ae577 ("selftests: forwarding: lib: Add sysctl_set(), sysctl_restore()")
Signed-off-by: Hangbin Liu <[email protected]>
Reviewed-by: Petr Machata <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
liuhangbin authored and Paolo Abeni committed Feb 9, 2023
1 parent 2fcde9f commit 3a08208
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/net/forwarding/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3a08208

Please sign in to comment.