mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Allow interfaces to use local unix addresses
- broadcast packets are sent to all sockets in the same folder - switched most tests to use local sockets
This commit is contained in:
parent
5f2c6e364a
commit
506518ad06
@ -985,14 +985,6 @@ int vld_network_interface(const struct cf_om_node *parent, struct config_network
|
||||
return result | CFINCOMPLETE;
|
||||
}
|
||||
} else {
|
||||
if (nifp->socket_type == SOCK_DGRAM && nifp->file[0]){
|
||||
int nodei_socket_type = cf_om_get_child(parent, "socket_type", NULL);
|
||||
int nodei_file = cf_om_get_child(parent, "file", NULL);
|
||||
assert(nodei_socket_type != -1);
|
||||
assert(nodei_file != -1);
|
||||
cf_warn_incompatible(parent->nodv[nodei_socket_type], parent->nodv[nodei_file]);
|
||||
return result | CFSUB(CFINCOMPATIBLE);
|
||||
}
|
||||
if (nifp->socket_type != SOCK_DGRAM && !nifp->file[0]){
|
||||
cf_warn_missing_node(parent, "file");
|
||||
return result | CFSUB(CFINCOMPATIBLE);
|
||||
|
@ -17,7 +17,9 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
@ -54,6 +56,8 @@ static void overlay_interface_poll(struct sched_ent *alarm);
|
||||
|
||||
static void
|
||||
overlay_interface_close(overlay_interface *interface){
|
||||
if (interface->address.addr.sa_family == AF_UNIX)
|
||||
unlink(interface->address.local.sun_path);
|
||||
link_interface_down(interface);
|
||||
INFOF("Interface %s addr %s is down",
|
||||
interface->name, alloca_socket_address(&interface->address));
|
||||
@ -66,6 +70,15 @@ overlay_interface_close(overlay_interface *interface){
|
||||
interface->state=INTERFACE_STATE_DOWN;
|
||||
}
|
||||
|
||||
void overlay_interface_close_all()
|
||||
{
|
||||
unsigned i;
|
||||
for (i=0;i<OVERLAY_MAX_INTERFACES;i++){
|
||||
if (overlay_interfaces[i].state != INTERFACE_STATE_DOWN)
|
||||
overlay_interface_close(&overlay_interfaces[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void interface_state_html(struct strbuf *b, struct overlay_interface *interface)
|
||||
{
|
||||
switch(interface->state){
|
||||
@ -320,10 +333,8 @@ static int overlay_interface_init_any(int port)
|
||||
}
|
||||
|
||||
static int
|
||||
overlay_interface_init_socket(int interface_index)
|
||||
overlay_interface_init_socket(overlay_interface *interface)
|
||||
{
|
||||
overlay_interface *const interface = &overlay_interfaces[interface_index];
|
||||
|
||||
/*
|
||||
On linux you can bind to the broadcast address to receive broadcast packets per interface [or subnet],
|
||||
but then you can't receive unicast packets on the same socket.
|
||||
@ -371,7 +382,9 @@ overlay_interface_init(const char *name, struct socket_address *addr,
|
||||
return WHY("Too many interfaces -- Increase OVERLAY_MAX_INTERFACES");
|
||||
|
||||
overlay_interface *const interface = &overlay_interfaces[overlay_interface_count];
|
||||
|
||||
bzero(interface, sizeof(overlay_interface));
|
||||
interface->state=INTERFACE_STATE_DOWN;
|
||||
|
||||
strncpy(interface->name, name, sizeof interface->name);
|
||||
|
||||
// copy ifconfig values
|
||||
@ -394,7 +407,6 @@ overlay_interface_init(const char *name, struct socket_address *addr,
|
||||
interface->mtu = 1200;
|
||||
interface->point_to_point = ifconfig->point_to_point;
|
||||
|
||||
interface->state=INTERFACE_STATE_DOWN;
|
||||
interface->alarm.poll.fd=0;
|
||||
interface->debug = ifconfig->debug;
|
||||
interface->tx_count=0;
|
||||
@ -462,17 +474,19 @@ overlay_interface_init(const char *name, struct socket_address *addr,
|
||||
|
||||
limit_init(&interface->destination->transfer_limit, packet_interval);
|
||||
|
||||
interface->address = *addr;
|
||||
interface->destination->address = *broadcast;
|
||||
if (addr)
|
||||
interface->address = *addr;
|
||||
if (broadcast)
|
||||
interface->destination->address = *broadcast;
|
||||
|
||||
interface->alarm.function = overlay_interface_poll;
|
||||
interface_poll_stats.name="overlay_interface_poll";
|
||||
interface->alarm.stats=&interface_poll_stats;
|
||||
|
||||
if (ifconfig->socket_type==SOCK_DGRAM){
|
||||
if (ifconfig->socket_type == SOCK_DGRAM){
|
||||
interface->local_echo = 1;
|
||||
|
||||
if (overlay_interface_init_socket(overlay_interface_count))
|
||||
if (overlay_interface_init_socket(interface))
|
||||
return WHY("overlay_interface_init_socket() failed");
|
||||
}else{
|
||||
char read_file[1024];
|
||||
@ -767,6 +781,44 @@ static void overlay_interface_poll(struct sched_ent *alarm)
|
||||
}
|
||||
}
|
||||
|
||||
static int send_local_broadcast(int fd, const uint8_t *bytes, size_t len, struct socket_address *address)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *dp;
|
||||
if ((dir = opendir(address->local.sun_path)) == NULL) {
|
||||
WARNF_perror("opendir(%s)", alloca_str_toprint(address->local.sun_path));
|
||||
return -1;
|
||||
}
|
||||
while ((dp = readdir(dir)) != NULL) {
|
||||
struct socket_address addr;
|
||||
|
||||
strbuf d = strbuf_local(addr.local.sun_path, sizeof addr.local.sun_path);
|
||||
strbuf_path_join(d, address->local.sun_path, dp->d_name, NULL);
|
||||
if (strbuf_overrun(d)){
|
||||
WHYF("interface file name overrun: %s", alloca_str_toprint(strbuf_str(d)));
|
||||
continue;
|
||||
}
|
||||
|
||||
struct stat st;
|
||||
if (lstat(addr.local.sun_path, &st)) {
|
||||
WARNF_perror("stat(%s)", alloca_str_toprint(addr.local.sun_path));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (S_ISSOCK(st.st_mode)){
|
||||
addr.local.sun_family = AF_UNIX;
|
||||
addr.addrlen = sizeof(addr.local.sun_family) + strlen(addr.local.sun_path)+1;
|
||||
|
||||
ssize_t sent = sendto(fd, bytes, len, 0,
|
||||
&addr.addr, addr.addrlen);
|
||||
if (sent == -1)
|
||||
WHYF_perror("sendto(%d, %zu, %s)", fd, len, alloca_socket_address(&addr));
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int overlay_broadcast_ensemble(struct network_destination *destination, struct overlay_buffer *buffer)
|
||||
{
|
||||
assert(destination && destination->interface);
|
||||
@ -849,28 +901,33 @@ int overlay_broadcast_ensemble(struct network_destination *destination, struct o
|
||||
if (config.debug.overlayinterfaces)
|
||||
DEBUGF("Sending %zu byte overlay frame on %s to %s",
|
||||
(size_t)len, interface->name, alloca_socket_address(&destination->address));
|
||||
ssize_t sent = sendto(interface->alarm.poll.fd,
|
||||
bytes, (size_t)len, 0,
|
||||
(struct sockaddr *)&destination->address, sizeof(destination->address));
|
||||
ob_free(buffer);
|
||||
if (sent == -1 || (size_t)sent != len) {
|
||||
if (sent == -1)
|
||||
|
||||
if (destination->address.addr.sa_family == AF_UNIX
|
||||
&& !destination->unicast){
|
||||
// find all sockets in this folder and send to them
|
||||
send_local_broadcast(interface->alarm.poll.fd,
|
||||
bytes, (size_t)len, &destination->address);
|
||||
}else{
|
||||
ssize_t sent = sendto(interface->alarm.poll.fd,
|
||||
bytes, (size_t)len, 0,
|
||||
&destination->address.addr, destination->address.addrlen);
|
||||
if (sent == -1){
|
||||
WHYF_perror("sendto(fd=%d,len=%zu,addr=%s) on interface %s",
|
||||
interface->alarm.poll.fd,
|
||||
len,
|
||||
alloca_sockaddr((struct sockaddr *)&destination->address, sizeof destination->address),
|
||||
(size_t)len,
|
||||
alloca_socket_address(&destination->address),
|
||||
interface->name
|
||||
);
|
||||
else
|
||||
WHYF("sendto() sent %zu bytes of overlay frame (%zu) to interface %s (socket=%d)",
|
||||
(size_t)sent, len, interface->name, interface->alarm.poll.fd);
|
||||
// close the interface if we had any error while sending broadcast packets,
|
||||
// unicast packets should not bring the interface down
|
||||
if (destination == interface->destination)
|
||||
overlay_interface_close(interface);
|
||||
// TODO mark unicast destination as failed
|
||||
return -1;
|
||||
// close the interface if we had any error while sending broadcast packets,
|
||||
// unicast packets should not bring the interface down
|
||||
// TODO mark unicast destination as failed?
|
||||
if (destination == interface->destination)
|
||||
overlay_interface_close(interface);
|
||||
ob_free(buffer);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
ob_free(buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -966,7 +1023,7 @@ void overlay_interface_discover(struct sched_ent *alarm)
|
||||
ifconfig = &config.interfaces.av[i].value;
|
||||
if (ifconfig->exclude)
|
||||
continue;
|
||||
if (ifconfig->socket_type==SOCK_DGRAM) {
|
||||
if (!*ifconfig->file) {
|
||||
detect_real_interfaces = 1;
|
||||
continue;
|
||||
}
|
||||
@ -981,22 +1038,55 @@ void overlay_interface_discover(struct sched_ent *alarm)
|
||||
}
|
||||
|
||||
if (j >= overlay_interface_count) {
|
||||
// New dummy interface, so register it.
|
||||
// New file interface, so register it.
|
||||
struct socket_address addr, broadcast;
|
||||
bzero(&addr, sizeof addr);
|
||||
bzero(&broadcast, sizeof broadcast);
|
||||
|
||||
addr.addrlen=sizeof addr.inet;
|
||||
addr.inet.sin_family=AF_INET;
|
||||
addr.inet.sin_port=htons(ifconfig->port);
|
||||
addr.inet.sin_addr=ifconfig->dummy_address;
|
||||
|
||||
broadcast.addrlen=sizeof addr.inet;
|
||||
broadcast.inet.sin_family=AF_INET;
|
||||
broadcast.inet.sin_port=htons(ifconfig->port);
|
||||
broadcast.inet.sin_addr.s_addr=ifconfig->dummy_address.s_addr | ~ifconfig->dummy_netmask.s_addr;
|
||||
|
||||
overlay_interface_init(ifconfig->file, &addr, &broadcast, ifconfig);
|
||||
switch(ifconfig->socket_type){
|
||||
case SOCK_FILE:
|
||||
// use a fake inet address
|
||||
addr.addrlen=sizeof addr.inet;
|
||||
addr.inet.sin_family=AF_INET;
|
||||
addr.inet.sin_port=htons(ifconfig->port);
|
||||
addr.inet.sin_addr=ifconfig->dummy_address;
|
||||
|
||||
broadcast.addrlen=sizeof addr.inet;
|
||||
broadcast.inet.sin_family=AF_INET;
|
||||
broadcast.inet.sin_port=htons(ifconfig->port);
|
||||
broadcast.inet.sin_addr.s_addr=ifconfig->dummy_address.s_addr | ~ifconfig->dummy_netmask.s_addr;
|
||||
// Fallthrough
|
||||
case SOCK_STREAM:
|
||||
overlay_interface_init(ifconfig->file, &addr, &broadcast, ifconfig);
|
||||
break;
|
||||
case SOCK_DGRAM:
|
||||
{
|
||||
// use a local dgram socket
|
||||
// no abstract sockets for now
|
||||
strbuf d = strbuf_local(addr.local.sun_path, sizeof addr.local.sun_path);
|
||||
strbuf_path_join(d, serval_instancepath(), config.server.interface_path, ifconfig->file, NULL);
|
||||
if (strbuf_overrun(d)){
|
||||
WHYF("interface file name overrun: %s", alloca_str_toprint(strbuf_str(d)));
|
||||
// TODO set ifconfig->exclude to prevent spam??
|
||||
break;
|
||||
}
|
||||
unlink(addr.local.sun_path);
|
||||
addr.local.sun_family=AF_UNIX;
|
||||
size_t len = strlen(addr.local.sun_path);
|
||||
|
||||
addr.addrlen=sizeof addr.local.sun_family + len + 1;
|
||||
|
||||
broadcast = addr;
|
||||
while(len && broadcast.local.sun_path[len]!='/')
|
||||
broadcast.local.sun_path[len--]='\0';
|
||||
broadcast.addrlen = sizeof addr.local.sun_family + len + 2;
|
||||
|
||||
DEBUGF("Attempting to bind local socket w. addr %s, broadcast %s",
|
||||
alloca_socket_address(&addr), alloca_socket_address(&broadcast));
|
||||
overlay_interface_init(ifconfig->file, &addr, &broadcast, ifconfig);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,7 @@ void overlay_interface_discover(struct sched_ent *alarm);
|
||||
int overlay_interface_register(char *name,
|
||||
struct socket_address *addr,
|
||||
struct socket_address *broadcast);
|
||||
void overlay_interface_close_all();
|
||||
overlay_interface * overlay_interface_get_default();
|
||||
overlay_interface * overlay_interface_find(struct in_addr addr, int return_default);
|
||||
overlay_interface * overlay_interface_find_name(const char *name);
|
||||
|
@ -87,7 +87,7 @@ static int mdp_send2(struct socket_address *client, struct mdp_header *header,
|
||||
const uint8_t *payload, size_t payload_len);
|
||||
|
||||
/* Delete all UNIX socket files in instance directory. */
|
||||
static void overlay_mdp_clean_socket_files()
|
||||
void overlay_mdp_clean_socket_files()
|
||||
{
|
||||
const char *instance_path = serval_instancepath();
|
||||
DIR *dir;
|
||||
|
@ -85,7 +85,7 @@ struct overlay_frame {
|
||||
|
||||
// how did we receive this packet?
|
||||
struct overlay_interface *interface;
|
||||
struct sockaddr_in recvaddr;
|
||||
|
||||
// packet envelope header;
|
||||
// Was it a unicast frame
|
||||
char unicast;
|
||||
|
@ -389,9 +389,6 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
|
||||
}
|
||||
}
|
||||
|
||||
if (recvaddr && recvaddr->addr.sa_family != AF_INET)
|
||||
RETURN(WHYF("Unexpected address %s", alloca_socket_address(recvaddr)));
|
||||
|
||||
struct overlay_frame f;
|
||||
struct decode_context context;
|
||||
bzero(&context, sizeof context);
|
||||
@ -402,10 +399,6 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s
|
||||
ob_limitsize(b, len);
|
||||
|
||||
f.interface = interface;
|
||||
if (recvaddr)
|
||||
f.recvaddr = recvaddr->inet;
|
||||
else
|
||||
bzero(&f.recvaddr, sizeof f.recvaddr);
|
||||
|
||||
int ret=parseEnvelopeHeader(&context, interface, recvaddr, b);
|
||||
if (ret){
|
||||
|
@ -1142,8 +1142,7 @@ static void create_out_links(struct neighbour *neighbour, overlay_interface *int
|
||||
l=l->_next;
|
||||
}
|
||||
// if this packet arrived in an IPv4 packet, assume we need to send them unicast packets
|
||||
if (addr && addr->addr.sa_family==AF_INET && addr->inet.sin_port!=0 && addr->inet.sin_addr.s_addr!=0)
|
||||
create_out_link(neighbour, interface, addr, 1);
|
||||
create_out_link(neighbour, interface, addr, 1);
|
||||
|
||||
// if this packet arrived from the same IPv4 subnet, or a different type of network, assume they can hear our broadcasts
|
||||
if (!addr || addr->addr.sa_family!=AF_INET ||
|
||||
|
1
serval.h
1
serval.h
@ -307,6 +307,7 @@ int server(const struct cli_parsed *parsed);
|
||||
int server_create_stopfile();
|
||||
int server_remove_stopfile();
|
||||
int server_check_stopfile();
|
||||
void overlay_mdp_clean_socket_files();
|
||||
void serverCleanUp();
|
||||
int isTransactionInCache(unsigned char *transaction_id);
|
||||
void insertTransactionInCache(unsigned char *transaction_id);
|
||||
|
11
server.c
11
server.c
@ -234,17 +234,10 @@ void serverCleanUp()
|
||||
if (serverMode){
|
||||
rhizome_close_db();
|
||||
dna_helper_shutdown();
|
||||
overlay_interface_close_all();
|
||||
}
|
||||
|
||||
char filename[1024];
|
||||
if (FORM_SERVAL_INSTANCE_PATH(filename, "mdp.socket"))
|
||||
unlink(filename);
|
||||
|
||||
if (FORM_SERVAL_INSTANCE_PATH(filename, "mdp.2.socket"))
|
||||
unlink(filename);
|
||||
|
||||
if (FORM_SERVAL_INSTANCE_PATH(filename, "monitor.socket"))
|
||||
unlink(filename);
|
||||
overlay_mdp_clean_socket_files();
|
||||
|
||||
/* Try to remove shutdown and PID files and exit */
|
||||
server_remove_stopfile();
|
||||
|
115
tests/routing
115
tests/routing
@ -22,7 +22,14 @@
|
||||
source "${0%/*}/../testframework.sh"
|
||||
source "${0%/*}/../testdefs.sh"
|
||||
|
||||
add_interface() {
|
||||
add_local_interface() {
|
||||
mkdir $SERVALD_VAR/dummy$1
|
||||
executeOk_servald config \
|
||||
set interfaces.$1.file dummy$1/$instance_number \
|
||||
set interfaces.$1.socket_type dgram
|
||||
}
|
||||
|
||||
add_dummy_interface() {
|
||||
>$SERVALD_VAR/dummy$1
|
||||
executeOk_servald config \
|
||||
set interfaces.$1.file dummy$1 \
|
||||
@ -81,7 +88,6 @@ start_routing_instance() {
|
||||
set debug.mdprequests yes \
|
||||
set debug.linkstate yes \
|
||||
set debug.verbose yes \
|
||||
set debug.subscriber yes \
|
||||
set debug.overlayrouting yes \
|
||||
set log.console.level debug \
|
||||
set log.console.show_pid on \
|
||||
@ -109,7 +115,7 @@ setup_single_link() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +A +B start_routing_instance
|
||||
}
|
||||
test_single_link() {
|
||||
@ -125,7 +131,7 @@ setup_multiple_ids() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_identities 2
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +A +B start_routing_instance
|
||||
}
|
||||
test_multiple_ids() {
|
||||
@ -152,7 +158,7 @@ setup_unlock_ids() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
set_instance +A
|
||||
executeOk_servald keyring add 'entry-pin'
|
||||
extract_stdout_keyvalue SIDX sid "$rexp_sid"
|
||||
@ -182,7 +188,7 @@ setup_migrate_id() {
|
||||
set_instance +B
|
||||
executeOk_servald keyring load sidx '' 'entry-pin'
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +A +B start_routing_instance
|
||||
}
|
||||
test_migrate_id() {
|
||||
@ -201,7 +207,7 @@ setup_single_mdp() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +A +B executeOk_servald config set interfaces.1.encapsulation single
|
||||
foreach_instance +A +B start_routing_instance
|
||||
}
|
||||
@ -218,7 +224,7 @@ setup_mismatched_encap() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +A executeOk_servald config set interfaces.1.encapsulation single
|
||||
foreach_instance +A +B start_routing_instance
|
||||
}
|
||||
@ -235,10 +241,9 @@ setup_single_p2p() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +A +B \
|
||||
executeOk_servald config \
|
||||
set interfaces.1.debug 1 \
|
||||
set interfaces.1.encapsulation single \
|
||||
set interfaces.1.point_to_point on
|
||||
foreach_instance +A +B start_routing_instance
|
||||
@ -314,7 +319,7 @@ setup_multiple_nodes() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C +D create_single_identity
|
||||
foreach_instance +A +B +C +D add_interface 1
|
||||
foreach_instance +A +B +C +D add_local_interface 1
|
||||
foreach_instance +A +B +C +D start_routing_instance
|
||||
}
|
||||
test_multiple_nodes() {
|
||||
@ -338,7 +343,7 @@ setup_scan() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C create_single_identity
|
||||
foreach_instance +A +B +C add_interface 1
|
||||
foreach_instance +A +B +C add_dummy_interface 1
|
||||
foreach_instance +A +B +C \
|
||||
executeOk_servald config \
|
||||
set interfaces.1.drop_broadcasts on
|
||||
@ -388,7 +393,7 @@ setup_single_filter() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_dummy_interface 1
|
||||
set_instance +B
|
||||
executeOk_servald config \
|
||||
set interfaces.1.drop_broadcasts on
|
||||
@ -412,7 +417,7 @@ setup_broadcast_only() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_dummy_interface 1
|
||||
foreach_instance +A +B \
|
||||
executeOk_servald config set interfaces.1.drop_unicasts 1
|
||||
foreach_instance +A +B start_routing_instance
|
||||
@ -432,7 +437,7 @@ setup_prefer_unicast() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +A +B \
|
||||
executeOk_servald config \
|
||||
set interfaces.1.prefer_unicast 1 \
|
||||
@ -454,9 +459,9 @@ setup_multihop_linear() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C +D create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +B +C add_interface 2
|
||||
foreach_instance +C +D add_interface 3
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +B +C add_local_interface 2
|
||||
foreach_instance +C +D add_local_interface 3
|
||||
foreach_instance +A +B +C +D start_routing_instance
|
||||
}
|
||||
test_multihop_linear() {
|
||||
@ -480,9 +485,9 @@ setup_unicast_route() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C +D create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +B +C add_interface 2
|
||||
foreach_instance +C +D add_interface 3
|
||||
foreach_instance +A +B add_dummy_interface 1
|
||||
foreach_instance +B +C add_dummy_interface 2
|
||||
foreach_instance +C +D add_dummy_interface 3
|
||||
set_instance +A
|
||||
executeOk_servald config \
|
||||
set interfaces.1.drop_broadcasts on
|
||||
@ -504,8 +509,8 @@ setup_offline() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C +D create_single_identity
|
||||
foreach_instance +A +B +C add_interface 1
|
||||
foreach_instance +A +B +D add_interface 2
|
||||
foreach_instance +A +B +C add_local_interface 1
|
||||
foreach_instance +A +B +D add_local_interface 2
|
||||
foreach_instance +A +B +C +D start_routing_instance
|
||||
}
|
||||
|
||||
@ -543,8 +548,8 @@ setup_lose_neighbours() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +B +C add_interface 2
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +B +C add_local_interface 2
|
||||
foreach_instance +A +B +C start_routing_instance
|
||||
}
|
||||
test_lose_neighbours() {
|
||||
@ -556,8 +561,8 @@ test_lose_neighbours() {
|
||||
set_instance +A
|
||||
wait_until --timeout=30 instance_offline +C
|
||||
start_servald_server +B
|
||||
wait_until path_exists +A +B +C
|
||||
wait_until path_exists +C +B +A
|
||||
wait_until --timeout=20 path_exists +A +B +C
|
||||
wait_until --timeout=20 path_exists +C +B +A
|
||||
}
|
||||
|
||||
setup_multi_interface() {
|
||||
@ -603,7 +608,7 @@ setup_ping_unreliable() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_dummy_interface 1
|
||||
foreach_instance +A +B \
|
||||
executeOk_servald config \
|
||||
set interfaces.1.drop_packets 40
|
||||
@ -622,11 +627,11 @@ setup_ping_unreliable2() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_dummy_interface 1
|
||||
foreach_instance +A +B \
|
||||
executeOk_servald config \
|
||||
set interfaces.1.drop_packets 40
|
||||
foreach_instance +B +C add_interface 2
|
||||
foreach_instance +B +C add_dummy_interface 2
|
||||
foreach_instance +B +C \
|
||||
executeOk_servald config \
|
||||
set interfaces.2.drop_packets 40
|
||||
@ -645,7 +650,7 @@ setup_brping_unreliable() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +B add_dummy_interface 1
|
||||
foreach_instance +A +B \
|
||||
executeOk_servald config \
|
||||
set interfaces.1.drop_packets 20
|
||||
@ -664,9 +669,9 @@ setup_unreliable_links() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +B +C add_interface 2
|
||||
foreach_instance +A +C add_interface 3
|
||||
foreach_instance +A +B add_dummy_interface 1
|
||||
foreach_instance +B +C add_dummy_interface 2
|
||||
foreach_instance +A +C add_dummy_interface 3
|
||||
set_instance +A
|
||||
executeOk_servald config \
|
||||
set interfaces.1.drop_packets 5 \
|
||||
@ -696,12 +701,12 @@ setup_unreliable_links2() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C +D create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +A +C add_interface 2
|
||||
foreach_instance +A +D add_interface 3
|
||||
foreach_instance +B +C add_interface 4
|
||||
foreach_instance +B +D add_interface 5
|
||||
foreach_instance +C +D add_interface 6
|
||||
foreach_instance +A +B add_dummy_interface 1
|
||||
foreach_instance +A +C add_dummy_interface 2
|
||||
foreach_instance +A +D add_dummy_interface 3
|
||||
foreach_instance +B +C add_dummy_interface 4
|
||||
foreach_instance +B +D add_dummy_interface 5
|
||||
foreach_instance +C +D add_dummy_interface 6
|
||||
set_instance +A
|
||||
executeOk_servald config \
|
||||
set interfaces.1.drop_packets 5 \
|
||||
@ -736,14 +741,14 @@ setup_circle() {
|
||||
setup_servald
|
||||
assert_no_servald_processes
|
||||
foreach_instance +A +B +C +D +E +F +G +H create_single_identity
|
||||
foreach_instance +A +B add_interface 1
|
||||
foreach_instance +B +C add_interface 2
|
||||
foreach_instance +C +D add_interface 3
|
||||
foreach_instance +D +E add_interface 4
|
||||
foreach_instance +E +F add_interface 5
|
||||
foreach_instance +F +G add_interface 6
|
||||
foreach_instance +G +H add_interface 7
|
||||
foreach_instance +H +A add_interface 8
|
||||
foreach_instance +A +B add_local_interface 1
|
||||
foreach_instance +B +C add_local_interface 2
|
||||
foreach_instance +C +D add_local_interface 3
|
||||
foreach_instance +D +E add_local_interface 4
|
||||
foreach_instance +E +F add_local_interface 5
|
||||
foreach_instance +F +G add_local_interface 6
|
||||
foreach_instance +G +H add_local_interface 7
|
||||
foreach_instance +H +A add_local_interface 8
|
||||
foreach_instance +A +B +C +D +E +F +G +H start_routing_instance
|
||||
}
|
||||
|
||||
@ -775,13 +780,13 @@ setup_crowded_mess() {
|
||||
assert_no_servald_processes
|
||||
# BCDE & DEFG form squares, ABC & FGH form triangles
|
||||
foreach_instance +A +B +C +D +E +F +G +H create_single_identity
|
||||
foreach_instance +A +B +C add_interface 1
|
||||
foreach_instance +B +D add_interface 2
|
||||
foreach_instance +C +E add_interface 3
|
||||
foreach_instance +D +E add_interface 4
|
||||
foreach_instance +D +F add_interface 5
|
||||
foreach_instance +E +G add_interface 6
|
||||
foreach_instance +F +G +H add_interface 7
|
||||
foreach_instance +A +B +C add_local_interface 1
|
||||
foreach_instance +B +D add_local_interface 2
|
||||
foreach_instance +C +E add_local_interface 3
|
||||
foreach_instance +D +E add_local_interface 4
|
||||
foreach_instance +D +F add_local_interface 5
|
||||
foreach_instance +E +G add_local_interface 6
|
||||
foreach_instance +F +G +H add_local_interface 7
|
||||
foreach_instance +A +B +C +D +E +F +G +H \
|
||||
executeOk_servald config \
|
||||
set mdp.iftype.wifi.reachable_timeout_ms 60000
|
||||
|
Loading…
x
Reference in New Issue
Block a user