[LTP] [PATCH v2 2/2] clone09: add a test for CLONE_NEWNET flag

Cyril Hrubis chrubis@suse.cz
Thu Jun 22 17:09:32 CEST 2017


Hi!
> +static void do_test(void)
> +{
> +	int def_val;
> +
> +	tst_res(TINFO, "create clone in a new netns with 'CLONE_NEWNET' flag");
> +
> +	SAFE_FILE_SCANF(sysctl_path, "%d", &sysctl_net);
> +	SAFE_FILE_PRINTF(sysctl_path, "%d", sysctl_net + 1);
> +
> +	clone_child();
> +	tst_reap_children();
> +
> +	if (sysctl_net_new == (sysctl_net + 1)) {
> +		tst_res(TFAIL, "sysctl params equal: %s=%d",
> +			sysctl_path, sysctl_net_new);
> +	}
> +
> +	SAFE_FILE_SCANF(sysctl_path_def, "%d", &def_val);
> +
> +	if (sysctl_net_new != def_val) {
> +		tst_res(TFAIL, "netns param init to non-default value %d",
> +			sysctl_net_new);
> +	}

We should restore the sysctl_path value here, in a case that we are
looping (the -i or -I options).

Otherwise it looks fine.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list