On Fri, 19 Jun 2020 at 15:51, Richard Cochran <richardcoch...@gmail.com> wrote:
>
> On Fri, Jun 19, 2020 at 05:13:44AM -0700, Richard Cochran wrote:
> > But the patch does not handle the situation correctly.  This code
> > would dump the frame and carry on as if nothing had happened.  The
> > correct way would be to treat this as a fault on the port in question.
>
> Something like this...
>
> diff --git a/clock.c b/clock.c
> index f43cc2a..b081dc2 100644
> --- a/clock.c
> +++ b/clock.c
> @@ -1559,6 +1559,13 @@ int clock_poll(struct clock *c)
>         LIST_FOREACH(p, &c->ports, list) {
>                 /* Let the ports handle their events. */
>                 for (i = 0; i < N_POLLFD; i++) {
> +                       if (cur[i].revents & POLLERR) {
> +                               pr_err("port %d: unexpected socket error",
> +                                      port_number(p));
> +                               event = EV_FAULT_DETECTED;
> +                               port_dispatch(p, event, 0);

You need to recv() the data. Otherwise, it will remain forever there,
ptp4l will be toast, since this will keep dispatching the fault ad
infinitum.

> +                               continue;
> +                       }
>                         if (cur[i].revents & (POLLIN|POLLPRI)) {
>                                 event = port_event(p, i);
>                                 if (EV_STATE_DECISION_EVENT == event) {

Thanks,
-Vladimir


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

Reply via email to