Fix replying to broadcast mdp ping

This commit is contained in:
Jeremy Lakeman 2012-10-09 17:03:17 +10:30
parent 5d553538e7
commit 1de2bc8f23
2 changed files with 5 additions and 6 deletions

View File

@ -796,10 +796,10 @@ int app_mdp_ping(int argc, const char *const *argv, struct command_line_option *
if (broadcast) mdp.packetTypeAndFlags|=MDP_NOCRYPT;
mdp.out.src.port=port;
bcopy(srcsid,mdp.out.src.sid,SID_SIZE);
bcopy(ping_sid,&mdp.out.dst.sid[0],SID_SIZE);
bcopy(ping_sid,mdp.out.dst.sid,SID_SIZE);
mdp.out.queue=OQ_MESH_MANAGEMENT;
/* Set port to well known echo port (from /etc/services) */
mdp.out.dst.port=7;
/* Set port to well known echo port */
mdp.out.dst.port=MDP_PORT_ECHO;
mdp.out.payload_length=4+8;
int *seq=(int *)&mdp.out.payload;
*seq=sequence_number;

View File

@ -377,9 +377,8 @@ int overlay_saw_mdp_containing_frame(struct overlay_frame *f, time_ms_t now)
if (f->destination)
bcopy(f->destination->sid,mdp.in.dst.sid,SID_SIZE);
else{
// pack the broadcast address into the mdp structure
memset(mdp.in.dst.sid, 0xFF, SID_SIZE - BROADCAST_LEN);
bcopy(f->broadcast_id.id, mdp.in.dst.sid + SID_SIZE - BROADCAST_LEN, BROADCAST_LEN);
// pack the broadcast address into the mdp structure, note that we no longer care about the broadcast id
memset(mdp.in.dst.sid, 0xFF, SID_SIZE);
}
bcopy(f->source->sid,mdp.in.src.sid,SID_SIZE);