debugging output tweaks.

This commit is contained in:
gardners 2012-04-30 06:01:34 +09:30
parent cdb8c702bd
commit 03aa6cbf49
3 changed files with 25 additions and 16 deletions

View File

@ -296,13 +296,13 @@ int overlay_frame_process(int interface,overlay_frame *f)
if (f->source_address_status!=OA_RESOLVED) {
if (debug&DEBUG_OVERLAYFRAMES) WHY("Source address could not be resolved, so dropping frame.");
return -1;
return WHY("could not resolve source address");
}
if (overlay_address_is_local(f->source))
{
if (debug&DEBUG_OVERLAYROUTING)
WHY("Dropping frame claiming to come from myself.");
return -1;
return WHY("dropping frame claiming to be from myself");
}
if (f->destination_address_status==OA_RESOLVED) {
@ -311,7 +311,7 @@ int overlay_frame_process(int interface,overlay_frame *f)
if (overlay_address_is_local(f->destination)) ultimatelyForMe=1;
} else {
if (debug&DEBUG_OVERLAYFRAMES) WHY("Destination address could not be resolved, so dropping frame.");
return -1;
return WHY("could not resolve destination address");
}
}

View File

@ -248,7 +248,9 @@ int overlay_abbreviate_address(unsigned char *in,unsigned char *out,int *ofs)
/* Try repeating previous address */
for(i=0;i<SID_SIZE;i++) if (in[i]!=overlay_abbreviate_previous_address.b[i]) break;
if (i==SID_SIZE) { out[(*ofs)++]=OA_CODE_PREVIOUS; return 0; }
if (i==SID_SIZE) {
out[(*ofs)++]=OA_CODE_PREVIOUS;
return 0; }
/* Is it a broadcast address? */
if (overlay_address_is_broadcast(in)) {

View File

@ -674,6 +674,7 @@ int overlay_route_node_can_hear_me(unsigned char *who,int sender_interface,
/* Ignore traffic from ourselves. */
if (overlay_address_is_local(who))
{
WHY("I can hear myself. How odd");
return 0;
}
@ -894,10 +895,6 @@ int overlay_route_recalc_neighbour_metrics(overlay_neighbour *n,long long now)
the announcements on. */
for(i=0;i<OVERLAY_MAX_OBSERVATIONS;i++) {
if (n->observations[i].valid&&n->observations[i].s1) {
/* Check the observation age, and ignore if too old */
int obs_age=now-n->observations[i].time_ms;
if (obs_age>200000) continue;
/* Work out the interval covered by the observation.
The times are represented as lowest 32 bits of a 64-bit
millisecond clock. This introduces modulo problems,
@ -905,6 +902,12 @@ int overlay_route_recalc_neighbour_metrics(overlay_neighbour *n,long long now)
most of them. */
unsigned int interval=n->observations[i].s2-n->observations[i].s1;
/* Check the observation age, and ignore if too old */
int obs_age=now-n->observations[i].time_ms;
WHYF("tallying obs: %dms old, %dms long",
obs_age,interval);
if (obs_age>200000) continue;
/* Ignore very large intervals (>1hour) as being likely to be erroneous.
(or perhaps a clock wrap due to the modulo arithmatic)
@ -1018,9 +1021,9 @@ char *overlay_render_sid_prefix(unsigned char *sid,int l)
*/
int overlay_route_saw_selfannounce_ack(int interface,overlay_frame *f,long long now)
{
if (1) WHYF("processing selfannounce ack (payload length=%d)",f->payload->length);
if (0) WHYF("processing selfannounce ack (payload length=%d)",f->payload->length);
if (!overlay_neighbours) {
if (1) WHY("no neighbours, so returning immediately");
if (0) WHY("no neighbours, so returning immediately");
return 0;
}
@ -1034,6 +1037,8 @@ int overlay_route_saw_selfannounce_ack(int interface,overlay_frame *f,long long
// Call something like the following for each link
if (f->source_address_status==OA_RESOLVED&&
f->destination_address_status==OA_RESOLVED) {
if (0) WHYF("f->source=%s, f->destination=%s",
overlay_render_sid(f->source),overlay_render_sid(f->destination));
overlay_route_record_link(now,f->source,f->source,iface,s1,s2,
0 /* no associated score */,
0 /* no gateways in between */);
@ -1051,9 +1056,9 @@ int overlay_route_record_link(long long now,unsigned char *to,
{
int i,slot=-1;
if (1) WHYF("to=%s, via=%s, iface=%d",
if (0) WHYF("to=%s, via=%s, iface=%d, s1=%d, s2=%d",
overlay_render_sid(to),overlay_render_sid(via),
sender_interface);
sender_interface,s1,s2);
if (sender_interface>OVERLAY_MAX_INTERFACES) return 0;
@ -1316,10 +1321,12 @@ int overlay_route_node_info(overlay_mdp_frame *mdp,
int bin,slot,n;
long long now=overlay_gettime_ms();
WHYF("Looking for node %s* (prefix len=0x%x)",
overlay_render_sid_prefix(mdp->nodeinfo.sid,mdp->nodeinfo.sid_prefix_length),
mdp->nodeinfo.sid_prefix_length
);
if (0)
WHYF("Looking for node %s* (prefix len=0x%x)",
overlay_render_sid_prefix(mdp->nodeinfo.sid,
mdp->nodeinfo.sid_prefix_length),
mdp->nodeinfo.sid_prefix_length
);
/* check if it is a local identity */
int cn,in,kp;