lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] lwIP 1.4.0.rc1: Problems with directed UDP sendto's


From: Benjamin Schelte
Subject: [lwip-users] lwIP 1.4.0.rc1: Problems with directed UDP sendto's
Date: Wed, 27 Oct 2010 12:13:41 +0200

Hi all,

 

After switching from lwIP version 1.3.2 to 1.4.0.rc1 I have problems with the SNTP client I have adopted from the 1.3.2 contribution folder.

I did not change the code, but for some reason it is not working as intended anymore.

Let me explain how it was working before and how it still should work:

In the DHCP request I added the option 42 for sntp servers. They are correctly read and stored in my data container.

After 30 seconds I start the sntp task and try to get the time from one of the servers I received by DHCP.

 

I had to adopt the code to add option 42 to the DHCP stack of lwIP 1.4.0, because it is handled in a different way compared to 1.3.2, but it is working fine for sure.

 

The sequence that was working so far is the following (excerpts from my code, which was taken from the sntp contrib):

socket( AF_INET, SOCK_DGRAM, 0);

bind( sock, (struct sockaddr *)&local, sizeof(local));

sendto( sock, sntp_request, sizeof(sntp_request), 0, (struct sockaddr *)&to, sizeof(to));

lwip_recv(sock, &sntp_response[0], SNTP_MAX_DATA_LEN, 0);

 

In 1.3.2 this sequence was working perfectly, but in 1.4.0.rc1 it is no longer working in the first run.

If I run the same sequence twice with the same server IP address I get a result on the 2nd attempt, but if I run the same sequence twice with different server IPs (because I receive 2 by my DHCP request) I don’t get anything.

 

In wireshark and server logs I see that the first package is never coming to the physical layer although I get valid response from “sendto” (SNTP_MAX_DATA_LEN).

The strange thing is that packets sent as a UDP-broadcast to the network are always working with the same sequence besides “bind” and “recv”, because I don’t expect an answer to that broadcast.

 

And now it is getting really confusing for me:

If I hardcode the SNTP-Server IP address to be my desktop computer it is working for >90% on the first attempt.

Always keep in mind that the packets are physically not sent to the network in case that it is not working!

 

So far I don’t have an explanation for this behavior, but it is somehow blocking me right now.

Any ideas or similar observations with 1.4.0.rc1?

 

Best regards,

Benjamin


reply via email to

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