buglwIP - A Lightweight TCP/IP stack - Bugs: bug #50824, Bug in SNTP POLL mode

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #50824: Bug in SNTP POLL mode

Submitter:  Dirk Ziegelmeier <dziegel>
Submitted:  Tue 18 Apr 2017 10:20:04 AM UTC
   
 
Category:  apps Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Tue 18 Apr 2017 10:20:04 AM UTC, original submission:  

Hello,

There is few issues with SNTP. It propably should not handle SNTP frames (in POLL mode) if it has not requested time update?

This because in current code, while in POLL mode waiting INTERVAL to send new request, a "reply" (without request) is received and timers are stopped:

sntp_recv:
  /* packet received: stop retry timeout  */
  sys_untimeout(sntp_try_next_server, NULL);
  sys_untimeout(sntp_request, NULL);

- If the frame has sender address which is not "sntp_last_server_address", SNTP will use err code ERR_TIMEOUT and does not resume timers   => Time update request is never sent.
  /* packet from wrong remote address or port, wait for correct response */
  err = ERR_TIMEOUT;

 
- Same result as above, but with frame where MODE has been modified from SERVER to BROADCAST.
         LWIP_DEBUGF(SNTP_DEBUG_WARN, ("sntp_recv: Invalid mode in response: %"U16_F"\n", (u16_t)mode));
        /* wait for correct response */
        err = ERR_TIMEOUT;
 
- Third issue is that if you send too short SNTP frame, it will use error code ERR_ARG and calls sntp_retry. This could be used to make LwIP SNTP clients send too fast new request to the real SNTP server.

Also when we are expecting a reply, it should be made sure that in case of invalid reply, we either resume timers and wait for proper reply or restart timers to make sure we poll again.


I actually couldn't get too short frame in so I was not able to reproduce the last one, but by looking the code this could happen. First two can be easily reproduced by sending a modified frame.

br,
Esa Hill

Dirk Ziegelmeier <dziegel>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dziegel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-04-21 dziegel StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code