From 7f46dddfb9f63709463df6ad6c3d6a46b162ec3e Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Tue, 26 Apr 2022 12:46:48 +0300 Subject: [PATCH 1/2] Fix ClientAsync validation of response without attributes Some responses, such as Accounting Response, may not contain any attributes (but only code and packet ID). Since this is an empty dictionaty, code should be checked in this case. Fixes #160 --- pyrad/client_async.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrad/client_async.py b/pyrad/client_async.py index bdf1af2..b30089c 100644 --- a/pyrad/client_async.py +++ b/pyrad/client_async.py @@ -121,7 +121,7 @@ def datagram_received(self, data, addr): try: reply = Packet(packet=data, dict=self.client.dict) - if reply and reply.id in self.pending_requests: + if reply.code and reply.id in self.pending_requests: req = self.pending_requests[reply.id] packet = req['packet'] From eeeb41dabbda70de96525666362be4aba46c9531 Mon Sep 17 00:00:00 2001 From: marinco <37544235+marinco@users.noreply.github.com> Date: Tue, 31 Aug 2021 10:42:44 +0200 Subject: [PATCH 2/2] Add FreeRADIUS status result attributes For easier FreeRADIUS status result parsing --- example/dictionary.freeradius | 56 ++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/example/dictionary.freeradius b/example/dictionary.freeradius index 544d0d7..2a0ef55 100644 --- a/example/dictionary.freeradius +++ b/example/dictionary.freeradius @@ -34,4 +34,58 @@ VALUE FreeRADIUS-Statistics-Type Proxy-Auth-Acct 0x0c VALUE FreeRADIUS-Statistics-Type All 0x1f -END-VENDOR FreeRADIUS \ No newline at end of file +# +# FreeRADIUS statistic result attributes +# +ATTRIBUTE FreeRADIUS-Total-Access-Requests 128 integer +ATTRIBUTE FreeRADIUS-Total-Access-Accepts 129 integer +ATTRIBUTE FreeRADIUS-Total-Access-Rejects 130 integer +ATTRIBUTE FreeRADIUS-Total-Access-Challenges 131 integer +ATTRIBUTE FreeRADIUS-Total-Auth-Responses 132 integer +ATTRIBUTE FreeRADIUS-Total-Auth-Duplicate-Requests 133 integer +ATTRIBUTE FreeRADIUS-Total-Auth-Malformed-Requests 134 integer +ATTRIBUTE FreeRADIUS-Total-Auth-Invalid-Requests 135 integer +ATTRIBUTE FreeRADIUS-Total-Auth-Dropped-Requests 136 integer +ATTRIBUTE FreeRADIUS-Total-Auth-Unknown-Types 137 integer + +ATTRIBUTE FreeRADIUS-Total-Proxy-Access-Requests 138 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Access-Accepts 139 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Access-Rejects 140 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Access-Challenges 141 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Auth-Responses 142 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Auth-Duplicate-Requests 143 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Auth-Malformed-Requests 144 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Auth-Invalid-Requests 145 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Auth-Dropped-Requests 146 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Auth-Unknown-Types 147 integer + +ATTRIBUTE FreeRADIUS-Total-Accounting-Requests 148 integer +ATTRIBUTE FreeRADIUS-Total-Accounting-Responses 149 integer +ATTRIBUTE FreeRADIUS-Total-Acct-Duplicate-Requests 150 integer +ATTRIBUTE FreeRADIUS-Total-Acct-Malformed-Requests 151 integer +ATTRIBUTE FreeRADIUS-Total-Acct-Invalid-Requests 152 integer +ATTRIBUTE FreeRADIUS-Total-Acct-Dropped-Requests 153 integer +ATTRIBUTE FreeRADIUS-Total-Acct-Unknown-Types 154 integer + +ATTRIBUTE FreeRADIUS-Total-Proxy-Accounting-Requests 155 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Accounting-Responses 156 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Acct-Duplicate-Requests 157 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Acct-Malformed-Requests 158 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Acct-Invalid-Requests 159 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Acct-Dropped-Requests 160 integer +ATTRIBUTE FreeRADIUS-Total-Proxy-Acct-Unknown-Types 161 integer + +ATTRIBUTE FreeRADIUS-Queue-Len-Internal 162 integer +ATTRIBUTE FreeRADIUS-Queue-Len-Proxy 163 integer +ATTRIBUTE FreeRADIUS-Queue-Len-Auth 164 integer +ATTRIBUTE FreeRADIUS-Queue-Len-Acct 165 integer +ATTRIBUTE FreeRADIUS-Queue-Len-Detail 166 integer + +ATTRIBUTE FreeRADIUS-Stats-Start-Time 176 date +ATTRIBUTE FreeRADIUS-Stats-HUP-Time 177 date + +ATTRIBUTE FreeRADIUS-Queue-PPS-In 181 integer +ATTRIBUTE FreeRADIUS-Queue-PPS-In 182 integer + + +END-VENDOR FreeRADIUS