freeradius fail redundant
Freeradius Version: 2.1.12+dfsg-1.2ubuntu8.1 /etc/freeradius/radiusd.conf accounting { switch "%{Hint}" { case "session" { redundant { module-sql-session write-backlog ok } } case "service" { redundant { module-sql-service write-backlog ok } } } } In debug sql returns "noop" Mon Feb 1 13:12:58 2016 : Debug: rlm_sql (module-sql-session): Reserving sql socket id: 14 Mon Feb 1 13:12:58 2016 : Debug: rlm_sql_mysql: query: call freeradius_session_sql('2016-02-01 13:12:58', '7c4d32221312f4c7', '', 'test-user', '172.12.12.5', '172.1.1.52', 0, 0, 0, 0, 0, 0, 0); Mon Feb 1 13:12:58 2016 : Debug: rlm_sql (module-sql-session): Released sql socket id: 14 Mon Feb 1 13:12:58 2016 : Info: +++++[module-sql-session] returns noop Mon Feb 1 13:12:58 2016 : Info: [write-backlog] expand: /var/log/freeradius/radacct/backlog/write-backlog-%Y-%m-%d-%H.log -> /var/log/freeradius/radacct/backlog/write-backlog-2016-02-01-13.log Mon Feb 1 13:12:58 2016 : Info: [write-backlog] /var/log/freeradius/radacct/backlog/write-backlog-%Y-%m-%d-%H.log expands to /var/log/freeradius/radacct/backlog/write-backlog-2016-02-01-13.log Mon Feb 1 13:12:58 2016 : Info: [write-backlog] Acquired filelock, tried 1 time(s) Mon Feb 1 13:12:58 2016 : Info: [write-backlog] expand: %t -> Mon Feb 1 13:12:58 2016 Mon Feb 1 13:12:58 2016 : Info: +++++[write-backlog] returns ok Mon Feb 1 13:12:58 2016 : Info: ++++- group safe-module-sql-session returns ok Mon Feb 1 13:12:58 2016 : Info: +++- case session returns ok Mon Feb 1 13:12:58 2016 : Info: ++- switch %{Hint} returns ok BUT in tcpdump Mysql Response OK
OK. I updated to: Version: 2.2.9-ppa1 ~ trusty why it moves to the next if the first module has to return OK MySQL available and responds OK. but freeradius not wait and gives noop -----Original Message----- From: Freeradius-Users [mailto:freeradius-users-bounces+b2ronn=gmail.com@lists.freeradius.org] On Behalf Of Alan DeKok Sent: Monday, February 1, 2016 4:51 PM To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> Subject: Re: freeradius fail redundant On Feb 1, 2016, at 8:22 AM, Дмитрий <b2ronn@gmail.com> wrote:
Freeradius
Version: 2.1.12+dfsg-1.2ubuntu8.1
Upgrade. And read the debug output. If a module returns "noop", then the "redundant" block will use the next module in the list. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Feb 1, 2016, at 9:13 AM, Дмитрий <b2ronn@gmail.com> wrote:
OK. I updated to: Version: 2.2.9-ppa1 ~ trusty why it moves to the next if the first module has to return OK MySQL available and responds OK. but freeradius not wait and gives noop
The SQL module returns "noop". Read the debug output. The query you are running does not do anything. Alan DeKok.
which data should be returned from mysql on accounting-start? On Feb 1, 2016, at 9:13 AM, Дмитрий <b2ronn@gmail.com> wrote:
OK. I updated to: Version: 2.2.9-ppa1 ~ trusty why it moves to the next if the first module has to return OK MySQL available and responds OK. but freeradius not wait and gives noop
The SQL module returns "noop". Read the debug output. The query you are running does not do anything. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
mysql Stored procedure returns a "Query OK, 0 row affected" radius believes it is not correct so decided. in freeradius-server-2.2.9 / src / modules / rlm_sql / rlm_sql.c replaced -if ( numaffected < 1 ) { -ret = RLM_MODULE_NOOP; -} +if ( (numaffected < 1 && !strstr(querystr,"call")) || (numaffected < 0 && strstr(querystr,"call") ) ) { +ret = RLM_MODULE_NOOP; +} -----Original Message----- From: Freeradius-Users [mailto:freeradius-users-bounces+b2ronn=gmail.com@lists.freeradius.org] On Behalf Of Alan DeKok Sent: Monday, February 1, 2016 6:17 PM To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> Subject: Re: freeradius fail redundant On Feb 1, 2016, at 9:53 AM, Дмитрий Зиновьев <b2ronn@gmail.com> wrote:
which data should be returned from mysql on accounting-start?
The SQL module should be able to insert the accounting data into the database. This works in the default configuration. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On 02-02-16 16:20, Дмитрий wrote:
mysql Stored procedure returns a "Query OK, 0 row affected" radius believes it is not correct so decided.
in freeradius-server-2.2.9 / src / modules / rlm_sql / rlm_sql.c replaced
-if ( numaffected < 1 ) { -ret = RLM_MODULE_NOOP; -}
+if ( (numaffected < 1 && !strstr(querystr,"call")) || (numaffected < 0 && strstr(querystr,"call") ) ) { +ret = RLM_MODULE_NOOP; +}
That looks like a terrible hack. If I had named my table accouting_call this would match too. And I'm not even sure if the return value could possibly be smaller that 0 (it calls a mysql function, which is documented as "Because mysql_affected_rows() returns an unsigned value, you can check for -1 by comparing the return value to (my_ulonglong)-1 (or to (my_ulonglong)~0, which is equivalent).", because that makes everything clearer). I'm not sure how much alike stored procedures in mysql are compared to postgresql, but wouldn't it be easier to just return a value in that stored procedure? -- Herwin Weststrate
On Feb 2, 2016, at 10:39 AM, Herwin Weststrate <herwin@quarantainenet.nl> wrote:
On 02-02-16 16:20, Дмитрий wrote:
mysql Stored procedure returns a "Query OK, 0 row affected" radius believes it is not correct so decided.
in freeradius-server-2.2.9 / src / modules / rlm_sql / rlm_sql.c replaced
-if ( numaffected < 1 ) { -ret = RLM_MODULE_NOOP; -}
+if ( (numaffected < 1 && !strstr(querystr,"call")) || (numaffected < 0 && strstr(querystr,"call") ) ) { +ret = RLM_MODULE_NOOP; +}
That looks like a terrible hack. If I had named my table accouting_call this would match too. And I'm not even sure if the return value could possibly be smaller that 0 (it calls a mysql function, which is documented as "Because mysql_affected_rows() returns an unsigned value, you can check for -1 by comparing the return value to (my_ulonglong)-1 (or to (my_ulonglong)~0, which is equivalent).", because that makes everything clearer).
I'm not sure how much alike stored procedures in mysql are compared to postgresql, but wouldn't it be easier to just return a value in that stored procedure?
This is actually fixed in v3.0.x, we distinguish between a constraint violation and no affected rows for MySQL. We're no longer accepting patches of any kind for 2.2.x, it is End of Life. -Arran
On Feb 2, 2016, at 10:54 AM, Arran Cudbard-Bell <a.cudbardb@freeradius.org> wrote:
This is actually fixed in v3.0.x, we distinguish between a constraint violation and no affected rows for MySQL.
We're no longer accepting patches of any kind for 2.2.x, it is End of Life.
That's the right answer. If someone needs new functionality from version 3, don't back-port it to version 2. Upgrade to version 3. Alan DeKok.
In freeradius 3.0.11 Executing query: call freeradius_session_acct(.....) SQL query returned: success 0 record(s) updated No additional queries configured noop -----Original Message----- From: Freeradius-Users [mailto:freeradius-users-bounces+b2ronn=gmail.com@lists.freeradius.org] On Behalf Of Alan DeKok Sent: Tuesday, February 2, 2016 7:08 PM To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> Subject: Re: freeradius fail redundant On Feb 2, 2016, at 10:54 AM, Arran Cudbard-Bell <a.cudbardb@freeradius.org> wrote:
This is actually fixed in v3.0.x, we distinguish between a constraint violation and no affected rows for MySQL.
We're no longer accepting patches of any kind for 2.2.x, it is End of Life.
That's the right answer. If someone needs new functionality from version 3, don't back-port it to version 2. Upgrade to version 3. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Feb 4, 2016, at 3:35 AM, Дмитрий <b2ronn@gmail.com> wrote:
In freeradius 3.0.11
Executing query: call freeradius_session_acct(.....) SQL query returned: success 0 record(s) updated No additional queries configured noop
If the query returns "no records updated", then by definition, the SQL module does nothing. Fix your query so that it returns something. Alan DeKok.
On 4 Feb 2016, at 00:35, Дмитрий <b2ronn@gmail.com> wrote:
In freeradius 3.0.11
Executing query: call freeradius_session_acct(.....) SQL query returned: success 0 record(s) updated No additional queries configured noop
So it worked, right? It didn't error out, but as your query apparently did nothing, the SQL module returned noop. You can override the return noop code very easily in unlang. sql if (noop) { updated } -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
participants (5)
-
Alan DeKok -
Arran Cudbard-Bell -
Herwin Weststrate -
Дмитрий -
Дмитрий Зиновьев