diff --git a/keyring.c b/keyring.c index f0fb9d1e..d011ad06 100644 --- a/keyring.c +++ b/keyring.c @@ -1132,7 +1132,7 @@ unsigned char *keyring_find_sas_private(keyring_file *k,unsigned char *sid, if (sas_public) *sas_public= k->contexts[cn]->identities[in]->keypairs[kp]->public_key; - if (0) WHYF("Found SAS entry for %s*",overlay_render_sid_prefix(sid,7)); + if (0) DEBUGF("Found SAS entry for %s*", alloca_tohex(sid, 7)); RETURN(k->contexts[cn]->identities[in]->keypairs[kp]->private_key); } @@ -1289,10 +1289,10 @@ unsigned char *keyring_find_sas_public(keyring_file *k,unsigned char *sid) for(i=0;i=0)) diff --git a/overlay.c b/overlay.c index cb9280ef..145caf21 100644 --- a/overlay.c +++ b/overlay.c @@ -309,7 +309,7 @@ int overlay_frame_process(struct overlay_interface *interface,overlay_frame *f) if (overlay_get_nexthop(f->destination,f->nexthop,&len, &f->nexthop_interface)) WHYF("Could not find next hop for %s* - dropping frame", - overlay_render_sid_prefix(f->destination,7)); + alloca_tohex(f->destination, 7)); dontForward=1; } f->ttl--; diff --git a/overlay_interface.c b/overlay_interface.c index c0eca71d..d42ca060 100644 --- a/overlay_interface.c +++ b/overlay_interface.c @@ -920,8 +920,8 @@ int overlay_tick_interface(int i, long long now) { if (debug&DEBUG_QUEUES) DEBUGF("dequeuing %s* -> %s* NOW (queue length=%d)", - overlay_render_sid_prefix((*p)->source,7), - overlay_render_sid_prefix((*p)->destination,7), + alloca_tohex((*p)->source, 7), + alloca_tohex((*p)->destination, 7), overlay_tx[q].length); t=*p; *p=t->next; diff --git a/overlay_mdp.c b/overlay_mdp.c index 2f2843bd..f8599f66 100644 --- a/overlay_mdp.c +++ b/overlay_mdp.c @@ -422,7 +422,7 @@ int overlay_saw_mdp_frame(overlay_mdp_frame *mdp,long long now) if (0) WHYF("Received packet with listener (MDP ports: src=%s*:%d, dst=%d)", - overlay_render_sid_prefix(mdp->out.src.sid,7), + alloca_tohex(mdp->out.src.sid, 7), mdp->out.src.port,mdp->out.dst.port); diff --git a/overlay_payload.c b/overlay_payload.c index 5a7f8b35..0406f448 100644 --- a/overlay_payload.c +++ b/overlay_payload.c @@ -246,7 +246,7 @@ int overlay_payload_enqueue(int q,overlay_frame *p,int forceBroadcastP) */ if (0) WHYF("Enqueuing packet for %s* (q[%d]length = %d)", - overlay_render_sid_prefix(p->destination,7), + alloca_tohex(p->destination, 7), q,overlay_tx[q].length); if (q==OQ_ISOCHRONOUS_VOICE&&(!forceBroadcastP)) { /* Dispatch voice data immediately. diff --git a/overlay_route.c b/overlay_route.c index 7a753b7a..ff54c109 100644 --- a/overlay_route.c +++ b/overlay_route.c @@ -1008,23 +1008,6 @@ int overlay_route_recalc_neighbour_metrics(overlay_neighbour *n,long long now) } -int ors_rotor=0; -char ors_out[4][SID_STRLEN+1]; - -char *overlay_render_sid_prefix(const unsigned char *sid,int l) -{ - int zero=0; - - if (l<0) l=0; - if (l>SID_STRLEN) l=SID_STRLEN; - ors_rotor++; - ors_rotor&=3; - extractSid(sid,&zero,ors_out[ors_rotor]); - ors_out[ors_rotor][l]=0; - return ors_out[ors_rotor]; -} - - /* Self-announcement acks bounce back to the self-announcer from immediate neighbours who report the link score they have calculated based on listening to self-announces @@ -1112,8 +1095,7 @@ int overlay_route_record_link(long long now,unsigned char *to, } DEBUGF("route_record_link(0x%llx,%s*,%s*,0x%08x-0x%08x,%d)", - now,overlay_render_sid_prefix(to,7), - overlay_render_sid_prefix(via,7),s1,s2,score); + now, alloca_tohex(to, 7), alloca_tohex(via, 7), s1, s2, score); overlay_node *n=overlay_route_find_node(to,SID_SIZE,1 /* create node if missing */); if (!n) return WHY("Could not find or create entry for node"); @@ -1199,8 +1181,8 @@ int overlay_route_dump() if (overlay_neighbours[n].node) { strbuf_sprintf(b," %s* : %lldms ago :", - overlay_render_sid_prefix(overlay_neighbours[n].node->sid,7), - (now-overlay_neighbours[n].last_observation_time_ms)); + alloca_tohex(overlay_neighbours[n].node->sid, 7), + now - overlay_neighbours[n].last_observation_time_ms); for(i=0;icorrected_score) strbuf_sprintf(b," %d/%d via %s*", ob->corrected_score,ob->gateways_en_route, - overlay_render_sid_prefix(ob->sender_prefix,7)); + alloca_tohex(ob->sender_prefix, 7)); } } strbuf_sprintf(b,"\n"); @@ -1358,8 +1340,7 @@ int overlay_route_node_info(overlay_mdp_frame *mdp, if (0) DEBUGF("Looking for node %s* (prefix len=0x%x)", - overlay_render_sid_prefix(mdp->nodeinfo.sid, - mdp->nodeinfo.sid_prefix_length), + alloca_tohex(mdp->nodeinfo.sid, mdp->nodeinfo.sid_prefix_length), mdp->nodeinfo.sid_prefix_length ); diff --git a/rhizome.c b/rhizome.c index 0d0ac03a..858ce3e6 100644 --- a/rhizome.c +++ b/rhizome.c @@ -342,7 +342,7 @@ int rhizome_add_manifest(rhizome_manifest *m_in,int ttl) return WHY("rhizome_store_bundle() failed."); DEBUGF("Announcing arrival of manifest %s* version %lld", - overlay_render_sid_prefix(m_in->cryptoSignPublic,8),m_in->version); + alloca_tohex(m_in->cryptoSignPublic, 8), m_in->version); monitor_announce_bundle(m_in); return 0; } diff --git a/rhizome_packetformats.c b/rhizome_packetformats.c index ef445da9..215227cd 100644 --- a/rhizome_packetformats.c +++ b/rhizome_packetformats.c @@ -238,7 +238,7 @@ int overlay_rhizome_add_advertisements(int interface_number,overlay_buffer *e) long long version = rhizome_manifest_get_ll(m, "version"); DEBUGF("Stop cramming %s advertisements: not enough space for %s*:v%lld (%d bytes, size limit=%d, used=%d)", pass?"BARs":"manifests", - overlay_render_sid_prefix(m->cryptoSignPublic,8), + alloca_tohex(m->cryptoSignPublic, 8), version, blob_bytes,e->sizeLimit,e->length); rhizome_manifest_free(m); @@ -277,7 +277,7 @@ int overlay_rhizome_add_advertisements(int interface_number,overlay_buffer *e) (m, (char *)&e->bytes[e->length+overhead], blob_bytes); long long version = rhizome_manifest_get_ll(m, "version"); WHYF("Advertising manifest %s* version %lld", - overlay_render_sid_prefix(m->cryptoSignPublic,8), + alloca_tohex(m->cryptoSignPublic, 8), version); rhizome_manifest_free(m); } diff --git a/serval.h b/serval.h index b20be912..d3d7eced 100755 --- a/serval.h +++ b/serval.h @@ -1343,7 +1343,6 @@ int overlay_mdp_dispatch(overlay_mdp_frame *mdp,int userGeneratedFrameP, int ob_bcopy(overlay_buffer *b,int from, int to, int len); int ob_setbyte(overlay_buffer *b,int ofs,unsigned char value); -char *overlay_render_sid_prefix(const unsigned char *sid,int l); int dump_payload(overlay_frame *p,char *message); int urandombytes(unsigned char *x,unsigned long long xlen); diff --git a/vomp.c b/vomp.c index daa0f6b2..a7ceab5a 100644 --- a/vomp.c +++ b/vomp.c @@ -1198,8 +1198,8 @@ int app_vomp_status(int argc, const char *const *argv, struct command_line_optio mdp2.vompevent.call_session_token); else { fprintf(stderr,"%s* -> %s* (%s -> %s)", - overlay_render_sid_prefix(mdp2.vompevent.local_sid,6), - overlay_render_sid_prefix(mdp2.vompevent.remote_sid,6), + alloca_tohex(mdp2.vompevent.local_sid, 6), + alloca_tohex(mdp2.vompevent.remote_sid, 6), strlen(mdp2.vompevent.local_did) ?mdp2.vompevent.local_did:"", strlen(mdp2.vompevent.remote_did)