mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 02:39:44 +00:00
Set incoming packet length
This commit is contained in:
parent
3b55643b08
commit
dc686ad10b
@ -413,6 +413,8 @@ int overlay_saw_mdp_containing_frame(struct overlay_frame *f, time_ms_t now)
|
|||||||
overlay_mdp_frame mdp;
|
overlay_mdp_frame mdp;
|
||||||
int len=f->payload->sizeLimit;
|
int len=f->payload->sizeLimit;
|
||||||
|
|
||||||
|
if (len<10) RETURN(WHY("Invalid MDP frame"));
|
||||||
|
|
||||||
/* Get source and destination addresses */
|
/* Get source and destination addresses */
|
||||||
if (f->destination)
|
if (f->destination)
|
||||||
bcopy(f->destination->sid,mdp.in.dst.sid,SID_SIZE);
|
bcopy(f->destination->sid,mdp.in.dst.sid,SID_SIZE);
|
||||||
@ -423,8 +425,6 @@ int overlay_saw_mdp_containing_frame(struct overlay_frame *f, time_ms_t now)
|
|||||||
}
|
}
|
||||||
bcopy(f->source->sid,mdp.in.src.sid,SID_SIZE);
|
bcopy(f->source->sid,mdp.in.src.sid,SID_SIZE);
|
||||||
|
|
||||||
if (len<10) RETURN(WHY("Invalid MDP frame"));
|
|
||||||
|
|
||||||
/* copy crypto flags from frame so that we know if we need to decrypt or verify it */
|
/* copy crypto flags from frame so that we know if we need to decrypt or verify it */
|
||||||
if (overlay_mdp_decrypt(f,&mdp))
|
if (overlay_mdp_decrypt(f,&mdp))
|
||||||
RETURN(-1);
|
RETURN(-1);
|
||||||
|
@ -173,6 +173,7 @@ static void olsr_read(struct sched_ent *alarm){
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct overlay_buffer *b = ob_static(buff, msg_len);
|
struct overlay_buffer *b = ob_static(buff, msg_len);
|
||||||
|
ob_limitsize(b, msg_len);
|
||||||
parse_frame(b);
|
parse_frame(b);
|
||||||
|
|
||||||
ob_free(b);
|
ob_free(b);
|
||||||
|
Loading…
Reference in New Issue
Block a user