From ae41fa0f684970c5d75a1dd6a59622a42baf6636 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Fri, 30 Nov 2012 10:11:36 +0100 Subject: [PATCH] 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 --- udp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/udp.c b/udp.c index e16030d..cf73411 100644 --- a/udp.c +++ b/udp.c @@ -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_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)); if (cnt < 1) { pr_err("sendto failed: %m");