Blame 08-filter-timers.patch
|
|
63b4e9 |
diff --git a/port.c b/port.c
|
|
|
63b4e9 |
index eaf77e6..4debbe1 100644
|
|
|
63b4e9 |
--- a/port.c
|
|
|
63b4e9 |
+++ b/port.c
|
|
|
63b4e9 |
@@ -2767,12 +2767,35 @@ enum fsm_event port_event(struct port *p, int fd_index)
|
|
|
63b4e9 |
return p->event(p, fd_index);
|
|
|
63b4e9 |
}
|
|
|
63b4e9 |
|
|
|
63b4e9 |
+static int port_check_tmo_valid(struct port *p, int fd_index)
|
|
|
63b4e9 |
+{
|
|
|
63b4e9 |
+ struct itimerspec tms;
|
|
|
63b4e9 |
+
|
|
|
63b4e9 |
+ if (fd_index < FD_FIRST_TIMER || fd_index >= (FD_FIRST_TIMER + N_TIMER_FDS))
|
|
|
63b4e9 |
+ return 1;
|
|
|
63b4e9 |
+
|
|
|
63b4e9 |
+ /* return valid if we somehow end up quering non-timer fd */
|
|
|
63b4e9 |
+ if (timerfd_gettime(p->fda.fd[fd_index], &tms) < 0)
|
|
|
63b4e9 |
+ return 1;
|
|
|
63b4e9 |
+ /* timer was not updated, expire valid */
|
|
|
63b4e9 |
+ if (tms.it_value.tv_sec == 0 && tms.it_value.tv_nsec == 0)
|
|
|
63b4e9 |
+ return 1;
|
|
|
63b4e9 |
+
|
|
|
63b4e9 |
+ /* timer was updated by new message read from the sockets */
|
|
|
63b4e9 |
+ pr_notice("%s: Timer %d expired, but was already updated, ignore",
|
|
|
63b4e9 |
+ p->log_name, fd_index);
|
|
|
63b4e9 |
+ return 0;
|
|
|
63b4e9 |
+}
|
|
|
63b4e9 |
+
|
|
|
63b4e9 |
static enum fsm_event bc_event(struct port *p, int fd_index)
|
|
|
63b4e9 |
{
|
|
|
63b4e9 |
enum fsm_event event = EV_NONE;
|
|
|
63b4e9 |
struct ptp_message *msg;
|
|
|
63b4e9 |
int cnt, fd = p->fda.fd[fd_index], err;
|
|
|
63b4e9 |
|
|
|
63b4e9 |
+ if (!port_check_tmo_valid(p, fd_index))
|
|
|
63b4e9 |
+ return event;
|
|
|
63b4e9 |
+
|
|
|
63b4e9 |
switch (fd_index) {
|
|
|
63b4e9 |
case FD_ANNOUNCE_TIMER:
|
|
|
63b4e9 |
case FD_SYNC_RX_TIMER:
|