>  
> 
> 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?

Version is unmodified 1.8 

What might be relevant is the type of testing I was doing. This was
operating slaveOnly.  Other Masters were appearing and disappearing quite
often.  I had this NULL pointer twice over a full day.



------------------------------------------------------------------------------
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

Reply via email to