<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote type="cite" class="">On 10 Jan 2015, at 16:30, Arran Cudbard-Bell <<a href="mailto:a.cudbardb@freeradius.org" class="">a.cudbardb@freeradius.org</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">Arran… this is the output of radiusd -X in the exactly time where authentication occurs.<br class=""><br class="">The problem is here:<br class=""><br class="">expand: UPDATE acessos_clientes set con_id = (select con_id from concentradores where con_ip = '%{Nas-IP-Address}'), ace_last_ip = '%{reply:Framed-IP-Address}' where ace_login = '%{SQL-User-Name}' -> UPDATE acessos_clientes set con_id = (select con_id from concentradores where con_ip = '10.0.0.2'), ace_last_ip = '131.0.120.0' where ace_login = 'teste1'<br class=""><br class=""><br class="">but it is Working perfectly… as you can see:<br class="">con_id is 3<br class="">and<br class="">ace_last_ip is 131.0.120.0<br class=""><br class="">But the error is there: <br class="">MySQL Error: No Fields<br class=""><br class=""><br class="">OutPut: <br class=""><br class="">rad_recv: Access-Request packet from host 186.227.X.X port 33586, id=185, length=140<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Service-Type = Framed-User<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Framed-Protocol = PPP<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-Port = 15728654<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-Port-Type = Ethernet<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>User-Name = "teste1"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Calling-Station-Id = "C4:6E:1F:98:1D:4F"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Called-Station-Id = "pppoe-1"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-Port-Id = "ether2"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>CHAP-Challenge = 0x4dacd856aa257c6bef6400aa5374954d<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>CHAP-Password = 0x01be52df4c582bbf354be1b7d395fb9b8e<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-Identifier = "PPPOE-1"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-IP-Address = 10.0.0.2<br class=""># Executing section authorize from file /etc/freeradius/sites-enabled/default<br class="">+- entering group authorize {...}<br class="">++[preprocess] returns ok<br class="">[chap] Setting 'Auth-Type := CHAP'<br class="">++[chap] returns ok<br class="">++[mschap] returns noop<br class="">[eap] No EAP-Message, not doing EAP<br class="">++[eap] returns noop<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{User-Name} -> teste1<br class="">[sql] sql_set_user escaped user --> 'teste1'<br class="">rlm_sql (sql): Reserving sql socket id: 119<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: SELECT id, UserName, Attribute, Value, op FROM radcheck WHERE UserName = '%{SQL-User-Name}' <span class="Apple-tab-span" style="white-space:pre"> </span> AND status = '1' ORDER BY id -> SELECT id, UserName, Attribute, Value, op FROM radcheck WHERE UserName = 'teste1' <span class="Apple-tab-span" style="white-space:pre"> </span> AND status = '1' ORDER BY id<br class="">rlm_sql_mysql: MYSQL check_error: 2006, returning SQL_DOWN<br class="">rlm_sql (sql): Attempting to connect rlm_sql_mysql #119<br class="">rlm_sql_mysql: Starting connect to MySQL server for #119<br class="">rlm_sql (sql): Connected new DB handle, #119<br class="">WARNING: Found User-Password == "...".<br class="">WARNING: Are you sure you don't mean Cleartext-Password?<br class="">WARNING: See "man rlm_pap" for more information.<br class="">[sql] User found in radcheck table<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: SELECT id, UserName, Attribute, Value, op FROM radreply WHERE UserName = '%{SQL-User-Name}' ORDER BY id -> SELECT id, UserName, Attribute, Value, op FROM radreply WHERE UserName = 'teste1' ORDER BY id<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: SELECT groupname FROM usergroup WHERE UserName = '%{SQL-User-Name}' ORDER BY priority -> SELECT groupname FROM usergroup WHERE UserName = 'teste1' ORDER BY priority<br class="">rlm_sql (sql): Released sql socket id: 119<br class="">++[sql] returns ok<br class="">++[expiration] returns noop<br class="">++[logintime] returns noop<br class="">[pap] WARNING: Auth-Type already set. Not setting to PAP<br class="">++[pap] returns noop<br class="">Found Auth-Type = CHAP<br class="">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br class="">!!! Replacing User-Password in config items with Cleartext-Password. !!!<br class="">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br class="">!!! Please update your configuration so that the "known good" !!!<br class="">!!! clear text password is in Cleartext-Password, and not in User-Password. !!!<br class="">!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br class=""># Executing group from file /etc/freeradius/sites-enabled/default<br class="">+- entering group CHAP {...}<br class="">[chap] login attempt by "teste1" with CHAP password<br class="">[chap] Using clear text password "102030" for user teste1 authentication.<br class="">[chap] chap user teste1 authenticated succesfully<br class="">++[chap] returns ok<br class="">Login OK: [teste1] (from client Auth_PPPOE_T1 port 15728654 cli C4:6E:1F:98:1D:4F)<br class=""># Executing section post-auth from file /etc/freeradius/sites-enabled/default<br class="">+- entering group post-auth {...}<br class="">rlm_sql (sql): Reserving sql socket id: 118<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{User-Name} -> teste1<br class="">[sqlippool] sql_set_user escaped user --> 'teste1'<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: START TRANSACTION -> START TRANSACTION<br class="">rlm_sql_mysql: MYSQL check_error: 2006, returning SQL_DOWN<br class="">rlm_sql (sql): Attempting to connect rlm_sql_mysql #118<br class="">rlm_sql_mysql: Starting connect to MySQL server for #118<br class="">rlm_sql (sql): Connected new DB handle, #118<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE expiry_time <= NOW() - INTERVAL 1 SECOND AND nasipaddress = '%{Nas-IP-Address}' -> UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE expiry_time <= NOW() - INTERVAL 1 SECOND AND nasipaddress = '10.0.0.2'<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: SELECT framedipaddress FROM radippool WHERE pool_name = '%{control:Pool-Name}' AND fixed ='N' AND (expiry_time < NOW() OR expiry_time IS NULL) ORDER BY (username <> '%{User-Name}'), (callingstationid <> '%{Calling-Station-Id}'), expiry_time LIMIT 1 FOR UPDATE -> SELECT framedipaddress FROM radippool WHERE pool_name = 'db_pool' AND fixed ='N' AND (expiry_time < NOW() OR expiry_time IS NULL) ORDER BY (username <> 'teste1'), (callingstationid <> 'C4:6E:1F:98:1D:4F'), expiry_time LIMIT 1 FOR UPDATE<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: UPDATE radippool SET nasipaddress = '%{NAS-IP-Address}', pool_key = '%{NAS-IP-Address}-%{NAS-Port}', callingstationid = '%{Calling-Station-Id}', username = '%{User-Name}', expiry_time = NOW() + INTERVAL 8400 SECOND WHERE framedipaddress = '131.0.X.X' AND expiry_time IS NULL -> UPDATE radippool SET nasipaddress = '10.0.0.2', pool_key = '10.0.0.2-15728654', callingstationid = 'C4:6E:1F:98:1D:4F', username = 'teste1', expiry_time = NOW() + INTERVAL 8400 SECOND WHERE framedipaddress = '131.0.X.X' AND expiry_time IS NULL<br class="">[sqlippool] Allocated IP 131.0.X.X [00780083]<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: COMMIT -> COMMIT<br class="">rlm_sql (sql): Released sql socket id: 118<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: Allocated IP: %{reply:Framed-IP-Address} from %{control:Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name}) -> Allocated IP: 131.0.X.X from db_pool (did pppoe-1 cli C4:6E:1F:98:1D:4F port 15728654 user teste1)<br class="">Allocated IP: 131.0.X.X from db_pool (did pppoe-1 cli C4:6E:1F:98:1D:4F port 15728654 user teste1)<br class="">++[sqlippool] returns ok<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{User-Name} -> teste1<br class="">[sql] sql_set_user escaped user --> 'teste1'<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{User-Password} -> <br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>... expanding second conditional<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{Chap-Password} -> 0x01be52df4c582bbf354be1b7d395fb9b8e<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: INSERT INTO radpostauth (User, pass, reply, date) VALUES ( '%{User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply:Packet-Type}', '%S') -> INSERT INTO radpostauth (User, pass, reply, date) VALUES ( 'teste1', '0x01be52df4c582bbf354be1b7d395fb9b8e', 'Access-Accept', '2015-01-09 11:54:21')<br class="">rlm_sql (sql) in sql_postauth: query is INSERT INTO radpostauth (User, pass, reply, date) VALUES ( 'teste1', '0x01be52df4c582bbf354be1b7d395fb9b8e', 'Access-Accept', '2015-01-09 11:54:21')<br class="">rlm_sql (sql): Reserving sql socket id: 117<br class="">rlm_sql_mysql: MYSQL check_error: 2006, returning SQL_DOWN<br class="">rlm_sql (sql): Attempting to connect rlm_sql_mysql #117<br class="">rlm_sql_mysql: Starting connect to MySQL server for #117<br class="">rlm_sql (sql): Connected new DB handle, #117<br class="">rlm_sql (sql): Released sql socket id: 117<br class="">++[sql] returns ok<br class="">++[exec] returns noop<br class="">sql_xlat<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{User-Name} -> teste1<br class="">sql_set_user escaped user --> 'teste1'<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>expand: UPDATE acessos_clientes set con_id = (select con_id from concentradores where con_ip = '%{Nas-IP-Address}'), ace_last_ip = '%{reply:Framed-IP-Address}' where ace_login = '%{SQL-User-Name}' -> UPDATE acessos_clientes set con_id = (select con_id from concentradores where con_ip = '10.0.0.2'), ace_last_ip = '131.0.X.X' where ace_login = 'teste1'<br class="">rlm_sql (sql): Reserving sql socket id: 116<br class="">rlm_sql_mysql: MYSQL check_error: 2006, returning SQL_DOWN<br class="">rlm_sql (sql): Attempting to connect rlm_sql_mysql #116<br class="">rlm_sql_mysql: Starting connect to MySQL server for #116<br class="">rlm_sql (sql): Connected new DB handle, #116<br class="">rlm_sql_mysql: MYSQL Error: No Fields<br class="">rlm_sql_mysql: MYSQL error: <br class="">rlm_sql (sql): Attempting to connect rlm_sql_mysql #116<br class="">rlm_sql_mysql: Starting connect to MySQL server for #116<br class="">rlm_sql (sql): Connected new DB handle, #116<br class="">rlm_sql (sql): failed after re-connect<br class="">SQL query did not succeed<br class="">rlm_sql (sql): Released sql socket id: 116<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{sql: UPDATE acessos_clientes set con_id = (select con_id from concentradores where con_ip = '%{Nas-IP-Address}'), ace_last_ip = '%{reply:Framed-IP-Address}' where ace_login = '%{SQL-User-Name}'} -> <br class="">++[request] returns noop<br class="">Sending Access-Accept of id 185 to 186.227.47.X.X port 33586<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Mikrotik-Rate-Limit := "1024k/800k 1024k/1024k 1024k/512k 300/300"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Framed-IP-Address = 131.0.X.X<br class="">Finished request 0.<br class="">Going to the next request<br class="">Waking up in 1.9 seconds.<br class="">rad_recv: Accounting-Request packet from host 186.227.47.X.X port 48371, id=186, length=143<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Service-Type = Framed-User<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Framed-Protocol = PPP<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-Port = 15728654<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-Port-Type = Ethernet<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>User-Name = "teste1"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Calling-Station-Id = "C4:6E:1F:98:1D:4F"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Called-Station-Id = "pppoe-1"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-Port-Id = "ether2"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Acct-Session-Id = "81c0000e"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Framed-IP-Address = 131.0.X.X<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Acct-Authentic = RADIUS<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Event-Timestamp = "Jan 9 2015 11:54:34 BRST"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Acct-Status-Type = Start<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-Identifier = "PPPOE-1"<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Acct-Delay-Time = 0<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>NAS-IP-Address = 10.0.0.2<br class=""># Executing section preacct from file /etc/freeradius/sites-enabled/default<br class="">+- entering group preacct {...}<br class="">++[preprocess] returns ok<br class="">[acct_unique] Hashing 'NAS-Port = 15728654,Client-IP-Address = 186.227.47.X.X,NAS-IP-Address = 10.0.0.2,Acct-Session-Id = "81c0000e",User-Name = "teste1"'<br class="">[acct_unique] Acct-Unique-Session-ID = "e7a32bf7b37ce3d6".<br class="">++[acct_unique] returns ok<br class="">[suffix] No '@' in User-Name = "teste1", looking up realm NULL<br class="">[suffix] No such realm "NULL"<br class="">++[suffix] returns noop<br class="">++[files] returns noop<br class=""># Executing section accounting from file /etc/freeradius/sites-enabled/default<br class="">+- entering group accounting {...}<br class="">rlm_sql (sql): Reserving sql socket id: 115<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{User-Name} -> teste1<br class="">[sqlippool] sql_set_user escaped user --> 'teste1'<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: START TRANSACTION -> START TRANSACTION<br class="">rlm_sql_mysql: MYSQL check_error: 2006, returning SQL_DOWN<br class="">rlm_sql (sql): Attempting to connect rlm_sql_mysql #115<br class="">rlm_sql_mysql: Starting connect to MySQL server for #115<br class="">rlm_sql (sql): Connected new DB handle, #115<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: UPDATE radippool SET expiry_time = NOW() + INTERVAL 8400 SECOND WHERE nasipaddress = '%{NAS-IP-Address}' AND pool_key = '%{NAS-IP-Address}-%{NAS-Port}' AND username = '%{User-Name}' AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}' -> UPDATE radippool SET expiry_time = NOW() + INTERVAL 8400 SECOND WHERE nasipaddress = '10.0.0.2' AND pool_key = '10.0.0.2-15728654' AND username = 'teste1' AND callingstationid = 'C4:6E:1F:98:1D:4F' AND framedipaddress = '131.0.X.X'<br class="">[sqlippool] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: COMMIT -> COMMIT<br class="">rlm_sql (sql): Released sql socket id: 115<br class="">++[sqlippool] returns ok<br class="">++[exec] returns noop<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{User-Name} -> teste1<br class="">[sql] sql_set_user escaped user --> 'teste1'<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{Acct-Delay-Time} -> 0<br class="">[sql] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: INSERT INTO radacct (acctsessionid, acctuniqueid, UserName, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress, acctstartdelay, acctstopdelay, xascendsessionsvrkey) VALUES ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', '%S', '0000-00-00 00:00:00', '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP<br class="">rlm_sql (sql): Reserving sql socket id: 114<br class="">rlm_sql_mysql: MYSQL check_error: 2006, returning SQL_DOWN<br class="">rlm_sql (sql): Attempting to connect rlm_sql_mysql #114<br class="">rlm_sql_mysql: Starting connect to MySQL server for #114<br class="">rlm_sql (sql): Connected new DB handle, #114<br class="">rlm_sql (sql): Released sql socket id: 114<br class="">++[sql] returns ok<br class="">[attr_filter.accounting_response] <span class="Apple-tab-span" style="white-space:pre"> </span>expand: %{User-Name} -> teste1<br class="">attr_filter: Matched entry DEFAULT at line 12<br class="">++[attr_filter.accounting_response] returns updated<br class="">Sending Accounting-Response of id 186 to 186.227.47.X.X port 48371<br class="">Finished request 1.<br class="">Cleaning up request 1 ID 186 with timestamp +121<br class="">Going to the next request<br class="">Waking up in 1.9 seconds.<br class="">Cleaning up request 0 ID 185 with timestamp +121<br class="">Ready to process requests.<br class=""></blockquote><br class=""></blockquote>I have no idea. Looks like the connections are timing out MySQL side, so when you <br class=""><blockquote type="cite" class=""></blockquote>come to use them, they're no longer viable.<br class=""><blockquote type="cite" class=""></blockquote><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""></blockquote>Not sure if this is triggering the other error though.<br class=""><blockquote type="cite" class=""></blockquote><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""></blockquote>Might be worth using wireshark to get a capture between FreeRADIUS and MySQL.<br class=""><blockquote type="cite" class=""></blockquote>I've found that's sometimes helpful in diagnosing weird issues like this.<br class=""><blockquote type="cite" class=""></blockquote><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""></blockquote>If you want to upgrade to 3.0.6 and post the results, i'll help to try track it <br class=""><blockquote type="cite" class=""></blockquote>down. Otherwise i'm not really interested in debugging v2.2.x issues, or enhancing<br class=""><blockquote type="cite" class=""></blockquote>the debug output for the SQL module in v2.2.x such that the problem becomes easier <br class=""><blockquote type="cite" class=""></blockquote>to diagnose.<br class=""><blockquote type="cite" class=""></blockquote><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""></blockquote><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""></blockquote>-Arran<br class=""><blockquote type="cite" class=""></blockquote><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""></blockquote>Arran Cudbard-Bell <<a href="mailto:a.cudbardb@freeradius.org" class="">a.cudbardb@freeradius.org</a>><br class=""><blockquote type="cite" class=""></blockquote>FreeRADIUS development team<br class=""><blockquote type="cite" class=""></blockquote><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""></blockquote>FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2<div class=""><br class=""><div class="">Arran Cudbard-Bell <<a href="mailto:a.cudbardb@freeradius.org" class="">a.cudbardb@freeradius.org</a>><br class="">FreeRADIUS development team<br class=""><br class="">FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2<br class=""></div><br class=""></div></body></html>