mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-18 20:57:56 +00:00
Quieten overlay_link.c DEBUG statements
Make them conditional on config.debug.overlayrouting, like other DEBUG statements in the same source file
This commit is contained in:
parent
c42260f5f9
commit
e856cafc97
@ -171,7 +171,8 @@ int resolve_name(const char *name, struct in_addr *addr){
|
||||
|
||||
if (addresses->ai_addr->sa_family==AF_INET){
|
||||
*addr = ((struct sockaddr_in *)addresses->ai_addr)->sin_addr;
|
||||
DEBUGF("Resolved %s into %s", name, inet_ntoa(*addr));
|
||||
if (config.debug.overlayrouting)
|
||||
DEBUGF("Resolved %s into %s", name, inet_ntoa(*addr));
|
||||
|
||||
}else
|
||||
ret=-1;
|
||||
@ -210,7 +211,8 @@ int load_subscriber_address(struct subscriber *subscriber)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
DEBUGF("Loaded address %s:%d for %s", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port), alloca_tohex_sid(subscriber->sid));
|
||||
if (config.debug.overlayrouting)
|
||||
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, OQ_MESH_MANAGEMENT);
|
||||
}
|
||||
|
||||
@ -291,7 +293,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:%d for %s",
|
||||
if (config.debug.overlayrouting)
|
||||
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;
|
||||
}
|
||||
@ -300,7 +303,8 @@ int overlay_send_probe(struct subscriber *peer, struct sockaddr_in addr, overlay
|
||||
static int overlay_append_unicast_address(struct subscriber *subscriber, struct overlay_buffer *buff)
|
||||
{
|
||||
if (subscriber->reachable & REACHABLE_ASSUMED || !(subscriber->reachable & REACHABLE_UNICAST)){
|
||||
DEBUGF("Unable to give address of %s, %d", alloca_tohex_sid(subscriber->sid),subscriber->reachable);
|
||||
if (config.debug.overlayrouting)
|
||||
DEBUGF("Unable to give address of %s, %d", alloca_tohex_sid(subscriber->sid),subscriber->reachable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -311,7 +315,8 @@ static int overlay_append_unicast_address(struct subscriber *subscriber, struct
|
||||
if (ob_append_ui16(buff, subscriber->address.sin_port))
|
||||
return -1;
|
||||
ob_checkpoint(buff);
|
||||
DEBUGF("Added STUN info for %s", alloca_tohex_sid(subscriber->sid));
|
||||
if (config.debug.overlayrouting)
|
||||
DEBUGF("Added STUN info for %s", alloca_tohex_sid(subscriber->sid));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -333,8 +338,9 @@ static int overlay_append_unicast_address(struct subscriber *subscriber, struct
|
||||
|
||||
int overlay_mdp_service_stun_req(overlay_mdp_frame *mdp)
|
||||
{
|
||||
DEBUGF("Processing STUN request from %s", alloca_tohex_sid(mdp->out.src.sid));
|
||||
|
||||
if (config.debug.overlayrouting)
|
||||
DEBUGF("Processing STUN request from %s", alloca_tohex_sid(mdp->out.src.sid));
|
||||
|
||||
struct overlay_buffer *payload = ob_static(mdp->out.payload, mdp->out.payload_length);
|
||||
ob_limitsize(payload, mdp->out.payload_length);
|
||||
|
||||
@ -358,7 +364,8 @@ int overlay_mdp_service_stun_req(overlay_mdp_frame *mdp)
|
||||
break;
|
||||
|
||||
if (!subscriber){
|
||||
DEBUGF("Unknown subscriber");
|
||||
if (config.debug.overlayrouting)
|
||||
DEBUGF("Unknown subscriber");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -370,9 +377,9 @@ int overlay_mdp_service_stun_req(overlay_mdp_frame *mdp)
|
||||
reply.out.payload_length=ob_position(replypayload);
|
||||
|
||||
if (reply.out.payload_length){
|
||||
DEBUGF("Sending reply");
|
||||
overlay_mdp_dispatch(&reply,0 /* system generated */,
|
||||
NULL,0);
|
||||
if (config.debug.overlayrouting)
|
||||
DEBUGF("Sending reply");
|
||||
overlay_mdp_dispatch(&reply,0 /* system generated */, NULL,0);
|
||||
}
|
||||
ob_free(replypayload);
|
||||
ob_free(payload);
|
||||
@ -383,9 +390,10 @@ int overlay_mdp_service_stun(overlay_mdp_frame *mdp)
|
||||
{
|
||||
struct overlay_buffer *buff = ob_static(mdp->out.payload, mdp->out.payload_length);
|
||||
ob_limitsize(buff, mdp->out.payload_length);
|
||||
|
||||
DEBUGF("Processing STUN info from %s", alloca_tohex_sid(mdp->out.src.sid));
|
||||
|
||||
|
||||
if (config.debug.overlayrouting)
|
||||
DEBUGF("Processing STUN info from %s", alloca_tohex_sid(mdp->out.src.sid));
|
||||
|
||||
while(ob_remaining(buff)>0){
|
||||
struct subscriber *subscriber=NULL;
|
||||
struct sockaddr_in addr;
|
||||
@ -439,7 +447,8 @@ int overlay_send_stun_request(struct subscriber *server, struct subscriber *requ
|
||||
struct overlay_buffer *payload = ob_static(mdp.out.payload, sizeof(mdp.out.payload));
|
||||
overlay_address_append(NULL, payload, request);
|
||||
mdp.out.payload_length=ob_position(payload);
|
||||
DEBUGF("Sending STUN request to %s", alloca_tohex_sid(server->sid));
|
||||
if (config.debug.overlayrouting)
|
||||
DEBUGF("Sending STUN request to %s", alloca_tohex_sid(server->sid));
|
||||
overlay_mdp_dispatch(&mdp,0 /* system generated */,
|
||||
NULL,0);
|
||||
ob_free(payload);
|
||||
|
Loading…
Reference in New Issue
Block a user