ntpclient not updating time. It didn't crash with error.
Code:
root@rt-n18u:~# ntpclient --help
root@rt-n18u:~# ntpclient
root@rt-n18u:~# ntpclient time.hko.hk
root@rt-n18u:~# date
Thu Jan 1 08:05:01 HKT 1970
root@rt-n18u:~# ntpclient time.nist.gov
root@rt-n18u:~# date
Thu Jan 1 08:09:01 HKT 1970
My startup script for setting time without using NTP:
Code:
date --utc -s `curl -I 'http://www.google.com/' 2&>/dev/null | grep -i '^date:' | sed 's/^[Dd]ate: //g' | awk 'BEGIN{months="JanFebMarAprMayJunJulAugSepOctNovDec"}{printf("%s%02d%s%s", $4, index(months,$3)/3+1,$2,$5)}' | sed 's/://' | sed 's/:/./'`
Also, the ping to www.google.com was over 10ms. It used to be only 2ms in older builds.
I know why... I bet if you do a nslookup on your router for both of those the first address that will be an IPv6 and you are on IPv4....
here is what the problem is from my post in the atheros firmware version (34929):
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.
Joined: 26 Mar 2013 Posts: 1855 Location: Hung Hom, Hong Kong
Posted: Sun Feb 18, 2018 16:12 Post subject:
Wildlion wrote:
I know why... I bet if you do a nslookup on your router for both of those the first address that will be an IPv6 and you are on IPv4....
here is what the problem is from my post in the atheros firmware version (34929) ....
I have spent some time looking at the mini-ntpclient.c code ....
1. Most people are still with IPv4!
2. There is an option in DD-WRT WEBUI to disable "IPV6 Support" in Setup->IPv6, and I have disabled it there.
3. Though I know a bit of C programming, I have never worked with firmware programming. CanNOT help much!
4. Maybe we should drop ntpclient and just use HTTP to set time?
5. How come the IPv6 problem doesn't affect my stupid script which uses curl? _________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Posted: Sun Feb 18, 2018 16:31 Post subject: ASUS RT-AC68U & Linksys E2000
NTP is working on network with it's own stratum-1 servers, which seems to support the analysis made by Wildlion
Wildlion wrote:
I have spent some time looking at the mini-ntpclient.c code ......
Asus RT-AC68U
Firmware: DD-WRT v3.0-r35034 std (02/17/18) - (previous r34929)
Kernel: Linux 4.4.116-rc1 #2608 SMP Sat Feb 17 11:24:53 CET 2018 armv7l
5Ghz (Mixed) with 80Mhz channel width: Ok
SSH: Ok
Telnet: Disabled but tested to work
Site Survey: Ok
Wi-viz Survey 2.4Ghz & 5Ghz: Ok
Reset: No
Status: Ok
Uptime: 3:06
CPU Temperature: CPU 68.0 °C / WL0 46.0 °C / WL1 46.0 °C
2 x E2000
Firmware: DD-WRT v3.0-r35034 mega (02/17/18) - (previous r34929)
Kernel: Linux 3.10.108-dd #17796 Sat Feb 17 17:41:20 CET 2018 mips
2.4Ghz (NG-mixed) with 40Mhz channel width: Ok
SSH: Ok
Telnet: Disabled but tested to work
Site Survey: Ok
Wi-viz Survey 2.4Ghz: Ok
Reset: No
Status: Ok
Uptime: 3:22
CPU Temperature: WL0 53.0 °C
All devices working as AP's each with individual 1Gb wired connections to main firewall
I know why... I bet if you do a nslookup on your router for both of those the first address that will be an IPv6 and you are on IPv4....
here is what the problem is from my post in the atheros firmware version (34929) ....
I have spent some time looking at the mini-ntpclient.c code ....
1. Most people are still with IPv4!
2. There is an option in DD-WRT WEBUI to disable "IPV6 Support" in Setup->IPv6, and I have disabled it there.
3. Though I know a bit of C programming, I have never worked with firmware programming. CanNOT help much!
4. Maybe we should drop ntpclient and just use HTTP to set time?
5. How come the IPv6 problem doesn't affect my stupid script which uses curl?
I think the devs are preparing for IPv6. This commit was a re-write and I think that they just overlooked it. When you are doing something like that it is easy to over-look a simple problem (so I do not blame them, I have done the same thing).
I would have to read through the curl code, but my guess is that the script works because the system had IPv6 disabled (your check box) and thus curl forces the connection goes out over IPv4, similar to a ping and so on...
Router/Version: Netgear R7000
Firmware: DD-WRT v3.0-r35034 std ( 02/17/18 )
Kernel: Linux 4.4.116-rc1 #2608 SMP Sat Feb 17 11:24:53 CET 2018 armv7l
Previous: r34929
Mode/Status: Gateway / working
Reset: no
Issues/Errors: None so far
Uptime: 26m
Temperatures: CPU 58.6 °C / WL0 44.0 °C / WL1 47.5 °C
Posted: Mon Feb 19, 2018 1:57 Post subject: Upgrade
Router/Version: Asus N66u
Firmware: 35034
Previous: 34777
Mode/Status: Gateway, DHCP, QoS
Reset: No
Issues/Errors: None, so far. _________________ Before asking a question on the forums, update dd-wrt: Where do I download firmware? I suggest reading it all.
QCA Best WiFi Settings
Some dd-wrt wiki pages are up to date, others are not. PM me if you find an old one.
Atheros:
Netgear R7800 x3 - WDS AP / station, gateway, QoS
TP-Link Archer C7 v2 x2 - WDS Station
TP-Link TL-WDR3600 v1 - WDS Station
TP-Link 841nd v8 - NU
D-Link 615 C1/E3/I1 x 7 - 1 WDS station
D-Link 825 B1 - NU
D-Link 862L A1 x2 - WDS Station
Netgear WNDR3700v2 - NU
UBNT loco M2 x2 - airOS
Broadcom
Linksys EA6400 - Gateway, QoS
Asus N66U - AP
Netgear WNDR3700v3 - not used
MediaTek
UBNT EdgeRouter X - switch
Joined: 26 Mar 2013 Posts: 1855 Location: Hung Hom, Hong Kong
Posted: Mon Feb 19, 2018 9:38 Post subject:
Router/Version: Asus RT-N18U
Firmware: DD-WRT v3.0-r35034 std (02/17/18 )
Kernel: Linux 4.4.116-rc1 #2612 Sat Feb 17 12:03:05 CET 2018 armv7l
Previous: DD-WRT v3.0-r34929 std (02/12/18 )
Mode/Status: Access Point (AP), Wired Working, Wireless working
Reset: NO reset during firmware upgrade
Issues/Errors:
Per another reply:
1. The ping to www.google.com increased from 2ms to 13ms
2. ntpclient failed to work again
Miscellaneous:
- Router not using IPv6, VPN nor USB
- Router is NOT working 24/7
- LAN LED ... too lazy to check! Meow... >@.@<
- Wireless function is off for the meantime
Old problems:
a. DDNS (inadyn) crashed in build 31722
b. Testing port-forwarding via WAN IP from within LAN not working in builds 34411-34760. Needed external proxy server.
c. NTP client not working in builds 34886-34876 (affecting process_monitor?) _________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 26 Mar 2013 Posts: 1855 Location: Hung Hom, Hong Kong
Posted: Mon Feb 19, 2018 9:52 Post subject:
Wildlion wrote:
I think the devs are preparing for IPv6. This commit was a re-write and I think that they just overlooked it. When you are doing something like that it is easy to over-look a simple problem (so I do not blame them, I have done the same thing).
IPv6 is indeed implemented at data carrier and ISP level. I don't know the deadline for lower level devices. I don't know whether IPv4 would be completely phased out as well.
Quote:
I would have to read through the curl code, but my guess is that the script works because the system had IPv6 disabled (your check box) and thus curl forces the connection goes out over IPv4, similar to a ping and so on...
Then ntpclient should have been using the same logic in curl regarding the selection between IPv4 and IPv6?
Quote:
None of it is your fault.
Not blaming anyone since we are using free, voluntary freeware. _________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 26 Mar 2013 Posts: 1855 Location: Hung Hom, Hong Kong
Posted: Wed Feb 21, 2018 5:41 Post subject:
Calling ntpclient with an IPv4 address really works!
Code:
root@rt-n18u:~# date -s 20110221
Sun Aug 11 02:21:00 HKT 2019
root@rt-n18u:~# ntpclient 118.143.17.82
root@rt-n18u:~# date
Wed Feb 21 13:40:55 HKT 2018
This possibly confirming what Wildlion said in the following thread:
Router Name: ea6400
Router Model: Asus RT-AC68U
Firmware: DD-WRT v3.0-r35034 std (02/17/1
Kernel: Linux 4.4.116-rc1 #2608 SMP Sat Feb 17 11:24:53 CET 2018 armv7l
Previous: DD-WRT v3.0-r30631 std (09/14/16)
Status: VPN AP Working
Fix for OpenVPN 2.4 = Enable IPv6; Ignore IPv6 in config.