Chilli wrong time stamp in Accounting Packet Freeradius

I have this strange issue.
I am using Chilli on Openwrt
and external freeradius + Daloradius.
NTP is configured on OpenWrt devices.
NTP is configured on Ubuntu server

server logs showing that vouchers from some APs starts in wrong date/time
so some APs updating accounting packets correctly and some other APs get it wrong

Sat Jun 25 10:26:02 2022
	ChilliSpot-Version = "1.6"
	Attr-26.14559.10 = 0x00000001
	Event-Timestamp = "May 17 2022 23:02:13 EEST"
	User-Name = "63578476"
	Acct-Status-Type = Start
	Acct-Session-Id = "165614193900000004"
	Class = 0x61693a3761363432373831363038363930333836633838656131616539663638386261
	Framed-IP-Address = 192.168.182.3
	NAS-Port-Type = Wireless-802.11
	NAS-Port = 4
	NAS-Port-Id = "00000004"
	Calling-Station-Id = "XX-XX-XX-XX-XX-XX"
	Called-Station-Id = "XX-XX-XX-XX-XX-XX"
	NAS-IP-Address = 192.168.182.1
	NAS-Identifier = "XX-XX-XX-XX-XX-XX"
	WISPr-Location-ID = "<XXXXX>"
	WISPr-Location-Name = "<XXXXXX>"
	FreeRADIUS-Acct-Session-Start-Time = "Jun 25 2022 10:26:02 EEST"
	Tmp-String-9 = "ai:"
	Acct-Unique-Session-Id = "789071c12892308bfc34c2e4e4f265a3"
	Timestamp = 1656141962

as you see even recorded via freeradius in Sat Jun 25 10:26:02 2022
while chilli event timestamp May 17 2022 23:02:13 EEST
while Timestamp at the end of accounting packet 1656141962 = Saturday, June 25, 2022 9:26:02 AM

although other AP with same firmware showing different data

Sat Jun 25 12:25:13 2022
	ChilliSpot-Version = "1.6"
	Attr-26.14559.10 = 0x00000001
	Event-Timestamp = "Jun 25 2022 12:25:13 EEST"
	User-Name = "437748243"
	Acct-Status-Type = Start
	Acct-Session-Id = "165614865800000001"
	Class = 0x61693a6636643362343432623539343965306630363834393663343936313833313865
	Framed-IP-Address = 192.168.182.0
	NAS-Port-Type = Wireless-802.11
	NAS-Port = 1
	NAS-Port-Id = "00000001"
	Calling-Station-Id = "XX-XX-XX-XX-XX-XX"
	Called-Station-Id = "XX-XX-XX-XX-XX-XX"
	NAS-IP-Address = 192.168.182.1
	NAS-Identifier = "XX-XX-XX-XX-XX-XX"
	WISPr-Location-ID = "<XXXXXXX>"
	WISPr-Location-Name = "<XXXXXX>"
	FreeRADIUS-Acct-Session-Start-Time = "Jun 25 2022 12:25:13 EEST"
	Tmp-String-9 = "ai:"
	Acct-Unique-Session-Id = "8e46713d46d8bd1d1b56c6dea5ead6f0"
	Timestamp = 1656149113

Any Idea?

You run chilli on every AP ?

Yes sure every AP runs Chilli

Bad idea. Just run chilli on the router, the APs are connected to. And then use really "dumb" APs.

Sir Each AP is in different location. and each location is using dependant internet connection.

I would activate remote logging for the openwrt devices. To verify system time used.

No need for remote logging
as i log into webGUI and i can confirm correct date and time set on Openwrt system.


I do not understand, what "webGUI" is, but it also displays a date in May.
Which might be date/time before being synchronized to real time via NTP, after boot. Whereas "Local Time" is reasonable actual date/time, from ubuntu, I suspect. Remote logging will display, when/if time synch happened on openwrt, and when client connected to wireless/chilli. Pls, also provide content of /etc/config/system from affected openwrt-device.

Well you are right.
Chilli startup order number 90
while sysntpd startup order is 98

i guess this is the problem.
what do you think ?

This definitely is a bad idea, to start ntpd so late. Make shure, time is synced before chilli starts. I see, you use openwisp. Never did this, but developed various custom managements for hotspots. Are you happy with openwisp ? Which looks far too bloated to me.

this is not controlled by me, i don't know how openwrt decide which app take place in startup 1st
i will need to look for it
and for openwisp i use it for centralized management platform, and it is very very very useful.

i include openwisp configuration and package in my custom build.
so as soon as a new device is flashed with my custom firmware image.
while it is connected to the internet , the device register it self on my openwisp server. and can be configured as on the fly .

2 Likes

The website on the device.

By: jow-Jo-Philipp Wich on GitHub

Time synchronization happens gradually and asynchronously so swapping the startup order will not help. You could consider disabling chilli start on boot and instead (re)start it from a stratum NTP hotplug event handler.

any help to do what jow suggested?

Disable Chilli start on boot: You can disable Chilli from starting on boot by navigating to the OpenWRT web interface, going to System > Startup, finding the Chilli service in the list, and clicking Disable. If you prefer using the command line, you can SSH into your OpenWRT device and run /etc/init.d/chilli disable.

install ntpd

opkg update
opkg install ntpd

create this script and give execute permission

#!/bin/sh

# Wait for NTP synchronization
while true; do
    ntpq -p | grep -q '^\*' && break
    sleep 1
done

# Start Chilli
/etc/init.d/chilli start

Execute permission

chmod +x script.sh

add the line in rc.local

/bin/sh <path-to-script> &