udp: work around phyter quirk.

The phyter offers one step sync transmission, but it alters the UDP
checksum by changing the last two bytes, after the PTP payload. While this
is only standardized for IPv6, we will go with it for IPv4 as well, since
the phyter is the only hardware out there.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-11-30 10:11:36 +01:00
parent b96e73994b
commit ae41fa0f68
1 changed files with 8 additions and 0 deletions

8
udp.c
View File

@ -190,6 +190,14 @@ static int udp_send(struct transport *t, struct fdarray *fda, int event, int pee
addr.sin_addr = peer ? mcast_addr[MC_PDELAY] : mcast_addr[MC_PRIMARY]; addr.sin_addr = peer ? mcast_addr[MC_PDELAY] : mcast_addr[MC_PRIMARY];
addr.sin_port = htons(event ? EVENT_PORT : GENERAL_PORT); addr.sin_port = htons(event ? EVENT_PORT : GENERAL_PORT);
/*
* Extend the payload by two, for UDP checksum correction.
* This is not really part of the standard, but it is the way
* that the phyter works.
*/
if (event == TRANS_ONESTEP)
len += 2;
cnt = sendto(fd, buf, len, 0, (struct sockaddr *)&addr, sizeof(addr)); cnt = sendto(fd, buf, len, 0, (struct sockaddr *)&addr, sizeof(addr));
if (cnt < 1) { if (cnt < 1) {
pr_err("sendto failed: %m"); pr_err("sendto failed: %m");