On Tue, Feb 26, 2019 at 04:04:36PM +0100, Miroslav Lichvar wrote:
> On Thu, Dec 06, 2018 at 09:54:32PM +0800, Hangbin Liu wrote:
> > This patch add team interface activebackup mode support. As linux team use
> > genl netlink message, when we get a rtnl link change notify, we have to 
> > setup
> > a new genl socket and request the current active port.
> 
> I ran some tests with this patch. When the team interface was not
> configured with the activebackup runner, ptp4l refused to start as
> expected.
> 
> It started after configuring the interface to use activebackup.
> 
> When I forced it to switch to another port by setting the active link
> down (I'm not sure if that is the proper way to do it), ptp4l crashes
> on start.
> 
> # ptp4l -m -i nm-team
> ptp4l[270.472]: selected /dev/ptp3 as PTP clock
> ptp4l[270.472]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
> ptp4l[270.473]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
> Segmentation fault (core dumped)
> 
> 0x0000000000418666 in rtnl_link_status (fd=16, device=0x636df8 "nm-team", 
> cb=0x414736 <port_link_status>, ctx=0x63a300)
>     at rtnl.c:251
> 251             for ( ; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len)) {
> (gdb) bt
> #0  0x0000000000418666 in rtnl_link_status (fd=16, device=0x636df8 "nm-team", 
> cb=0x414736 <port_link_status>, ctx=0x63a300)
>     at rtnl.c:251
> #1  0x0000000000414dd1 in bc_event (p=0x63a300, fd_index=10) at port.c:2549
> #2  0x0000000000414a6d in port_event (p=0x63a300, fd_index=10) at port.c:2475
> #3  0x00000000004066c5 in clock_poll (c=0x632680 <the_clock>) at clock.c:1512
> #4  0x000000000040257c in main (argc=4, argv=0x7fffffffd8d8) at ptp4l.c:253
> (gdb) print nh
> $1 = (struct nlmsghdr *) 0xf7e7b950
> (gdb) print len
> $2 = 142329956

Hmm, interesting, before I post the patch, I tested it and it works.

# ./ptp4l -m -H -i team0
ptp4l[3317.750]: selected /dev/ptp4 as PTP clock
ptp4l[3317.751]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[3317.751]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[3324.099]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[3324.099]: selected local clock e41d2d.fffe.123db0 as best master
ptp4l[3324.099]: assuming the grand master role

        -- set enp3s0 down

ptp4l[3342.281]: port 1: ts label changed to enp3s0d1
ptp4l[3342.281]: port 1: MASTER to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
ptp4l[3358.281]: port 1: FAULTY to LISTENING on INIT_COMPLETE
ptp4l[3364.475]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[3364.475]: selected local clock e41d2d.fffe.123db0 as best master
ptp4l[3364.475]: assuming the grand master role

        -- changed to active port enp3s0d1
        -- set enp3s0 up and set enp3s0d1 down

ptp4l[3390.056]: port 1: ts label changed to enp3s0
ptp4l[3390.056]: port 1: MASTER to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
ptp4l[3406.057]: port 1: FAULTY to LISTENING on INIT_COMPLETE
ptp4l[3412.721]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[3412.721]: selected local clock e41d2d.fffe.123db0 as best master
ptp4l[3412.721]: assuming the grand master role

        -- changed to active port enp3s0


Today I tested multi times and found it core dumped twice in 10 times testing.
I will investigate the reason. Thanks for the report.

Thanks
Hangbin


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to