From 26f39660028786391728953279dbfb3f02acc760 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Fri, 25 May 2012 09:55:56 +0930 Subject: [PATCH] Ignore node info results from incorrect sid's --- commandline.c | 53 +++++++++++++++++++++++++++++++------------------ overlay_mdp.c | 2 +- overlay_route.c | 2 ++ 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/commandline.c b/commandline.c index f972a4a8..061799d8 100644 --- a/commandline.c +++ b/commandline.c @@ -1529,30 +1529,45 @@ int app_node_info(int argc, const char *const *argv, struct command_line_option m2.out.payload[0]=0; m2.out.payload_length=1; - if (!overlay_mdp_send(&m2,MDP_AWAITREPLY,125)) - { - int bytes=m2.in.payload_length; - if (m2.packetTypeAndFlags!=MDP_TX) { - WHYF("MDP returned an unexpected message (type=0x%x)", - m2.packetTypeAndFlags); - if (m2.packetTypeAndFlags==MDP_ERROR) - WHYF("MDP message is return/error: %d:%s", - m2.error.error,m2.error.message); - } - if ((bytes+1)=sizeof(mdp.nodeinfo.did)+sizeof(mdp.nodeinfo.name)){ + WHYF("Result is too large"); + continue; + } + bcopy(&m2.in.payload[0],&mdp.nodeinfo.did[0],32); + bcopy(&m2.in.payload[32],&mdp.nodeinfo.name[0],64); + mdp.nodeinfo.did[bytes]=0; + mdp.nodeinfo.resolve_did=1; + break; } } } diff --git a/overlay_mdp.c b/overlay_mdp.c index 23297d7a..bdbaa935 100644 --- a/overlay_mdp.c +++ b/overlay_mdp.c @@ -218,7 +218,7 @@ int overlay_mdp_process_bind_request(int sock,overlay_mdp_frame *mdp, mdp_bindings_initialised=1; } - DEBUG("Doesn't authenticate source address on multi-SID installations like an OpenBTS:mesh gateway)"); +// DEBUG("Doesn't authenticate source address on multi-SID installations like an OpenBTS:mesh gateway)"); /* Make sure source address is either all zeros (listen on all), or a valid local address */ diff --git a/overlay_route.c b/overlay_route.c index b733bf18..910cb51c 100644 --- a/overlay_route.c +++ b/overlay_route.c @@ -1367,6 +1367,8 @@ int overlay_route_node_info(overlay_mdp_frame *mdp, mdp->nodeinfo.sid_prefix_length ); + mdp->nodeinfo.foundP=0; + /* check if it is a local identity */ int cn,in,kp; for(cn=0;cncontext_count;cn++)