[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Timeout wraparound bug

From: Fotis Panagiotopoulos
Subject: [lwip-users] Timeout wraparound bug
Date: Fri, 17 Feb 2017 12:44:35 +0200


I have a problem with LWIP, where after some time of normal operation, all TCP communications die. After lots of headbanging, I found that tcp_tmr() stops beeing called.

I examined the functions sys_check_timeouts() and sys_timeout(), and found out that there is a problem when sys_now wraps around.

Specifically in the file timeouts.c, lines 214-220 the following snippet fails:

  now = sys_now();
  if (next_timeout == NULL) {
    diff = 0;
    timeouts_last_time = now;
  } else {
    diff = now - timeouts_last_time;

When sys_now() returns 0 (due to wrap around), the diff variable gets a huge number (as it is unsigned), and the tcp timer  (and possibly other timers), are scheduled for the very very far future, leading in problematic TCP communications.

Anyone faced this problem? Is this a bug in LWIP, or maybe in my porting files? Any hints?

*Note I am using v2 RC2.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]