On Thu, Jan 31, 2019 at 01:17:56PM +0000, Vincent Li X wrote:
> 
> Sorry Miroslav! I missed you message yesterday, don't know why it ended up
> in junk box.
> Please see this attached FOLLOW-UP with 6 bytes of non-zero padding (64 - 14
> of eth header - 44 of PDU length).  I don't know the HW NIC information.
> According to 802.3, padding is done at tx/master side and could contain any
> value. 

Ok, so the frame is padded with 6 bytes instead of 2. Maybe they
forgot to count the FCS? That is weird, but probably ok according to
the specs. 

The ethernet transport in ptp4l should be fixed to trim that padding.
Can you please try this patch?

--- a/raw.c
+++ b/raw.c
@@ -259,6 +259,7 @@ static int raw_recv(struct transport *t, int fd, void *buf, 
int buflen,
        unsigned char *ptr = buf;
        struct eth_hdr *hdr;
        struct raw *raw = container_of(t, struct raw, t);
+       struct ptp_message *msg;
 
        if (raw->vlan) {
                hlen = sizeof(struct vlan_hdr);
@@ -276,6 +277,10 @@ static int raw_recv(struct transport *t, int fd, void 
*buf, int buflen,
        if (cnt < 0)
                return cnt;
 
+       msg = buf;
+       if (cnt > ntohs(msg->header.messageLength))
+               cnt = ntohs(msg->header.messageLength);
+
        if (raw->vlan) {
                if (ETH_P_1588 == ntohs(hdr->type)) {
                        pr_notice("raw: disabling VLAN mode");

-- 
Miroslav Lichvar


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to