Keep firewall reload regression on the selective path
This commit is contained in:
1 parent
41c32cf063
commit
79946bb07c
1 file changed
+4
-3
@@ -291,7 +291,8 @@ static void test_tun(void) {
|
||||
|
||||
static const char *instance_config =
|
||||
"[global]\nmy_private_key=704f2e012c8fa8768130cb0f988a997dccb628372bc5ceccacc78dcbfec5916f\n"
|
||||
"my_public_key=b3193173def895bd0fcea6f86af077c7d77216f10395275f627ac18242ec0f01\n";
|
||||
"my_public_key=b3193173def895bd0fcea6f86af077c7d77216f10395275f627ac18242ec0f01\n"
|
||||
"my_node_id=0x5a77374f79310824\ndebug_level=warn\n[debug]\nconfig=info\nrouting=debug\n";
|
||||
|
||||
static void test_reload(void) {
|
||||
char directory[] = "/tmp/utun-firewall-XXXXXX";
|
||||
@@ -309,14 +310,14 @@ static void test_reload(void) {
|
||||
assert(utun_instance_reload(inst, ua, path) == inst && !fail_firewall_alloc);
|
||||
assert(inst->config == old_config && inst->fw.rules == old_rules && !inst->fw.bypass_all);
|
||||
assert(fw_check(&inst->fw, 0x0a000001, 80) && !fw_check(&inst->fw, 0x0a000002, 443));
|
||||
assert(utun_instance_reload(inst, ua, path) == inst && inst->fw.bypass_all && inst->fw.count == 1);
|
||||
assert(utun_instance_reload(inst, ua, path) == inst && inst->fw.bypass_all && inst->fw.count == 1 && !inst->core_started);
|
||||
old_config = inst->config; old_rules = inst->fw.rules;
|
||||
file = fopen(path, "wb"); assert(file);
|
||||
assert(fprintf(file, "%s[firewall]\nallow=10.0.0.2:65536\n", instance_config) > 0 && !fclose(file));
|
||||
assert(utun_instance_reload(inst, ua, path) == inst && inst->config == old_config && inst->fw.rules == old_rules);
|
||||
file = fopen(path, "wb"); assert(file);
|
||||
assert(fprintf(file, "%s[firewall]\n", instance_config) > 0 && !fclose(file));
|
||||
assert(utun_instance_reload(inst, ua, path) == inst && !inst->fw.count && !inst->fw.bypass_all);
|
||||
assert(utun_instance_reload(inst, ua, path) == inst && !inst->fw.count && !inst->fw.bypass_all && !inst->core_started);
|
||||
utun_instance_destroy(inst);
|
||||
uasync_destroy(ua, 0);
|
||||
assert(!test_unlink(path) && !test_rmdir(directory));
|
||||
|
||||
Reference in new issue
Block a user