Posted: Sun Feb 11, 2018 0:21 Post subject: [Resolved] ntp client /time setting BS latest firmware
Hello all! I just installed the latest firmware of the dear Brainslayer DD-WRT v3.0-r34876 std (02/08/1 but cant get my router (linksys wrt1200 v1) to save the date. I tried leave the ntp server name blank - nothing happened . The time is stuck on 1 january 1970 . I tried change the ntp server , put the server in ip form but nothing. The thing is im running a vpn and if the time isnt correct i got the tls error. For now i got to change it manually typing on the command date YYMMDDHHMM but after every restart the date is reseted again ! Some tip or solution ? Thanx !
Here is my analysis of the code and what is going on:
Quote:
I have spent some time looking at the mini-ntpclient.c code
I think that where the ntp problem occurring is
using rev 34895 line numbers
What is happening is that on line 87 when getaddrinfo is called result is a linked list of IPV4 and/or IPV6 addresses since on line 78 the ai_family was set to AF_UNSPEC (so the code does not care which ip version).
When line 96 is reached it is a for loop (because I am assuming the intent was to read through the list). When the "if" statements are reached (depending on if the ai_family is AF_INET or AF_INET6) there is a "break" that exits the loop. This means that only the first entry in the list is evaluated and copied. If this happens to be an AF_INET6 (as you know is IPV6) then that is what is used even if the user has ipv6 disabled. The DNS lookup does not care if it is IPv4 or IPv6 (for example do a nslookup on say google it returns IPv4 and IPv6 addresses).
Those of us that happen to select a server that can be resolved by either IPv4 or IPv6 seem to be drawing the IPv6 address as the first in the list. Obviously, if one is on IPv4, the IPv6 address will not work and the system logs an error and keeps repeating this bug.
There are multiple ways to fix this and since you guys maintain the code, I would rather you choose the method. If you need ideas though ask, I will suggest.