Commit c5608fbc authored by Alessandro Rubini's avatar Alessandro Rubini

msg_unpack_header(): receive packet length too

I'm adding generic dump code to the receive and send code paths,
so I need the length of the incoming frame when first "unpacking" it,
to dump the whole frame using code from tools/dump-funcs.c
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 590c65ec
......@@ -87,7 +87,7 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
*/
if (plen) {
if (plen >= PP_HEADER_LENGTH)
err = msg_unpack_header(ppi, packet);
err = msg_unpack_header(ppi, packet, plen);
else
err = 1;
if (err) {
......
......@@ -241,7 +241,7 @@ extern int bmc(struct pp_instance *ppi);
/* msg.c */
extern void msg_pack_header(struct pp_instance *ppi, void *buf);
extern int __attribute__((warn_unused_result))
msg_unpack_header(struct pp_instance *ppi, void *buf);
msg_unpack_header(struct pp_instance *ppi, void *buf, int plen);
void *msg_copy_header(MsgHeader *dest, MsgHeader *src);
extern void msg_pack_sync(struct pp_instance *ppi, Timestamp *orig_tstamp);
extern void msg_unpack_sync(void *buf, MsgSync *sync);
......
......@@ -88,7 +88,7 @@ static void msg_display_announce(MsgAnnounce *announce)
}
/* Unpack header from in buffer to msg_tmp_header field */
int msg_unpack_header(struct pp_instance *ppi, void *buf)
int msg_unpack_header(struct pp_instance *ppi, void *buf, int plen)
{
MsgHeader *hdr = &ppi->received_ptp_header;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment