Hi Richard, That "generosity" seems not to be so right. For instance, you receive a gift from you grandma living in another city, given below conditions: 1. The courier company opened the gift wrap and changed the wish-words in the Xmas-card written by grandma. i.e. the header.messageLength is wrong. 2. The local office of courier company just replaced the pack box and bubbled plastic padding. i.e. our case that ETH PHY replaces padding and FCS. 3. Next year, grandma will send a gift of smaller size, but the shipment company will pack it with a box of same size. i.e. smaller PTP messages in future.
You would accept and say "thank you" to the delivery man in case #1, while reject #2 and #3. Hopefully I don't make it less understandable. :) Happy Chinese Spring Festival to all! Vincent -----Original Message----- From: Richard Cochran <richardcoch...@gmail.com> Sent: Friday, February 1, 2019 5:19 PM To: Vincent Li X <vincent.x...@ericsson.com> Cc: Jiri Benc <jb...@redhat.com>; Miroslav Lichvar <mlich...@redhat.com>; Mats Bergman H <mats.h.berg...@ericsson.com>; Richard Jönsson <richard.jons...@ericsson.com>; Linuxptp-devel@lists.sourceforge.net Subject: Re: [Linuxptp-devel] ptp4l wrongly takes padding bytes as TLV? On Fri, Feb 01, 2019 at 08:16:41AM -0800, Richard Cochran wrote: > On Fri, Feb 01, 2019 at 10:16:53AM +0000, Vincent Li X wrote: > > > > Hi Richard, > > I mean the change of that two lines to like: > > if (cnt < m->header.messageLength || m->header.messageLength < > > pdulen) { > > pr_debug("wrong length, cnt: %d messageLength: %hu pdulen > > The rule in communication is to be strict when sending, but generous > when receiving. This code generously allows incorrect messageLength. By "this" I mean the current linuxptp code, not the your example! > That field is redundant, because all of the transports already provide > the packet length. Thus there is no need to check it. > > If we were using a stream transport like TCP, then checking > messageLength would of course be essential. > > Thanks, > Richard > >
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel