From 1d1a6acdc115579b5301de326956b373cbe2e8d8 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Fri, 10 Aug 2012 06:39:06 +0200 Subject: [PATCH] raw: return the length of the PTP message on receive. The upper layer code will be confused by the extra fourteen byte length of the Ethernet header. Signed-off-by: Richard Cochran --- raw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/raw.c b/raw.c index 4f53c49..3f7ffbd 100644 --- a/raw.c +++ b/raw.c @@ -218,10 +218,15 @@ no_mac: static int raw_recv(struct transport *t, int fd, void *buf, int buflen, struct hw_timestamp *hwts) { + int cnt; unsigned char *ptr = buf; ptr -= sizeof(struct eth_hdr); buflen += sizeof(struct eth_hdr); - return sk_receive(fd, ptr, buflen, hwts, 0); + cnt = sk_receive(fd, ptr, buflen, hwts, 0); + if (cnt >= sizeof(struct eth_hdr)) { + cnt -= sizeof(struct eth_hdr); + } + return cnt; } static int raw_send(struct transport *t, struct fdarray *fda, int event, int peer,