"id peers" now returns something!

This commit is contained in:
gardners 2012-04-30 06:16:03 +09:30
parent 03aa6cbf49
commit c3fe7ee8e3
3 changed files with 18 additions and 4 deletions

@ -1161,6 +1161,8 @@ int app_id_self(int argc, const char *const *argv, struct command_line_option *o
return WHY("MDP Server returned something other than an address list");
int i;
WHYF("first_sid=%d, last_sid=%d",a.addrlist.first_sid,a.addrlist.last_sid);
WHYF("frame_sid_count=%d, server_sid_count=%d",
a.addrlist.frame_sid_count,a.addrlist.server_sid_count);
for(i=0;i<a.addrlist.frame_sid_count;i++) {
count++;
cli_printf("%s",overlay_render_sid(a.addrlist.sids[i])); cli_delim("\n");

@ -296,13 +296,15 @@ 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 WHY("could not resolve source address");
return -1;
}
if (overlay_address_is_local(f->source))
{
/* not that noteworthy, as when listening to a broadcast socket
you hear everything you send. */
if (debug&DEBUG_OVERLAYROUTING)
WHY("Dropping frame claiming to come from myself.");
return WHY("dropping frame claiming to be from myself");
return -1;
}
if (f->destination_address_status==OA_RESOLVED) {

@ -942,7 +942,8 @@ int overlay_mdp_poll()
/* from peer list */
overlay_route_dump();
int bin,slot;
int i=0,count=0;
i=0;
count=0;
WHYF("max_sids=%d, sid_num=%d",max_sids,sid_num);
for(bin=0;bin<overlay_bin_count;bin++)
for(slot=0;slot<overlay_bin_size;slot++)
@ -950,15 +951,24 @@ int overlay_mdp_poll()
if (!overlay_nodes[bin][slot].sid[0])
{
continue; }
if ((count>=sid_num)&&(i<max_sids))
WHYF("Considering returning %s* count=%d, sid_num=%d, i=%d, max_sids=%d",
overlay_render_sid_prefix(&overlay_nodes[bin][slot].sid[0],7),
count,sid_num,i,max_sids);
if ((count>=sid_num)&&(i<max_sids)) {
bcopy(overlay_nodes[bin][slot].sid,
mdpreply.addrlist.sids[i++],SID_SIZE);
}
count++;
}
}
mdpreply.addrlist.frame_sid_count=i;
mdpreply.addrlist.last_sid=sid_num+i-1;
mdpreply.addrlist.server_sid_count=count;
WHYF("frame_sid_count=%d, last_sid=%d, server_sid_count=%d",
mdpreply.addrlist.frame_sid_count,
mdpreply.addrlist.last_sid,
mdpreply.addrlist.server_sid_count);
/* Send back to caller */
return overlay_mdp_reply(mdp_named_socket,