Commit d7f9e824 authored by Pavel Tikhomirov's avatar Pavel Tikhomirov Committed by Pavel Emelyanov

zdtm/net/sysctl: add all to test and fix order

1. First save/check all,default,lo together and only after - set them,
as setting some sysctls can affect the others
2. Set "accept_redirects" after "forwarding" both for ipv4 and ipv6
3. Change order to "all", "default", "lo"

*One can not set ipv6.conf.all.stable_secret, so don't even try, see:
commit 622c81d57b39 ("ipv6: generation of stable privacy addresses for
link-local and autoconf")
Signed-off-by: 's avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 1c954ab8
...@@ -6,15 +6,16 @@ ...@@ -6,15 +6,16 @@
#define LO_CONF_DIR_PATH "/proc/sys/net/ipv4/conf/lo" #define LO_CONF_DIR_PATH "/proc/sys/net/ipv4/conf/lo"
#define DEF_CONF_DIR_PATH "/proc/sys/net/ipv4/conf/default" #define DEF_CONF_DIR_PATH "/proc/sys/net/ipv4/conf/default"
#define ALL_CONF_DIR_PATH "/proc/sys/net/ipv4/conf/all"
#define LO_CONF6_DIR_PATH "/proc/sys/net/ipv6/conf/lo" #define LO_CONF6_DIR_PATH "/proc/sys/net/ipv6/conf/lo"
#define DEF_CONF6_DIR_PATH "/proc/sys/net/ipv6/conf/default" #define DEF_CONF6_DIR_PATH "/proc/sys/net/ipv6/conf/default"
#define ALL_CONF6_DIR_PATH "/proc/sys/net/ipv6/conf/all"
#define INT_MAX ((int)(~0U>>1)) #define INT_MAX ((int)(~0U>>1))
#define INT_MIN (-INT_MAX - 1) #define INT_MIN (-INT_MAX - 1)
char *devconfs4[] = { char *devconfs4[] = {
"accept_local", "accept_local",
"accept_redirects",
"accept_source_route", "accept_source_route",
"arp_accept", "arp_accept",
"arp_announce", "arp_announce",
...@@ -28,6 +29,7 @@ char *devconfs4[] = { ...@@ -28,6 +29,7 @@ char *devconfs4[] = {
"drop_unicast_in_l2_multicast", "drop_unicast_in_l2_multicast",
"force_igmp_version", "force_igmp_version",
"forwarding", "forwarding",
"accept_redirects",
"igmpv2_unsolicited_report_interval", "igmpv2_unsolicited_report_interval",
"igmpv3_unsolicited_report_interval", "igmpv3_unsolicited_report_interval",
"ignore_routes_with_linkdown", "ignore_routes_with_linkdown",
...@@ -54,7 +56,6 @@ struct range { ...@@ -54,7 +56,6 @@ struct range {
struct range rand_range4[] = { struct range rand_range4[] = {
{0, 1}, /* accept_local */ {0, 1}, /* accept_local */
{0, 1}, /* accept_redirects */
{-1, 0}, /* accept_source_route */ {-1, 0}, /* accept_source_route */
{0, 1}, /* arp_accept */ {0, 1}, /* arp_accept */
{0, 2}, /* arp_announce */ {0, 2}, /* arp_announce */
...@@ -68,6 +69,7 @@ struct range rand_range4[] = { ...@@ -68,6 +69,7 @@ struct range rand_range4[] = {
{0, 1}, /* drop_unicast_in_l2_multicast */ {0, 1}, /* drop_unicast_in_l2_multicast */
{0, INT_MAX}, /* force_igmp_version */ {0, INT_MAX}, /* force_igmp_version */
{0, 1}, /* forwarding */ {0, 1}, /* forwarding */
{0, 1}, /* accept_redirects */
{0, INT_MAX}, /* igmpv2_unsolicited_report_interval */ {0, INT_MAX}, /* igmpv2_unsolicited_report_interval */
{0, INT_MAX}, /* igmpv3_unsolicited_report_interval */ {0, INT_MAX}, /* igmpv3_unsolicited_report_interval */
{0, 1}, /* ignore_routes_with_linkdown */ {0, 1}, /* ignore_routes_with_linkdown */
...@@ -96,7 +98,6 @@ char *devconfs6[] = { ...@@ -96,7 +98,6 @@ char *devconfs6[] = {
"accept_ra_pinfo", "accept_ra_pinfo",
"accept_ra_rt_info_max_plen", "accept_ra_rt_info_max_plen",
"accept_ra_rtr_pref", "accept_ra_rtr_pref",
"accept_redirects",
"accept_source_route", "accept_source_route",
"autoconf", "autoconf",
"dad_transmits", "dad_transmits",
...@@ -106,6 +107,7 @@ char *devconfs6[] = { ...@@ -106,6 +107,7 @@ char *devconfs6[] = {
"force_mld_version", "force_mld_version",
"force_tllao", "force_tllao",
"forwarding", "forwarding",
"accept_redirects",
"hop_limit", "hop_limit",
"ignore_routes_with_linkdown", "ignore_routes_with_linkdown",
"keep_addr_on_down", "keep_addr_on_down",
...@@ -146,7 +148,6 @@ struct range rand_range6[] = { ...@@ -146,7 +148,6 @@ struct range rand_range6[] = {
{0, 1}, /* accept_ra_pinfo */ {0, 1}, /* accept_ra_pinfo */
{0, INT_MAX}, /* accept_ra_rt_info_max_plen */ {0, INT_MAX}, /* accept_ra_rt_info_max_plen */
{0, 1}, /* accept_ra_rtr_pref */ {0, 1}, /* accept_ra_rtr_pref */
{0, 1}, /* accept_redirects */
{-1, 0}, /* accept_source_route */ {-1, 0}, /* accept_source_route */
{0, 1}, /* autoconf */ {0, 1}, /* autoconf */
{0, INT_MAX}, /* dad_transmits */ {0, INT_MAX}, /* dad_transmits */
...@@ -156,6 +157,7 @@ struct range rand_range6[] = { ...@@ -156,6 +157,7 @@ struct range rand_range6[] = {
{0, 2}, /* force_mld_version */ {0, 2}, /* force_mld_version */
{0, 1}, /* force_tllao */ {0, 1}, /* force_tllao */
{0, 1}, /* forwarding */ {0, 1}, /* forwarding */
{0, 1}, /* accept_redirects */
{1, 255}, /* hop_limit */ {1, 255}, /* hop_limit */
{0, 1}, /* ignore_routes_with_linkdown */ {0, 1}, /* ignore_routes_with_linkdown */
{-1, 1}, /* keep_addr_on_down */ {-1, 1}, /* keep_addr_on_down */
...@@ -187,7 +189,7 @@ struct test_conf { ...@@ -187,7 +189,7 @@ struct test_conf {
int ipv6_conf_rand[ARRAY_SIZE(devconfs6)]; int ipv6_conf_rand[ARRAY_SIZE(devconfs6)];
char *dir4; char *dir4;
char *dir6; char *dir6;
} lo, def; } lo, def, all;
static int save_conf(FILE *fp, int *conf, int *conf_rand, static int save_conf(FILE *fp, int *conf, int *conf_rand,
struct range *range, char *path) { struct range *range, char *path) {
...@@ -432,51 +434,67 @@ int main(int argc, char **argv) ...@@ -432,51 +434,67 @@ int main(int argc, char **argv)
lo.dir4 = LO_CONF_DIR_PATH; lo.dir4 = LO_CONF_DIR_PATH;
def.dir4 = DEF_CONF_DIR_PATH; def.dir4 = DEF_CONF_DIR_PATH;
all.dir4 = ALL_CONF_DIR_PATH;
lo.dir6 = LO_CONF6_DIR_PATH; lo.dir6 = LO_CONF6_DIR_PATH;
def.dir6 = DEF_CONF6_DIR_PATH; def.dir6 = DEF_CONF6_DIR_PATH;
all.dir6 = ALL_CONF6_DIR_PATH;
test_init(argc, argv); test_init(argc, argv);
ret = for_each_option_do(save_conf, &lo); ret = for_each_option_do(save_conf, &all);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = for_each_option_do(gen_conf, &lo); ret = for_each_option_do(save_conf, &def);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = set_stable_secret(&lo); ret = for_each_option_do(save_conf, &lo);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = for_each_option_do(save_conf, &def); ret = for_each_option_do(gen_conf, &all);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = for_each_option_do(gen_conf, &def); ret = for_each_option_do(gen_conf, &def);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = for_each_option_do(gen_conf, &lo);
if (ret < 0)
return -1;
ret = set_stable_secret(&def); ret = set_stable_secret(&def);
if (ret < 0)
return -1;
ret = set_stable_secret(&lo);
if (ret < 0) if (ret < 0)
return -1; return -1;
test_daemon(); test_daemon();
test_waitsig(); test_waitsig();
ret = for_each_option_do(check_conf, &lo); ret = for_each_option_do(check_conf, &all);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = for_each_option_do(restore_conf, &lo); ret = for_each_option_do(check_conf, &def);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = check_stable_secret(&lo); ret = for_each_option_do(check_conf, &lo);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = for_each_option_do(check_conf, &def); ret = for_each_option_do(restore_conf, &all);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = for_each_option_do(restore_conf, &def); ret = for_each_option_do(restore_conf, &def);
if (ret < 0) if (ret < 0)
return -1; return -1;
ret = for_each_option_do(restore_conf, &lo);
if (ret < 0)
return -1;
ret = check_stable_secret(&def); ret = check_stable_secret(&def);
if (ret < 0)
return -1;
ret = check_stable_secret(&lo);
if (ret < 0) if (ret < 0)
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment