[Linuxptp-users] PTP4L daemon seems to have a problem with to a link local address for IPv6
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Mario M. <mar...@we...> - 2012-11-23 14:33:13
|
Hallo Richard, I have make a observation that the PTP4L daemon seems to have a problem with to a link local address for IPv6 . For IPV6 tests I have changed PTP_PRIMARY_MCAST_IP6ADDR to a link local address. (#define PTP_PRIMARY_MCAST_IP6ADDR "FF02:0:0:0:0:0:0:181") After this change I have saw that the communication and explicit the udp6_send didn't work. I have review the the code of udp6_send and I have saw that the sin6_sopce_id of struct sockaddr_in6 addr is not correct initialize. I have corrected this and the communication problem disappears. --- a/udp6.c +++ b/udp6.c @@ -135,6 +135,8 @@ enum { MC_PRIMARY, MC_PDELAY }; static struct in6_addr mc6_addr[2]; +static unsigned ip6_scope_id; + static int udp6_open(struct transport *t, char *name, struct fdarray *fda, enum timestamp_type ts_type) { @@ -156,7 +158,8 @@ static int udp6_open(struct transport *t, char *name, struct fdarray *fda, if (sk_timestamping_init(efd, name, ts_type, TRANS_UDP_IPV6)) goto no_timestamping; - + + ip6_scope_id = if_nametoindex(name); fda->fd[FD_EVENT] = efd; fda->fd[FD_GENERAL] = gfd; return 0; @@ -181,11 +184,14 @@ static int udp6_send(struct transport *t, struct fdarray *fda, int event, int pe ssize_t cnt; int fd = event ? fda->fd[FD_EVENT] : fda->fd[FD_GENERAL]; struct sockaddr_in6 addr; + memset(&addr, 0, sizeof(struct sockaddr_in6)); /* Init */ + unsigned char junk[1600]; addr.sin6_family = AF_INET6; addr.sin6_addr = peer ? mc6_addr[MC_PDELAY] : mc6_addr[MC_PRIMARY]; addr.sin6_port = htons(event ? EVENT_PORT : GENERAL_PORT); + addr.sin6_scope_id = ip6_scope_id; len += 2; /* Extend the payload by two, for UDP checksum corrections. */ -- Could you please check and review my changes? I appreciate your opinion and ideas. You can find the changes as patch file attached to this email. Best Regards and thanks, Mario |