Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Tikhomirov <ptikhomirov@virtuozzo.com>2016-04-28 19:39:01 +0300
committerPavel Emelyanov <xemul@virtuozzo.com>2016-05-27 13:32:05 +0300
commitc4db738652741e959ae06fcfcbf20a6798e9a8f5 (patch)
tree87bf3d7c9512fb1cc27ef74c4d24c4e289fcbfb6 /test/zdtm/static/netns-dev.c
parent19f5a31396710aaa712b5dd9d99755b8c4e1268d (diff)
zdtm/net/ipv6: add test for confs
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Reviewed-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Diffstat (limited to 'test/zdtm/static/netns-dev.c')
-rw-r--r--test/zdtm/static/netns-dev.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/zdtm/static/netns-dev.c b/test/zdtm/static/netns-dev.c
index 4aedec69a..21a6e5ce4 100644
--- a/test/zdtm/static/netns-dev.c
+++ b/test/zdtm/static/netns-dev.c
@@ -6,6 +6,8 @@
#define LO_CONF_DIR_PATH "/proc/sys/net/ipv4/conf/lo"
#define DEF_CONF_DIR_PATH "/proc/sys/net/ipv4/conf/default"
+#define LO_CONF6_DIR_PATH "/proc/sys/net/ipv6/conf/lo"
+#define DEF_CONF6_DIR_PATH "/proc/sys/net/ipv6/conf/default"
#define INT_MAX ((int)(~0U>>1))
#define INT_MIN (-INT_MAX - 1)
@@ -181,7 +183,10 @@ struct range rand_range6[] = {
struct test_conf {
int ipv4_conf[ARRAY_SIZE(devconfs4)];
int ipv4_conf_rand[ARRAY_SIZE(devconfs4)];
+ int ipv6_conf[ARRAY_SIZE(devconfs6)];
+ int ipv6_conf_rand[ARRAY_SIZE(devconfs6)];
char *dir4;
+ char *dir6;
} lo, def;
static int save_conf(FILE *fp, int *conf, int *conf_rand,
@@ -316,6 +321,33 @@ static int for_each_option_do(int (*f)(FILE *fp, int *conf, int *conf_rand,
fclose(fp);
}
+ for (i = 0; devconfs6[i]; i++) {
+ FILE *fp;
+ char path[PATH_MAX];
+
+ ret = snprintf(path, sizeof(path), "%s/%s", tc->dir6, devconfs6[i]);
+ if (ret < 0) {
+ pr_perror("snprintf");
+ return -1;
+ }
+
+ ret = access(path, W_OK);
+ if (ret < 0)
+ continue;
+
+ fp = fopen(path, "r+");
+ if (fp == NULL) {
+ pr_perror("fopen");
+ return -1;
+ }
+
+ ret = (*f)(fp, &tc->ipv6_conf[i], &tc->ipv6_conf_rand[i], &rand_range6[i], path);
+ if (ret < 0)
+ return -1;
+
+ fclose(fp);
+ }
+
return 0;
}
@@ -325,6 +357,8 @@ int main(int argc, char **argv)
lo.dir4 = LO_CONF_DIR_PATH;
def.dir4 = DEF_CONF_DIR_PATH;
+ lo.dir6 = LO_CONF6_DIR_PATH;
+ def.dir6 = DEF_CONF6_DIR_PATH;
test_init(argc, argv);