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
parent
6def1b06ad
commit
1d1a6acdc1
7
raw.c
7
raw.c
|
@ -218,10 +218,15 @@ no_mac:
|
||||||
static int raw_recv(struct transport *t, int fd, void *buf, int buflen,
|
static int raw_recv(struct transport *t, int fd, void *buf, int buflen,
|
||||||
struct hw_timestamp *hwts)
|
struct hw_timestamp *hwts)
|
||||||
{
|
{
|
||||||
|
int cnt;
|
||||||
unsigned char *ptr = buf;
|
unsigned char *ptr = buf;
|
||||||
ptr -= sizeof(struct eth_hdr);
|
ptr -= sizeof(struct eth_hdr);
|
||||||
buflen += 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,
|
static int raw_send(struct transport *t, struct fdarray *fda, int event, int peer,
|
||||||
|
|
Loading…
Reference in New Issue