[LTP] [PATCH 1/2] test_net.sh: add tst_set_sysctl()

Cyril Hrubis chrubis@suse.cz
Tue Jan 31 11:07:45 CET 2017


Hi!
> +# tst_set_sysctl NAME VALUE [safe]
> +# It can handle netns case when sysctl not namespaceified.
> +tst_set_sysctl()
> +{
> +	local name="$1"
> +	local value="$2"
> +	local safe=
> +	[ "$3" = "safe" ] && safe="-s" || safe=""

Uh, this syntax is confusing, besides isn't safe set to empty string
anyway?

> +	local add_opt=
> +	[ "$TST_USE_NETNS" = "yes" ] && add_opt="-e"
> +
> +	if [ "$safe" ]; then
> +		ROD sysctl -qw $name=$value
> +	else
> +		sysctl -qw $name=$value
> +	fi
> +
> +	tst_rhost_run $safe -c "sysctl -qw $add_opt $name=$value"
> +}

And maybe the function name should say that we are changing the
parameter both on local and remote machine. Maybe just rename the
function to tst_set_sysctls().

>  # Management Link
>  [ -z "$RHOST" ] && TST_USE_NETNS="yes"
>  export RHOST="$RHOST"
> -- 
> 1.7.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list