coova / coova-chilli

CoovaChilli is an open-source software access controller for captive portal hotspots.
Other
518 stars 260 forks source link

json status in late #335

Closed irongomme closed 6 years ago

irongomme commented 7 years ago

I've got a strange behaviour with CoovaChilli 1.3.2 and json status :

When a client is just connected, i ask a json/status request to update UI, but it first returns clientState: 0. Then few seconds later, i ask the same request again, and everything is OK (clientState=1). But with CoovaChilli 1.3.0 it was immediatelly the correct clientState ... is there something wrong or changed ?

sevan commented 7 years ago

If you switch back to older releases, Is the issue present there too? https://github.com/coova/coova-chilli/releases

irongomme commented 7 years ago

I'll try as soon as possible, but i'm using xt_coova and builds fails with this module over coova 1.3.1.4

aganov commented 7 years ago

We are experiencing same issue (coova-chilli 1.3.1-svn), one thing that I discovered is that that sometimes after logout and then logon again, json's status (login and logout too) reading 2 (or more) different sessions. Sometimes status returns clientState: 0 and sometimes clientState: 1 in random. Maybe on one session in chilli's memory I'm logged in and on the another I'm logged out in this case.

Here are responses from 2 sessions (59957cee00000001 and 59957ddf00000001) that I'm getting in random from /json/status query (Refresh rate < 1s). chilli_query on the ap returns only 1 session.

XX-XX-E9-06-84-83 192.168.180.2 pass 59957cee00000001 1 XX-XX-E9-06-84-83 66/240 66/0 0/0 0/0 0 1 0%/5242880 0%/5242880 -
{
  "version": "1.0",
  "clientState": 1,
  "redir": {
    "originalURL": "",
    "redirectionURL": "",
    "logoutURL": "http://192.168.180.1:3990/logoff",
    "ipAddress": "192.168.180.2",
    "macAddress": "XX-XX-E9-06-84-83"
  },
  "session": {
    "sessionId": "59957cee00000001",
    "userName": "XX-XX-E9-06-84-83",
    "startTime": 1502968987,
    "sessionTimeout": 240,
    "terminateTime": 0,
    "idleTimeout": 0
  },
  "accounting": {
    "sessionTime": 141,
    "idleTime": 141,
    "inputOctets": 0,
    "outputOctets": 0,
    "inputGigawords": 0,
    "outputGigawords": 0,
    "viewPoint": "nas"
  }
}
{
  "version": "1.0",
  "clientState": 1,
  "redir": {
    "originalURL": "http://192.168.180.1:3990:3990/json",
    "redirectionURL": "",
    "logoutURL": "http://192.168.180.1:3990/logoff",
    "ipAddress": "192.168.180.2",
    "macAddress": "XX-XX-E9-06-84-83"
  },
  "session": {
    "sessionId": "59957ddf00000001",
    "userName": "XX-XX-E9-06-84-83",
    "startTime": 1502969350,
    "sessionTimeout": 240,
    "terminateTime": 0,
    "idleTimeout": 0
  },
  "accounting": {
    "sessionTime": 29,
    "idleTime": 29,
    "inputOctets": 0,
    "outputOctets": 0,
    "inputGigawords": 0,
    "outputGigawords": 0,
    "viewPoint": "nas"
  }
}
irongomme commented 6 years ago

I've found a trick that make json status working every time :

I've defined in chilli conf, UAMLISTEN=192.168.180.1 UAMUIPORT=3990 UAMUIPORT=3991 UAMALIASNAME=nas UAMALIASIP=1.0.0.1 DOMAIN=mydomain.test

Then instead of calling http://192.168.180.1:3990/json/status I call : http://nas.mydomain.test/json/status

It works for me !