On Tue, Apr 24, 2018 at 02:53:38PM +0100, Richard Hill wrote: > > > I am getting a dst NULL pointer here (in port_delay_request) > > if (p->hybrid_e2e) { > struct ptp_message *dst = TAILQ_FIRST(&p->best->messages); > msg->address = dst->address; > msg->header.flagField[0] |= UNICAST; > }
> This appears to be because the list is empty > So is it enough just to add a check for n_messages - eg That would not be wrong, BUT... > Or should the list never be empty at this point ? The list can't be empty. Here is why. The function, port_delay_request(), is called only when FD_DELAY_TIMER expires. That timer is only set by the function, port_set_delay_tmo(), which is called: 1. in process_delay_resp() but only when state is UNCALIBRATED or SLAVE. 2. in port_e2e_transition() but only when state is UNCALIBRATED or SLAVE. Looking at handle_state_decision_event(), a port can only enter UNCALIBRATED or SLAVE when it has a valid foreign master record, ie p->best->messages is not null. A port also only clears p->best->messages when it leaves UNCALIBRATED or SLAVE, at which point the FD_DELAY_TIMER is also cleared. So we have overlooked something... What version are you running? The source is unmodified, right? Thanks, Richard ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-users mailing list Linuxptp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-users