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 <richardcochran@gmail.com>
master
Richard Cochran 2012-08-10 06:39:06 +02:00
parent 6def1b06ad
commit 1d1a6acdc1
1 changed files with 6 additions and 1 deletions

7
raw.c
View File

@ -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,