Re: [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: Richard C. <ric...@gm...> - 2012-11-24 20:07:10
|
On Fri, Nov 23, 2012 at 03:33:03PM +0100, Mario Molitor wrote: > 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") Why do you think this should be a link local address? (I chose the global scope in order to maximise the chance of reaching a master when running slave, and vice versa. I confess that I don't really know what scope is correct to use here.) > 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. Are you running E2E mode? It looks like we will have to set sin6_scope_id for the Pdelay messages in P2P mode in any case. I will do some testing on this to find out. > > 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); This won't work if you have more than one port. The particular index must be remembered in a private field derived from the struct transport. > 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 */ This makes sense in any case. Better to use variable name, and the comment isn't helpful. memset(&addr, 0, sizeof(addr)); > + ^ That is a stray tab. Thanks, Richard |