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


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

Reply via email to