mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-21 22:17:53 +00:00
Ignore node info results from incorrect sid's
This commit is contained in:
parent
c847478140
commit
26f3966002
@ -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))
|
||||
{
|
||||
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;
|
||||
} else {
|
||||
if (overlay_mdp_send(&m2,MDP_AWAITREPLY,125)){
|
||||
if (0) {
|
||||
WHY("Poll for DNA number resolution failed");
|
||||
if (m2.packetTypeAndFlags==MDP_ERROR)
|
||||
WHYF("error.error=%d, error.message=%s",m2.error.error,m2.error.message);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
|
||||
// we might receive a response from an ealier request
|
||||
// TODO, don't send another query just yet, we should try to receieve another response first
|
||||
if (memcmp(&m2.in.src.sid[0],&mdp.nodeinfo.sid[0],SID_SIZE)){
|
||||
WHYF("Unexpected result from SID %s", overlay_render_sid(m2.in.src.sid));
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
int bytes=m2.in.payload_length;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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;cn<keyring->context_count;cn++)
|
||||
|
Loading…
Reference in New Issue
Block a user