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:
Andrew Bettison 2013-02-15 10:30:23 +10:30
parent c42260f5f9
commit e856cafc97

View File

@ -171,6 +171,7 @@ int resolve_name(const char *name, struct in_addr *addr){
if (addresses->ai_addr->sa_family==AF_INET){ if (addresses->ai_addr->sa_family==AF_INET){
*addr = ((struct sockaddr_in *)addresses->ai_addr)->sin_addr; *addr = ((struct sockaddr_in *)addresses->ai_addr)->sin_addr;
if (config.debug.overlayrouting)
DEBUGF("Resolved %s into %s", name, inet_ntoa(*addr)); DEBUGF("Resolved %s into %s", name, inet_ntoa(*addr));
}else }else
@ -210,6 +211,7 @@ int load_subscriber_address(struct subscriber *subscriber)
return 1; return 1;
} }
} }
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)); 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); return overlay_send_probe(subscriber, addr, interface, OQ_MESH_MANAGEMENT);
} }
@ -291,6 +293,7 @@ int overlay_send_probe(struct subscriber *peer, struct sockaddr_in addr, overlay
op_free(frame); op_free(frame);
return -1; return -1;
} }
if (config.debug.overlayrouting)
DEBUGF("Queued probe packet on interface %s to %s:%d for %s", 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"); interface->name, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port), peer?alloca_tohex_sid(peer->sid):"ANY");
return 0; return 0;
@ -300,6 +303,7 @@ 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) static int overlay_append_unicast_address(struct subscriber *subscriber, struct overlay_buffer *buff)
{ {
if (subscriber->reachable & REACHABLE_ASSUMED || !(subscriber->reachable & REACHABLE_UNICAST)){ if (subscriber->reachable & REACHABLE_ASSUMED || !(subscriber->reachable & REACHABLE_UNICAST)){
if (config.debug.overlayrouting)
DEBUGF("Unable to give address of %s, %d", alloca_tohex_sid(subscriber->sid),subscriber->reachable); DEBUGF("Unable to give address of %s, %d", alloca_tohex_sid(subscriber->sid),subscriber->reachable);
return 0; return 0;
} }
@ -311,6 +315,7 @@ static int overlay_append_unicast_address(struct subscriber *subscriber, struct
if (ob_append_ui16(buff, subscriber->address.sin_port)) if (ob_append_ui16(buff, subscriber->address.sin_port))
return -1; return -1;
ob_checkpoint(buff); ob_checkpoint(buff);
if (config.debug.overlayrouting)
DEBUGF("Added STUN info for %s", alloca_tohex_sid(subscriber->sid)); DEBUGF("Added STUN info for %s", alloca_tohex_sid(subscriber->sid));
return 0; return 0;
} }
@ -333,6 +338,7 @@ static int overlay_append_unicast_address(struct subscriber *subscriber, struct
int overlay_mdp_service_stun_req(overlay_mdp_frame *mdp) int overlay_mdp_service_stun_req(overlay_mdp_frame *mdp)
{ {
if (config.debug.overlayrouting)
DEBUGF("Processing STUN request from %s", alloca_tohex_sid(mdp->out.src.sid)); 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); struct overlay_buffer *payload = ob_static(mdp->out.payload, mdp->out.payload_length);
@ -358,6 +364,7 @@ int overlay_mdp_service_stun_req(overlay_mdp_frame *mdp)
break; break;
if (!subscriber){ if (!subscriber){
if (config.debug.overlayrouting)
DEBUGF("Unknown subscriber"); DEBUGF("Unknown subscriber");
continue; continue;
} }
@ -370,9 +377,9 @@ int overlay_mdp_service_stun_req(overlay_mdp_frame *mdp)
reply.out.payload_length=ob_position(replypayload); reply.out.payload_length=ob_position(replypayload);
if (reply.out.payload_length){ if (reply.out.payload_length){
if (config.debug.overlayrouting)
DEBUGF("Sending reply"); DEBUGF("Sending reply");
overlay_mdp_dispatch(&reply,0 /* system generated */, overlay_mdp_dispatch(&reply,0 /* system generated */, NULL,0);
NULL,0);
} }
ob_free(replypayload); ob_free(replypayload);
ob_free(payload); ob_free(payload);
@ -384,6 +391,7 @@ int overlay_mdp_service_stun(overlay_mdp_frame *mdp)
struct overlay_buffer *buff = ob_static(mdp->out.payload, mdp->out.payload_length); struct overlay_buffer *buff = ob_static(mdp->out.payload, mdp->out.payload_length);
ob_limitsize(buff, mdp->out.payload_length); ob_limitsize(buff, mdp->out.payload_length);
if (config.debug.overlayrouting)
DEBUGF("Processing STUN info from %s", alloca_tohex_sid(mdp->out.src.sid)); DEBUGF("Processing STUN info from %s", alloca_tohex_sid(mdp->out.src.sid));
while(ob_remaining(buff)>0){ while(ob_remaining(buff)>0){
@ -439,6 +447,7 @@ int overlay_send_stun_request(struct subscriber *server, struct subscriber *requ
struct overlay_buffer *payload = ob_static(mdp.out.payload, sizeof(mdp.out.payload)); struct overlay_buffer *payload = ob_static(mdp.out.payload, sizeof(mdp.out.payload));
overlay_address_append(NULL, payload, request); overlay_address_append(NULL, payload, request);
mdp.out.payload_length=ob_position(payload); mdp.out.payload_length=ob_position(payload);
if (config.debug.overlayrouting)
DEBUGF("Sending STUN request to %s", alloca_tohex_sid(server->sid)); DEBUGF("Sending STUN request to %s", alloca_tohex_sid(server->sid));
overlay_mdp_dispatch(&mdp,0 /* system generated */, overlay_mdp_dispatch(&mdp,0 /* system generated */,
NULL,0); NULL,0);