Determine connection time via hostapd (WiFi)

I need to determinate (calculate) connection time of a WiFI client using hostapd
i know there is iw commnad but i need to use hostapd

Why? What's wrong with the method you've said works?

i have been told that using iw for getting info is not relaible

from hostapd via ubus

                "ee:52:2a:09:59:ba": {
                        "auth": true,
                        "assoc": true,
                        "authorized": true,
                        "preauth": false,
                        "wds": false,
                        "wmm": true,
                        "ht": true,
                        "vht": false,
                        "he": false,
                        "wps": false,
                        "mfp": false,
                        "rrm": [
                                113,
                                0,
                                0,
                                0,
                                0
                        ],
                        "extended_capabilities": [
                                0,
                                0,
                                8,
                                0,
                                0,
                                0,
                                0,
                                64
                        ],
                        "aid": 1,
                        "bytes": {
                                "rx": 765898,
                                "tx": 649973
                        },
                        "airtime": {
                                "rx": 1825404,
                                "tx": 285408
                        },
                        "packets": {
                                "rx": 9963,
                                "tx": 2959
                        },
                        "rate": {
                                "rx": 6000,
                                "tx": 72200
                        },
                        "signal": -28,
                        "capabilities": {

                        }
                }
        }
}

and this is from iw

root@AP3:~# iw wlan2 station dump
Station ee:52:2a:09:59:ba (on wlan2)
        inactive time:  1230 ms
        rx bytes:       766963
        rx packets:     9996
        tx bytes:       650247
        tx packets:     2962
        tx retries:     1497
        tx failed:      3
        rx drop misc:   2
        signal:         -26 [-26, -51] dBm
        signal avg:     -35 [-35, -57] dBm
        tx bitrate:     72.2 MBit/s MCS 7 short GI
        tx duration:    285663 us
        rx bitrate:     6.0 MBit/s
        rx duration:    1828809 us
        airtime weight: 256
        expected throughput:    34.148Mbps
        authorized:     yes
        authenticated:  yes
        associated:     yes
        preamble:       short
        WMM/WME:        yes
        MFP:            no
        TDLS peer:      no
        DTIM period:    3
        beacon interval:250
        short preamble: yes
        short slot time:yes
        connected time: 1989 seconds
        associated at [boottime]:       363845.447s
        associated at:  1693775280794 ms
        current time:   1693777270089 ms

1 Like