[LTP] [PATCH v2 2/2] clone09: add a test for CLONE_NEWNET flag
Alexey Kodanev
alexey.kodanev@oracle.com
Tue Jul 18 14:02:46 CEST 2017
On 06/22/2017 06:09 PM, Cyril Hrubis wrote:
> 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).
Applied with restoring sysctl value in do_test().
Thanks,
Alexey
>
> Otherwise it looks fine.
>
More information about the ltp
mailing list