As of 510777deca1d message layer no longer returns -ETIME. Callers of
msg_post_recv() are expected to check for missing time stamps themselves,
but the message duplication function followed the obsolete code pattern
of expecting that msg_post_recv() performs the check. This patch fixes
the method to check properly for this error condition.
Fixes: 51b540875fab ("msg: Introduce a method to copy a message.")
Signed-off-by: Richard Cochran <[email protected]>
---
msg.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/msg.c b/msg.c
index a4a44fd..090715b 100644
--- a/msg.c
+++ b/msg.c
@@ -315,10 +315,6 @@ struct ptp_message *msg_duplicate(struct ptp_message *msg,
int cnt)
case -EBADMSG:
pr_err("msg_duplicate: bad message");
break;
- case -ETIME:
- pr_err("msg_duplicate: received %s without timestamp",
- msg_type_string(msg_type(msg)));
- break;
case -EPROTO:
pr_debug("msg_duplicate: ignoring message");
break;
@@ -326,6 +322,13 @@ struct ptp_message *msg_duplicate(struct ptp_message *msg,
int cnt)
msg_put(dup);
return NULL;
}
+ if (msg_sots_missing(msg)) {
+ pr_err("msg_duplicate: received %s without timestamp",
+ msg_type_string(msg_type(msg)));
+ msg_put(dup);
+ return NULL;
+ }
+
return dup;
}
--
2.11.0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel