|
|
|
|
@ -15,6 +15,7 @@
|
|
|
|
|
#include <string.h> |
|
|
|
|
#include <unistd.h> |
|
|
|
|
#include "test_utils.h" |
|
|
|
|
#include "test_net.h" |
|
|
|
|
#include "etcp.h" |
|
|
|
|
#include "etcp_connections.h" |
|
|
|
|
#include "../src/config_parser.h" |
|
|
|
|
@ -85,7 +86,7 @@ static int create_temp_configs(void) {
|
|
|
|
|
"tun_ifname=tun102\n" |
|
|
|
|
"\n" |
|
|
|
|
"[server:test_c]\n" |
|
|
|
|
"addr=127.0.0.1:39013\n" |
|
|
|
|
"addr=127.0.0.1:0\n" |
|
|
|
|
"type=public\n" |
|
|
|
|
"\n" |
|
|
|
|
"[allowed_keys]\n" |
|
|
|
|
@ -103,7 +104,7 @@ static int create_temp_configs(void) {
|
|
|
|
|
"tun_ifname=tun101\n" |
|
|
|
|
"\n" |
|
|
|
|
"[server:test_b]\n" |
|
|
|
|
"addr=127.0.0.1:39012\n" |
|
|
|
|
"addr=127.0.0.1:0\n" |
|
|
|
|
"type=public\n" |
|
|
|
|
"\n" |
|
|
|
|
"[allowed_keys]\n" |
|
|
|
|
@ -112,7 +113,7 @@ static int create_temp_configs(void) {
|
|
|
|
|
"[client:to_c]\n" |
|
|
|
|
"keepalive=1\n" |
|
|
|
|
"peer_public_key=%s\n" |
|
|
|
|
"link=test_b:127.0.0.1:39013\n", |
|
|
|
|
"link=test_b:127.0.0.1:0\n", |
|
|
|
|
pub_c); |
|
|
|
|
free(pub_c); |
|
|
|
|
if (write_config(config_b, tpl_b) != 0) return -1; |
|
|
|
|
@ -128,7 +129,7 @@ static int create_temp_configs(void) {
|
|
|
|
|
"tun_ifname=tun100\n" |
|
|
|
|
"\n" |
|
|
|
|
"[server:test_a]\n" |
|
|
|
|
"addr=127.0.0.1:39011\n" |
|
|
|
|
"addr=127.0.0.1:0\n" |
|
|
|
|
"type=public\n" |
|
|
|
|
"\n" |
|
|
|
|
"[allowed_keys]\n" |
|
|
|
|
@ -137,7 +138,7 @@ static int create_temp_configs(void) {
|
|
|
|
|
"[client:to_b]\n" |
|
|
|
|
"keepalive=1\n" |
|
|
|
|
"peer_public_key=%s\n" |
|
|
|
|
"link=test_a:127.0.0.1:39012\n", |
|
|
|
|
"link=test_a:127.0.0.1:0\n", |
|
|
|
|
pub_b); |
|
|
|
|
free(pub_b); |
|
|
|
|
if (write_config(config_a, tpl_a) != 0) return -1; |
|
|
|
|
@ -218,6 +219,8 @@ int main(void) {
|
|
|
|
|
goto cleanup; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
test_etcp_set_peer(inst_a, "to_b", inst_b, "test_b"); |
|
|
|
|
test_etcp_set_peer(inst_b, "to_c", inst_c, "test_c"); |
|
|
|
|
if (utun_instance_init(inst_a) != 0 || utun_instance_init(inst_b) != 0 || utun_instance_init(inst_c) != 0) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "Failed to init connections"); |
|
|
|
|
goto cleanup; |
|
|
|
|
|