mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 02:39:44 +00:00
Add more messages, wait for directory service to start first
And make sure gaps in sockaddr_in are zeroed.
This commit is contained in:
parent
2932544eb8
commit
c3f573ea7f
@ -269,9 +269,11 @@ int load_subscriber_address(struct subscriber *subscriber)
|
||||
return -1;
|
||||
}
|
||||
struct sockaddr_in addr;
|
||||
bzero(&addr, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr = hostc->address;
|
||||
addr.sin_port = htons(hostc->port);
|
||||
DEBUGF("Loaded address %s:%d for %s", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port), alloca_tohex_sid(subscriber->sid));
|
||||
return overlay_send_probe(subscriber, addr, interface);
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,8 @@ overlay_interface_init_socket(int interface_index)
|
||||
|
||||
interface->state=INTERFACE_STATE_UP;
|
||||
|
||||
INFOF("Interface %s addr %s, is up",interface->name, inet_ntoa(interface->broadcast_address.sin_addr));
|
||||
INFOF("Interface %s addr %s:%d, is up",interface->name,
|
||||
inet_ntoa(interface->address.sin_addr), ntohs(interface->address.sin_port));
|
||||
|
||||
directory_registration();
|
||||
|
||||
@ -333,6 +334,7 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
interface->port= ifconfig->port;
|
||||
interface->type= ifconfig->type;
|
||||
interface->default_route = ifconfig->default_route;
|
||||
DEBUGF("interface->default_route=%d",interface->default_route);
|
||||
interface->last_tick_ms= -1; // not ticked yet
|
||||
interface->alarm.poll.fd=0;
|
||||
|
||||
@ -371,7 +373,6 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
interface->send_broadcasts=0;
|
||||
INFOF("Interface %s is running tickless", name);
|
||||
}
|
||||
|
||||
if (ifconfig->dummy[0]) {
|
||||
interface->fileP = 1;
|
||||
char dummyfile[1024];
|
||||
@ -383,12 +384,14 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
return WHYF("could not open dummy interface file %s for append", dummyfile);
|
||||
}
|
||||
|
||||
bzero(&interface->address, sizeof(interface->address));
|
||||
interface->address.sin_family=AF_INET;
|
||||
interface->address.sin_port = htons(PORT_DNA);
|
||||
interface->address.sin_addr = ifconfig->dummy_address;
|
||||
|
||||
interface->netmask=ifconfig->dummy_netmask;
|
||||
|
||||
bzero(&interface->broadcast_address, sizeof(interface->address));
|
||||
interface->broadcast_address.sin_family=AF_INET;
|
||||
interface->broadcast_address.sin_port = htons(PORT_DNA);
|
||||
interface->broadcast_address.sin_addr.s_addr = interface->address.sin_addr.s_addr | ~interface->netmask.s_addr;
|
||||
@ -408,10 +411,8 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
schedule(&interface->alarm);
|
||||
|
||||
interface->state=INTERFACE_STATE_UP;
|
||||
INFOF("Dummy interface %s is up",interface->name);
|
||||
DEBUGF("Address %s",inet_ntoa(interface->address.sin_addr));
|
||||
DEBUGF("Netmask %s",inet_ntoa(interface->netmask));
|
||||
DEBUGF("Broadcast %s",inet_ntoa(interface->broadcast_address.sin_addr));
|
||||
INFOF("Dummy interface %s addr %s:%d, is up",interface->name,
|
||||
inet_ntoa(interface->address.sin_addr), ntohs(interface->address.sin_port));
|
||||
|
||||
directory_registration();
|
||||
|
||||
@ -568,7 +569,8 @@ void overlay_dummy_poll(struct sched_ent *alarm)
|
||||
(struct sockaddr*)&packet.src_addr, sizeof(packet.src_addr))) {
|
||||
WARN("Unsupported packet from dummy interface");
|
||||
}
|
||||
}
|
||||
}else
|
||||
DEBUGF("Ignoring packet addressed to %s:%d", inet_ntoa(packet.dst_addr.sin_addr), ntohs(packet.dst_addr.sin_port));
|
||||
}
|
||||
|
||||
/* keep reading new packets as fast as possible,
|
||||
|
@ -367,8 +367,8 @@ int overlay_send_probe(struct subscriber *peer, struct sockaddr_in addr, overlay
|
||||
op_free(frame);
|
||||
return -1;
|
||||
}
|
||||
DEBUGF("Queued probe packet on interface %s to %s for %s",
|
||||
interface->name, inet_ntoa(addr.sin_addr), peer?alloca_tohex_sid(peer->sid):"ANY");
|
||||
DEBUGF("Queued probe packet on interface %s to %s:%d for %s",
|
||||
interface->name, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port), peer?alloca_tohex_sid(peer->sid):"ANY");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,11 @@ test_publish() {
|
||||
assert_status_all_servald_servers running
|
||||
}
|
||||
|
||||
interface_up() {
|
||||
grep "Dummy interface .* is up" $instance_servald_log || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
start_routing_instance() {
|
||||
executeOk_servald config \
|
||||
set server.dummy_interface_dir "$SERVALD_VAR" \
|
||||
@ -94,6 +99,7 @@ start_routing_instance() {
|
||||
set log.show_time on \
|
||||
set debug.mdprequests Yes
|
||||
start_servald_server
|
||||
wait_until interface_up
|
||||
}
|
||||
|
||||
setup_routing() {
|
||||
|
Loading…
Reference in New Issue
Block a user