+/// Set up relay, peer and NUT that are directly connected
+peer_config_t *setup_relay_peer_nut_indirect(const char *prefix) {
+ static peer_config_t peers[] = {
+ {"relay", DEV_CLASS_BACKBONE, NULL, 0, NULL},
+ {"peer", DEV_CLASS_STATIONARY, NULL, 0, NULL},
+ {"nut", DEV_CLASS_STATIONARY, NULL, 0, NULL},
+ };
+
+ create_peers(peers, 3, prefix);
+ setup_indirect_topology(peers, 3);
+ assert(meshlink_add_invitation_address(peers[0].mesh, "192.168.1.1", NULL));
+ assert(meshlink_add_invitation_address(peers[0].mesh, "192.168.2.1", NULL));
+ invite_peers(peers, 3);
+
+ return peers;
+}
+
+/// Make all nodes only be able to communicate via TCP
+void set_peers_tcponly(peer_config_t *peers, int npeers) {
+ for(int i = 0; i < npeers; i++) {
+ char *command = NULL;
+ assert(asprintf(&command,
+ "/bin/ip netns exec %1$s iptables -A INPUT -p udp -j DROP;"
+ "/bin/ip netns exec %1$s iptables -A OUTPUT -p udp -j DROP;",
+ peers[i].netns_name));
+ assert(command);
+ assert(system(command) == 0);
+ free(command);
+ }
+}
+