SQLippool redundancy - segmentation fault #1640

Closed
tapkuncoup opened this Issue Jul 3, 2016 · 2 comments

Projects

None yet

1 participant

@tapkuncoup
tapkuncoup commented Jul 3, 2016 edited

I'm currently setting up a redundant SQL setup for my radius server.

I'm encountering an error when using the redundant command on sqlippool instance.

It seem very similar to the #1359 issue
I upgraded to 3.0.11 after reading this issue. The SQL redundancy works fine for the sql module, but fail with seg fault with the sqlippool module.

I'm using the following testing procedure :
Launching freeradius with both SQL servers UP. Manually shutting down SQL1. Then sending a test accounting-start to my radius server.

Here is the radiusd -X output with gdb backtrace (we see the accounting insert works fine => SQL 1 fails but then SQL2 work OK. Then sqlippool is called, SQL1 fails, and the SEGFAULT is fired) :

Starting program: /sbin/radiusd -X
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Server was built with: 
  accounting               : yes
  authentication           : yes
  ascend-binary-attributes : yes
  coa                      : yes
  control-socket           : yes
  detail                   : yes
  dhcp                     : yes
  dynamic-clients          : yes
  osfc2                    : no
  proxy                    : yes
  regex-pcre               : yes
  regex-posix              : no
  regex-posix-extended     : no
  session-management       : yes
  stats                    : yes
  tcp                      : yes
  threads                  : yes
  tls                      : yes
  unlang                   : yes
  vmps                     : yes
  developer                : no
Server core libs:
  freeradius-server        : 3.0.11
  talloc                   : 2.0.*
  ssl                      : 1.0.1e release
  pcre                     : 8.32 2012-11-30
Endianness:
  little
Compilation flags:
  cppflags : 
  cflags   : -I/root/rpmbuild/BUILD/freeradius-server-3.0.11 -I/root/rpmbuild/BUILD/freeradius-server-3.0.11/src -include /root/rpmbuild/BUILD/freeradius-server-3.0.11/src/freeradius-devel/autoconf.h -include /root/rpmbuild/BUILD/freeradius-server-3.0.11/src/freeradius-devel/build.h -include /root/rpmbuild/BUILD/freeradius-server-3.0.11/src/freeradius-devel/features.h -include /root/rpmbuild/BUILD/freeradius-server-3.0.11/src/freeradius-devel/radpaths.h -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wall -std=c99 -D_GNU_SOURCE -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DOPENSSL_NO_KRB5 -DNDEBUG -DIS_MODULE=1
  ldflags  :  -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
  libs     : -lcrypto -lssl -ltalloc -lpcre -lnsl -lresolv -ldl -lpthread -lreadline

Copyright (C) 1999-2016 The FreeRADIUS server project and contributors
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE
You may redistribute copies of FreeRADIUS under the terms of the
GNU General Public License
For more information about these matters, see the file named COPYRIGHT
Detaching after fork from child process 14009.
Starting - reading configuration files ...
including dictionary file /usr/share/freeradius/dictionary
including dictionary file /usr/share/freeradius/dictionary.dhcp
including dictionary file /usr/share/freeradius/dictionary.vqp
including dictionary file /etc/raddb/dictionary
including configuration file /etc/raddb/radiusd.conf
including configuration file /etc/raddb/proxy.conf
including configuration file /etc/raddb/clients.conf
including files in directory /etc/raddb/mods-enabled/
including configuration file /etc/raddb/mods-enabled/mschap
including configuration file /etc/raddb/mods-enabled/ntlm_auth
including configuration file /etc/raddb/mods-enabled/pap
including configuration file /etc/raddb/mods-enabled/passwd
including configuration file /etc/raddb/mods-enabled/realm
including configuration file /etc/raddb/mods-enabled/soh
including configuration file /etc/raddb/mods-enabled/unix
including configuration file /etc/raddb/mods-enabled/utf8
including configuration file /etc/raddb/mods-enabled/sql
including configuration file /etc/raddb/mods-config/sql/main/mysql/queries.conf
including configuration file /etc/raddb/mods-config/sql/main/mysql/queries.conf
including configuration file /etc/raddb/mods-config/sql/main/mysql/queries_rubis.conf
including configuration file /etc/raddb/mods-config/sql/main/mysql/queries_rubis.conf
including configuration file /etc/raddb/mods-enabled/sqlippool
including configuration file /etc/raddb/mods-config/sql/ippool/mysql/queries.conf
including configuration file /etc/raddb/mods-config/sql/ippool/mysql/queries.conf
including configuration file /etc/raddb/mods-enabled/always
including configuration file /etc/raddb/mods-enabled/attr_filter
including configuration file /etc/raddb/mods-enabled/cache_eap
including configuration file /etc/raddb/mods-enabled/chap
including configuration file /etc/raddb/mods-enabled/detail
including configuration file /etc/raddb/mods-enabled/detail.log
including configuration file /etc/raddb/mods-enabled/dhcp
including configuration file /etc/raddb/mods-enabled/digest
including configuration file /etc/raddb/mods-enabled/dynamic_clients
including configuration file /etc/raddb/mods-enabled/eap
including configuration file /etc/raddb/mods-enabled/echo
including configuration file /etc/raddb/mods-enabled/exec
including configuration file /etc/raddb/mods-enabled/expiration
including configuration file /etc/raddb/mods-enabled/expr
including configuration file /etc/raddb/mods-enabled/files
including configuration file /etc/raddb/mods-enabled/linelog
including configuration file /etc/raddb/mods-enabled/logintime
including configuration file /etc/raddb/mods-enabled/preprocess
including configuration file /etc/raddb/mods-enabled/radutmp
including configuration file /etc/raddb/mods-enabled/replicate
including configuration file /etc/raddb/mods-enabled/sradutmp
including configuration file /etc/raddb/mods-enabled/unpack
including files in directory /etc/raddb/policy.d/
including configuration file /etc/raddb/policy.d/filter.rpmsave
including configuration file /etc/raddb/policy.d/accounting
including configuration file /etc/raddb/policy.d/canonicalization
including configuration file /etc/raddb/policy.d/control
including configuration file /etc/raddb/policy.d/cui
including configuration file /etc/raddb/policy.d/debug
including configuration file /etc/raddb/policy.d/dhcp
including configuration file /etc/raddb/policy.d/eap
including configuration file /etc/raddb/policy.d/filter
including configuration file /etc/raddb/policy.d/operator-name
including configuration file /etc/raddb/policy.d/sql_auth
including configuration file /etc/raddb/policy.d/redundant
including files in directory /etc/raddb/sites-enabled/
including configuration file /etc/raddb/sites-enabled/rubis
including configuration file /etc/raddb/sites-enabled/control-socket
including configuration file /etc/raddb/sites-enabled/default
including configuration file /etc/raddb/sites-enabled/inner-tunnel
main {
 security {
        user = "radiusd"
        group = "radiusd"
        allow_core_dumps = no
 }
        name = "radiusd"
        prefix = "/usr"
        localstatedir = "/var"
        logdir = "/var/log/radius"
        run_dir = "/var/run/radiusd"
}
main {
        name = "radiusd"
        prefix = "/usr"
        localstatedir = "/var"
        sbindir = "/usr/sbin"
        logdir = "/var/log/radius"
        run_dir = "/var/run/radiusd"
        libdir = "/usr/lib64/freeradius"
        radacctdir = "/var/log/radius/radacct"
        hostname_lookups = no
        max_request_time = 30
        cleanup_delay = 5
        max_requests = 1024
        pidfile = "/var/run/radiusd/radiusd.pid"
        checkrad = "/usr/sbin/checkrad"
        debug_level = 0
        proxy_requests = yes
 log {
        stripped_names = no
        auth = no
        auth_badpass = no
        auth_goodpass = no
        colourise = yes
        msg_denied = "You are already logged in - access denied"
 }
 resources {
 }
 security {
        max_attributes = 200
        reject_delay = 1.000000
        status_server = yes
 }
}
radiusd: #### Loading Realms and Home Servers ####
 realm LOCAL {
 }
 realm NULL {
 }
 realm rubis {
        authhost = 127.0.0.1:1814
        accthost = 127.0.0.1:1815
        secret = <<< secret >>>
 }
radiusd: #### Loading Clients ####
 client localhost {
        ipaddr = 127.0.0.1
        require_message_authenticator = no
        secret = <<< secret >>>
  limit {
        max_connections = 16
        lifetime = 0
        idle_timeout = 30
  }
 }
 client PC-Tour {
        ipaddr = 192.168.1.18
        require_message_authenticator = no
        secret = <<< secret >>>
  limit {
        max_connections = 16
        lifetime = 0
        idle_timeout = 30
  }
 }
Found debugger attached
 # Creating Auth-Type = PAP
 # Creating Auth-Type = CHAP
 # Creating Auth-Type = MS-CHAP
 # Creating Auth-Type = eap
radiusd: #### Instantiating modules ####
 modules {
  # Loaded module rlm_mschap
  # Loading module "mschap" from file /etc/raddb/mods-enabled/mschap
  mschap {
        use_mppe = yes
        require_encryption = no
        require_strong = no
        with_ntdomain_hack = yes
   passchange {
   }
        allow_retry = yes
  }
  # Loaded module rlm_exec
  # Loading module "ntlm_auth" from file /etc/raddb/mods-enabled/ntlm_auth
  exec ntlm_auth {
        wait = yes
        program = "/path/to/ntlm_auth --request-nt-key --domain=MYDOMAIN --username=%{mschap:User-Name} --password=%{User-Password}"
        shell_escape = yes
  }
  # Loaded module rlm_pap
  # Loading module "pap" from file /etc/raddb/mods-enabled/pap
  pap {
        normalise = yes
  }
  # Loaded module rlm_passwd
  # Loading module "etc_passwd" from file /etc/raddb/mods-enabled/passwd
  passwd etc_passwd {
        filename = "/etc/passwd"
        format = "*User-Name:Crypt-Password:"
        delimiter = ":"
        ignore_nislike = no
        ignore_empty = yes
        allow_multiple_keys = no
        hash_size = 100
  }
  # Loaded module rlm_realm
  # Loading module "IPASS" from file /etc/raddb/mods-enabled/realm
  realm IPASS {
        format = "prefix"
        delimiter = "/"
        ignore_default = no
        ignore_null = no
  }
  # Loading module "suffix" from file /etc/raddb/mods-enabled/realm
  realm suffix {
        format = "suffix"
        delimiter = "@"
        ignore_default = no
        ignore_null = no
  }
  # Loading module "realmpercent" from file /etc/raddb/mods-enabled/realm
  realm realmpercent {
        format = "suffix"
        delimiter = "%"
        ignore_default = no
        ignore_null = no
  }
  # Loading module "ntdomain" from file /etc/raddb/mods-enabled/realm
  realm ntdomain {
        format = "prefix"
        delimiter = "\"
        ignore_default = no
        ignore_null = no
  }
  # Loaded module rlm_soh
  # Loading module "soh" from file /etc/raddb/mods-enabled/soh
  soh {
        dhcp = yes
  }
  # Loaded module rlm_unix
  # Loading module "unix" from file /etc/raddb/mods-enabled/unix
  unix {
        radwtmp = "/var/log/radius/radwtmp"
  }
Creating attribute Unix-Group
  # Loaded module rlm_utf8
  # Loading module "utf8" from file /etc/raddb/mods-enabled/utf8
  # Loaded module rlm_sql
  # Loading module "sql_standard" from file /etc/raddb/mods-enabled/sql
  sql sql_standard {
        driver = "rlm_sql_mysql"
        server = "192.168.1.130"
        port = 3306
        login = "radius"
        password = <<< secret >>>
        radius_db = "radius"
        read_groups = yes
        read_profiles = yes
        read_clients = no
        delete_stale_sessions = yes
        sql_user_name = "%{%{Stripped-User-Name}:-%{User-Name}}"
        default_user_profile = ""
        client_query = "SELECT id, nasname, shortname, type, secret, server FROM nas"
        authorize_check_query = "SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id"
        authorize_reply_query = "SELECT id, username, attribute, value, op FROM radreply WHERE username = '%{SQL-User-Name}' ORDER BY id"
        authorize_group_check_query = "SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'toto' ORDER BY id"
        authorize_group_reply_query = "SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = 'toto' ORDER BY id"
        group_membership_query = "SELECT groupname FROM radusergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority"
        simul_verify_query = "SELECT radacctid, acctsessionid, username, nasipaddress, nasportid, framedipaddress, callingstationid, framedprotocol FROM Traffic WHERE username = '%{SQL-User-Name}' AND acctstoptime IS NULL"
        safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
   accounting {
        reference = "%{tolower:type.%{Acct-Status-Type}.query}"
    type {
     accounting-on {
        query = "UPDATE Traffic SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime   = '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})"
     }
     accounting-off {
        query = "UPDATE Traffic SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime   = '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})"
     }
     start {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'Standard', '1', '0', '0', '0', '0')"
     }
     interim-update {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'Standard', '3', '%{Acct-Output-Octets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{expr: %{Acct-Input-Octets}+%{Acct-Output-Octets}}')"
     }
     stop {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'Standard', '2', '%{Acct-Output-Octets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{expr: %{Acct-Input-Octets}+%{Acct-Output-Octets}}')"
     }
    }
   }
   post-auth {
        reference = ".query"
        query = "INSERT INTO radpostauth (username, pass, reply, authdate) VALUES ( '%{SQL-User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply:Packet-Type}', '%S')"
   }
  }
rlm_sql (sql_standard): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Creating attribute sql_standard-SQL-Group
  # Loading module "sql_standard_2" from file /etc/raddb/mods-enabled/sql
  sql sql_standard_2 {
        driver = "rlm_sql_mysql"
        server = "192.168.1.134"
        port = 3306
        login = "radius"
        password = <<< secret >>>
        radius_db = "radius"
        read_groups = yes
        read_profiles = yes
        read_clients = no
        delete_stale_sessions = yes
        sql_user_name = "%{%{Stripped-User-Name}:-%{User-Name}}"
        default_user_profile = ""
        client_query = "SELECT id, nasname, shortname, type, secret, server FROM nas"
        authorize_check_query = "SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id"
        authorize_reply_query = "SELECT id, username, attribute, value, op FROM radreply WHERE username = '%{SQL-User-Name}' ORDER BY id"
        authorize_group_check_query = "SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'toto' ORDER BY id"
        authorize_group_reply_query = "SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = 'toto' ORDER BY id"
        group_membership_query = "SELECT groupname FROM radusergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority"
        simul_verify_query = "SELECT radacctid, acctsessionid, username, nasipaddress, nasportid, framedipaddress, callingstationid, framedprotocol FROM Traffic WHERE username = '%{SQL-User-Name}' AND acctstoptime IS NULL"
        safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
   accounting {
        reference = "%{tolower:type.%{Acct-Status-Type}.query}"
    type {
     accounting-on {
        query = "UPDATE Traffic SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime   = '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})"
     }
     accounting-off {
        query = "UPDATE Traffic SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime   = '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})"
     }
     start {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'Standard', '1', '0', '0', '0', '0')"
     }
     interim-update {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'Standard', '3', '%{Acct-Output-Octets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{expr: %{Acct-Input-Octets}+%{Acct-Output-Octets}}')"
     }
     stop {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'Standard', '2', '%{Acct-Output-Octets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{expr: %{Acct-Input-Octets}+%{Acct-Output-Octets}}')"
     }
    }
   }
   post-auth {
        reference = ".query"
        query = "INSERT INTO radpostauth (username, pass, reply, authdate) VALUES ( '%{SQL-User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply:Packet-Type}', '%S')"
   }
  }
rlm_sql (sql_standard_2): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Creating attribute sql_standard_2-SQL-Group
  # Loading module "sql_rubis" from file /etc/raddb/mods-enabled/sql
  sql sql_rubis {
        driver = "rlm_sql_mysql"
        server = "192.168.1.130"
        port = 3306
        login = "radius"
        password = <<< secret >>>
        radius_db = "radius"
        read_groups = yes
        read_profiles = yes
        read_clients = no
        delete_stale_sessions = yes
        sql_user_name = "%{User-Name}"
        default_user_profile = ""
        client_query = "SELECT id, nasname, shortname, type, secret, server FROM nas"
        authorize_check_query = "SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id"
        authorize_reply_query = "SELECT id, username, attribute, value, op FROM radreply WHERE username = '%{SQL-User-Name}' ORDER BY id"
        authorize_group_check_query = "SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'toto' ORDER BY id"
        authorize_group_reply_query = "SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = 'toto' ORDER BY id"
        group_membership_query = "SELECT groupname FROM radusergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority"
        simul_verify_query = "SELECT radacctid, acctsessionid, username, nasipaddress, nasportid, framedipaddress, callingstationid, framedprotocol FROM Traffic WHERE username = '%{SQL-User-Name}' AND acctstoptime IS NULL"
        safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
   accounting {
        reference = "%{tolower:type.%{Acct-Status-Type}.query}"
    type {
     accounting-on {
        query = "UPDATE Traffic SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime   = '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})"
     }
     accounting-off {
        query = "UPDATE Traffic SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime   = '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})"
     }
     start {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'RUBIS', '1', '0', '0', '0', '0')"
     }
     interim-update {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'RUBIS', '3', '%{Acct-Output-Octets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{expr: %{Acct-Input-Octets}+%{Acct-Output-Octets}}')"
     }
     stop {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'RUBIS', '2', '%{Acct-Output-Octets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{expr: %{Acct-Input-Octets}+%{Acct-Output-Octets}}')"
     }
    }
   }
   post-auth {
        reference = ".query"
        query = "INSERT INTO radpostauth (username, pass, reply, authdate) VALUES ( '%{SQL-User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply:Packet-Type}', '%S')"
   }
  }
rlm_sql (sql_rubis): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Creating attribute sql_rubis-SQL-Group
  # Loading module "sql_rubis_2" from file /etc/raddb/mods-enabled/sql
  sql sql_rubis_2 {
        driver = "rlm_sql_mysql"
        server = "192.168.1.134"
        port = 3306
        login = "radius"
        password = <<< secret >>>
        radius_db = "radius"
        read_groups = yes
        read_profiles = yes
        read_clients = no
        delete_stale_sessions = yes
        sql_user_name = "%{User-Name}"
        default_user_profile = ""
        client_query = "SELECT id, nasname, shortname, type, secret, server FROM nas"
        authorize_check_query = "SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id"
        authorize_reply_query = "SELECT id, username, attribute, value, op FROM radreply WHERE username = '%{SQL-User-Name}' ORDER BY id"
        authorize_group_check_query = "SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'toto' ORDER BY id"
        authorize_group_reply_query = "SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = 'toto' ORDER BY id"
        group_membership_query = "SELECT groupname FROM radusergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority"
        simul_verify_query = "SELECT radacctid, acctsessionid, username, nasipaddress, nasportid, framedipaddress, callingstationid, framedprotocol FROM Traffic WHERE username = '%{SQL-User-Name}' AND acctstoptime IS NULL"
        safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
   accounting {
        reference = "%{tolower:type.%{Acct-Status-Type}.query}"
    type {
     accounting-on {
        query = "UPDATE Traffic SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime   = '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})"
     }
     accounting-off {
        query = "UPDATE Traffic SET acctstoptime = FROM_UNIXTIME(%{integer:Event-Timestamp}), acctsessiontime   = '%{integer:Event-Timestamp}' - UNIX_TIMESTAMP(acctstarttime), acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' WHERE acctstoptime IS NULL AND nasipaddress   = '%{NAS-IP-Address}' AND acctstarttime <= FROM_UNIXTIME(%{integer:Event-Timestamp})"
     }
     start {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'RUBIS', '1', '0', '0', '0', '0')"
     }
     interim-update {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'RUBIS', '3', '%{Acct-Output-Octets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{expr: %{Acct-Input-Octets}+%{Acct-Output-Octets}}')"
     }
     stop {
        query = "INSERT INTO Traffic (tra_timestamp,            tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,    tra_DNS_secondaire, tra_IMSI_MCC_MNC,    tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'RUBIS', '2', '%{Acct-Output-Octets}', '%{Acct-Input-Octets}', '%{Acct-Session-Time}', '%{expr: %{Acct-Input-Octets}+%{Acct-Output-Octets}}')"
     }
    }
   }
   post-auth {
        reference = ".query"
        query = "INSERT INTO radpostauth (username, pass, reply, authdate) VALUES ( '%{SQL-User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply:Packet-Type}', '%S')"
   }
  }
rlm_sql (sql_rubis_2): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
Creating attribute sql_rubis_2-SQL-Group
  # Loaded module rlm_sqlippool
  # Loading module "sqlippool" from file /etc/raddb/mods-enabled/sqlippool
  sqlippool sqlippool {
        sql_module_instance = "sql_standard"
        lease_duration = 86400
        pool_name = ""
        default_pool = "main_pool"
        allocate_begin = "START TRANSACTION"
        allocate_clear = "UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE expiry_time <= NOW() - INTERVAL 1 SECOND AND nasipaddress = '%{Nas-IP-Address}'"
        allocate_find = "SELECT framedipaddress FROM radippool WHERE pool_name = '%{control:Pool-Name}' AND expiry_time IS NULL ORDER BY RAND() LIMIT 1 FOR UPDATE"
        allocate_update = "UPDATE radippool SET nasipaddress = '%{NAS-IP-Address}', pool_key = '%{Calling-Station-Id}', callingstationid = '%{Calling-Station-Id}', username = '%{User-Name}', expiry_time = NOW() + INTERVAL 86400 SECOND WHERE framedipaddress = '%I' AND expiry_time IS NULL"
        allocate_commit = "COMMIT"
        pool_check = "SELECT id FROM radippool WHERE pool_name='%{control:Pool-Name}' LIMIT 1"
        start_begin = "START TRANSACTION"
        start_update = "UPDATE radippool SET expiry_time = NOW() + INTERVAL 86400 SECOND WHERE nasipaddress = '%{NAS-IP-Address}' AND pool_key = '%{Calling-Station-Id}' AND username = '%{User-Name}' AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
        start_commit = "COMMIT"
        alive_begin = "START TRANSACTION"
        alive_update = "UPDATE radippool SET expiry_time = NOW() + INTERVAL 86400 SECOND WHERE nasipaddress = '%{Nas-IP-Address}' AND pool_key = '%{Calling-Station-Id}' AND username = '%{User-Name}' AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
        alive_commit = "COMMIT"
        stop_begin = "START TRANSACTION"
        stop_clear = "UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE nasipaddress = '%{Nas-IP-Address}' AND pool_key = '%{Calling-Station-Id}' AND username = '%{User-Name}' AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
        stop_commit = "COMMIT"
        on_begin = "START TRANSACTION"
        on_clear = "UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE nasipaddress = '%{Nas-IP-Address}'"
        on_commit = "COMMIT"
        off_begin = "START TRANSACTION"
        off_clear = "UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE nasipaddress = '%{Nas-IP-Address}'"
        off_commit = "COMMIT"
   messages {
        exists = "Existing IP: %{reply:Framed-IP-Address} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
        success = "Allocated IP: %{reply:Framed-IP-Address} from %{control:Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
        clear = "Released IP %{Framed-IP-Address} (did %{Called-Station-Id} cli %{Calling-Station-Id} user %{User-Name})"
        failed = "IP Allocation FAILED from %{control:Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
        nopool = "No Pool-Name defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
   }
  }
  # Loading module "sqlippool_2" from file /etc/raddb/mods-enabled/sqlippool
  sqlippool sqlippool_2 {
        sql_module_instance = "sql_standard_2"
        lease_duration = 86400
        pool_name = ""
        default_pool = "main_pool"
        allocate_begin = "START TRANSACTION"
        allocate_clear = "UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE expiry_time <= NOW() - INTERVAL 1 SECOND AND nasipaddress = '%{Nas-IP-Address}'"
        allocate_find = "SELECT framedipaddress FROM radippool WHERE pool_name = '%{control:Pool-Name}' AND expiry_time IS NULL ORDER BY RAND() LIMIT 1 FOR UPDATE"
        allocate_update = "UPDATE radippool SET nasipaddress = '%{NAS-IP-Address}', pool_key = '%{Calling-Station-Id}', callingstationid = '%{Calling-Station-Id}', username = '%{User-Name}', expiry_time = NOW() + INTERVAL 86400 SECOND WHERE framedipaddress = '%I' AND expiry_time IS NULL"
        allocate_commit = "COMMIT"
        pool_check = "SELECT id FROM radippool WHERE pool_name='%{control:Pool-Name}' LIMIT 1"
        start_begin = "START TRANSACTION"
        start_update = "UPDATE radippool SET expiry_time = NOW() + INTERVAL 86400 SECOND WHERE nasipaddress = '%{NAS-IP-Address}' AND pool_key = '%{Calling-Station-Id}' AND username = '%{User-Name}' AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
        start_commit = "COMMIT"
        alive_begin = "START TRANSACTION"
        alive_update = "UPDATE radippool SET expiry_time = NOW() + INTERVAL 86400 SECOND WHERE nasipaddress = '%{Nas-IP-Address}' AND pool_key = '%{Calling-Station-Id}' AND username = '%{User-Name}' AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
        alive_commit = "COMMIT"
        stop_begin = "START TRANSACTION"
        stop_clear = "UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE nasipaddress = '%{Nas-IP-Address}' AND pool_key = '%{Calling-Station-Id}' AND username = '%{User-Name}' AND callingstationid = '%{Calling-Station-Id}' AND framedipaddress = '%{Framed-IP-Address}'"
        stop_commit = "COMMIT"
        on_begin = "START TRANSACTION"
        on_clear = "UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE nasipaddress = '%{Nas-IP-Address}'"
        on_commit = "COMMIT"
        off_begin = "START TRANSACTION"
        off_clear = "UPDATE radippool SET nasipaddress = '', pool_key = 0, callingstationid = '', username = '', expiry_time = NULL WHERE nasipaddress = '%{Nas-IP-Address}'"
        off_commit = "COMMIT"
   messages {
        exists = "Existing IP: %{reply:Framed-IP-Address} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
        success = "Allocated IP: %{reply:Framed-IP-Address} from %{control:Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
        clear = "Released IP %{Framed-IP-Address} (did %{Called-Station-Id} cli %{Calling-Station-Id} user %{User-Name})"
        failed = "IP Allocation FAILED from %{control:Pool-Name} (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
        nopool = "No Pool-Name defined (did %{Called-Station-Id} cli %{Calling-Station-Id} port %{NAS-Port} user %{User-Name})"
   }
  }
  # Loaded module rlm_always
  # Loading module "reject" from file /etc/raddb/mods-enabled/always
  always reject {
        rcode = "reject"
        simulcount = 0
        mpp = no
  }
  # Loading module "fail" from file /etc/raddb/mods-enabled/always
  always fail {
        rcode = "fail"
        simulcount = 0
        mpp = no
  }
  # Loading module "ok" from file /etc/raddb/mods-enabled/always
  always ok {
        rcode = "ok"
        simulcount = 0
        mpp = no
  }
  # Loading module "handled" from file /etc/raddb/mods-enabled/always
  always handled {
        rcode = "handled"
        simulcount = 0
        mpp = no
  }
  # Loading module "invalid" from file /etc/raddb/mods-enabled/always
  always invalid {
        rcode = "invalid"
        simulcount = 0
        mpp = no
  }
  # Loading module "userlock" from file /etc/raddb/mods-enabled/always
  always userlock {
        rcode = "userlock"
        simulcount = 0
        mpp = no
  }
  # Loading module "notfound" from file /etc/raddb/mods-enabled/always
  always notfound {
        rcode = "notfound"
        simulcount = 0
        mpp = no
  }
  # Loading module "noop" from file /etc/raddb/mods-enabled/always
  always noop {
        rcode = "noop"
        simulcount = 0
        mpp = no
  }
  # Loading module "updated" from file /etc/raddb/mods-enabled/always
  always updated {
        rcode = "updated"
        simulcount = 0
        mpp = no
  }
  # Loaded module rlm_attr_filter
  # Loading module "attr_filter.post-proxy" from file /etc/raddb/mods-enabled/attr_filter
  attr_filter attr_filter.post-proxy {
        filename = "/etc/raddb/mods-config/attr_filter/post-proxy"
        key = "%{Realm}"
        relaxed = no
  }
  # Loading module "attr_filter.pre-proxy" from file /etc/raddb/mods-enabled/attr_filter
  attr_filter attr_filter.pre-proxy {
        filename = "/etc/raddb/mods-config/attr_filter/pre-proxy"
        key = "%{Realm}"
        relaxed = no
  }
  # Loading module "attr_filter.access_reject" from file /etc/raddb/mods-enabled/attr_filter
  attr_filter attr_filter.access_reject {
        filename = "/etc/raddb/mods-config/attr_filter/access_reject"
        key = "%{User-Name}"
        relaxed = no
  }
  # Loading module "attr_filter.access_challenge" from file /etc/raddb/mods-enabled/attr_filter
  attr_filter attr_filter.access_challenge {
        filename = "/etc/raddb/mods-config/attr_filter/access_challenge"
        key = "%{User-Name}"
        relaxed = no
  }
  # Loading module "attr_filter.accounting_response" from file /etc/raddb/mods-enabled/attr_filter
  attr_filter attr_filter.accounting_response {
        filename = "/etc/raddb/mods-config/attr_filter/accounting_response"
        key = "%{User-Name}"
        relaxed = no
  }
  # Loaded module rlm_cache
  # Loading module "cache_eap" from file /etc/raddb/mods-enabled/cache_eap
  cache cache_eap {
        driver = "rlm_cache_rbtree"
        key = "%{%{control:State}:-%{%{reply:State}:-%{State}}}"
        ttl = 15
        max_entries = 0
        epoch = 0
        add_stats = no
  }
  # Loaded module rlm_chap
  # Loading module "chap" from file /etc/raddb/mods-enabled/chap
  # Loaded module rlm_detail
  # Loading module "detail" from file /etc/raddb/mods-enabled/detail
  detail {
        filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d"
        header = "%t"
        permissions = 384
        locking = no
        escape_filenames = no
        log_packet_header = no
  }
  # Loading module "auth_log" from file /etc/raddb/mods-enabled/detail.log
  detail auth_log {
        filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/auth-detail-%Y%m%d"
        header = "%t"
        permissions = 384
        locking = no
        escape_filenames = no
        log_packet_header = no
  }
  # Loading module "reply_log" from file /etc/raddb/mods-enabled/detail.log
  detail reply_log {
        filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/reply-detail-%Y%m%d"
        header = "%t"
        permissions = 384
        locking = no
        escape_filenames = no
        log_packet_header = no
  }
  # Loading module "pre_proxy_log" from file /etc/raddb/mods-enabled/detail.log
  detail pre_proxy_log {
        filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/pre-proxy-detail-%Y%m%d"
        header = "%t"
        permissions = 384
        locking = no
        escape_filenames = no
        log_packet_header = no
  }
  # Loading module "post_proxy_log" from file /etc/raddb/mods-enabled/detail.log
  detail post_proxy_log {
        filename = "/var/log/radius/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/post-proxy-detail-%Y%m%d"
        header = "%t"
        permissions = 384
        locking = no
        escape_filenames = no
        log_packet_header = no
  }
  # Loaded module rlm_dhcp
  # Loading module "dhcp" from file /etc/raddb/mods-enabled/dhcp
  # Loaded module rlm_digest
  # Loading module "digest" from file /etc/raddb/mods-enabled/digest
  # Loaded module rlm_dynamic_clients
  # Loading module "dynamic_clients" from file /etc/raddb/mods-enabled/dynamic_clients
  # Loaded module rlm_eap
  # Loading module "eap" from file /etc/raddb/mods-enabled/eap
  eap {
        default_eap_type = "md5"
        timer_expire = 60
        ignore_unknown_eap_types = no
        cisco_accounting_username_bug = no
        max_sessions = 1024
  }
  # Loading module "echo" from file /etc/raddb/mods-enabled/echo
  exec echo {
        wait = yes
        program = "/bin/echo %{User-Name}"
        input_pairs = "request"
        output_pairs = "reply"
        shell_escape = yes
  }
  # Loading module "exec" from file /etc/raddb/mods-enabled/exec
  exec {
        wait = no
        input_pairs = "request"
        shell_escape = yes
        timeout = 10
  }
  # Loaded module rlm_expiration
  # Loading module "expiration" from file /etc/raddb/mods-enabled/expiration
  # Loaded module rlm_expr
  # Loading module "expr" from file /etc/raddb/mods-enabled/expr
  expr {
        safe_characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /äéöüàâæçèéêëîïôœùûüaÿÄÉÖÜßÀÂÆÇÈÉÊËÎ�ÔŒÙÛÜŸ"
  }
  # Loaded module rlm_files
  # Loading module "files" from file /etc/raddb/mods-enabled/files
  files {
        filename = "/etc/raddb/mods-config/files/authorize"
        acctusersfile = "/etc/raddb/mods-config/files/accounting"
        preproxy_usersfile = "/etc/raddb/mods-config/files/pre-proxy"
  }
  # Loaded module rlm_linelog
  # Loading module "linelog" from file /etc/raddb/mods-enabled/linelog
  linelog {
        filename = "/var/log/radius/linelog"
        escape_filenames = no
        syslog_severity = "info"
        permissions = 384
        format = "This is a log message for %{User-Name}"
        reference = "messages.%{%{reply:Packet-Type}:-default}"
  }
  # Loading module "log_accounting" from file /etc/raddb/mods-enabled/linelog
  linelog log_accounting {
        filename = "/var/log/radius/linelog-accounting"
        escape_filenames = no
        syslog_severity = "info"
        permissions = 384
        format = ""
        reference = "Accounting-Request.%{%{Acct-Status-Type}:-unknown}"
  }
  # Loaded module rlm_logintime
  # Loading module "logintime" from file /etc/raddb/mods-enabled/logintime
  logintime {
        minimum_timeout = 60
  }
  # Loaded module rlm_preprocess
  # Loading module "preprocess" from file /etc/raddb/mods-enabled/preprocess
  preprocess {
        huntgroups = "/etc/raddb/mods-config/preprocess/huntgroups"
        hints = "/etc/raddb/mods-config/preprocess/hints"
        with_ascend_hack = no
        ascend_channels_per_line = 23
        with_ntdomain_hack = no
        with_specialix_jetstream_hack = no
        with_cisco_vsa_hack = no
        with_alvarion_vsa_hack = no
  }
  # Loaded module rlm_radutmp
  # Loading module "radutmp" from file /etc/raddb/mods-enabled/radutmp
  radutmp {
        filename = "/var/log/radius/radutmp"
        username = "%{User-Name}"
        case_sensitive = yes
        check_with_nas = yes
        permissions = 384
        caller_id = yes
  }
  # Loaded module rlm_replicate
  # Loading module "replicate" from file /etc/raddb/mods-enabled/replicate
  # Loading module "sradutmp" from file /etc/raddb/mods-enabled/sradutmp
  radutmp sradutmp {
        filename = "/var/log/radius/sradutmp"
        username = "%{User-Name}"
        case_sensitive = yes
        check_with_nas = yes
        permissions = 420
        caller_id = no
  }
  # Loaded module rlm_unpack
  # Loading module "unpack" from file /etc/raddb/mods-enabled/unpack
  instantiate {
  # Instantiating module "sql_rubis" from file /etc/raddb/mods-enabled/sql
rlm_sql_mysql: libmysql version: 5.5.47-MariaDB
[New Thread 0x7fffef5f0700 (LWP 14010)]
   mysql {
    tls {
    }
        warnings = "auto"
   }
rlm_sql (sql_rubis): Attempting to connect to database "radius"
rlm_sql (sql_rubis): Initialising connection pool
   pool {
        start = 5
        min = 4
        max = 32
        spare = 3
        uses = 0
        lifetime = 0
        cleanup_interval = 30
        idle_timeout = 60
        retry_delay = 1
        spread = no
   }
rlm_sql (sql_rubis): Opening additional connection (0), 1 of 32 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
[Thread 0x7fffef5f0700 (LWP 14010) exited]
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_rubis): Opening additional connection (1), 1 of 31 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_rubis): Opening additional connection (2), 1 of 30 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_rubis): Opening additional connection (3), 1 of 29 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_rubis): Opening additional connection (4), 1 of 28 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
  # Instantiating module "sql_rubis_2" from file /etc/raddb/mods-enabled/sql
   mysql {
    tls {
    }
        warnings = "auto"
   }
rlm_sql (sql_rubis_2): Attempting to connect to database "radius"
rlm_sql (sql_rubis_2): Initialising connection pool
   pool {
        start = 5
        min = 4
        max = 32
        spare = 3
        uses = 0
        lifetime = 0
        cleanup_interval = 30
        idle_timeout = 60
        retry_delay = 1
        spread = no
   }
rlm_sql (sql_rubis_2): Opening additional connection (0), 1 of 32 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_rubis_2): Opening additional connection (1), 1 of 31 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_rubis_2): Opening additional connection (2), 1 of 30 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_rubis_2): Opening additional connection (3), 1 of 29 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_rubis_2): Opening additional connection (4), 1 of 28 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
/etc/raddb/radiusd.conf[696] Not registering expansions for (null)
  }
  # Instantiating module "mschap" from file /etc/raddb/mods-enabled/mschap
rlm_mschap (mschap): using internal authentication
  # Instantiating module "pap" from file /etc/raddb/mods-enabled/pap
  # Instantiating module "etc_passwd" from file /etc/raddb/mods-enabled/passwd
rlm_passwd: nfields: 3 keyfield 0(User-Name) listable: no
  # Instantiating module "IPASS" from file /etc/raddb/mods-enabled/realm
  # Instantiating module "suffix" from file /etc/raddb/mods-enabled/realm
  # Instantiating module "realmpercent" from file /etc/raddb/mods-enabled/realm
  # Instantiating module "ntdomain" from file /etc/raddb/mods-enabled/realm
  # Instantiating module "sql_standard" from file /etc/raddb/mods-enabled/sql
   mysql {
    tls {
    }
        warnings = "auto"
   }
rlm_sql (sql_standard): Attempting to connect to database "radius"
rlm_sql (sql_standard): Initialising connection pool
   pool {
        start = 5
        min = 4
        max = 32
        spare = 3
        uses = 0
        lifetime = 0
        cleanup_interval = 30
        idle_timeout = 60
        retry_delay = 1
        spread = no
   }
rlm_sql (sql_standard): Opening additional connection (0), 1 of 32 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_standard): Opening additional connection (1), 1 of 31 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_standard): Opening additional connection (2), 1 of 30 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_standard): Opening additional connection (3), 1 of 29 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_standard): Opening additional connection (4), 1 of 28 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.130 via TCP/IP, server version 5.6.28, protocol version 10
  # Instantiating module "sql_standard_2" from file /etc/raddb/mods-enabled/sql
   mysql {
    tls {
    }
        warnings = "auto"
   }
rlm_sql (sql_standard_2): Attempting to connect to database "radius"
rlm_sql (sql_standard_2): Initialising connection pool
   pool {
        start = 5
        min = 4
        max = 32
        spare = 3
        uses = 0
        lifetime = 0
        cleanup_interval = 30
        idle_timeout = 60
        retry_delay = 1
        spread = no
   }
rlm_sql (sql_standard_2): Opening additional connection (0), 1 of 32 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_standard_2): Opening additional connection (1), 1 of 31 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_standard_2): Opening additional connection (2), 1 of 30 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_standard_2): Opening additional connection (3), 1 of 29 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
rlm_sql (sql_standard_2): Opening additional connection (4), 1 of 28 pending slots used
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Connected to database 'radius' on 192.168.1.134 via TCP/IP, server version 5.6.28, protocol version 10
  # Instantiating module "sqlippool" from file /etc/raddb/mods-enabled/sqlippool
  # Instantiating module "sqlippool_2" from file /etc/raddb/mods-enabled/sqlippool
  # Instantiating module "reject" from file /etc/raddb/mods-enabled/always
  # Instantiating module "fail" from file /etc/raddb/mods-enabled/always
  # Instantiating module "ok" from file /etc/raddb/mods-enabled/always
  # Instantiating module "handled" from file /etc/raddb/mods-enabled/always
  # Instantiating module "invalid" from file /etc/raddb/mods-enabled/always
  # Instantiating module "userlock" from file /etc/raddb/mods-enabled/always
  # Instantiating module "notfound" from file /etc/raddb/mods-enabled/always
  # Instantiating module "noop" from file /etc/raddb/mods-enabled/always
  # Instantiating module "updated" from file /etc/raddb/mods-enabled/always
  # Instantiating module "attr_filter.post-proxy" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/post-proxy
  # Instantiating module "attr_filter.pre-proxy" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/pre-proxy
  # Instantiating module "attr_filter.access_reject" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/access_reject
[/etc/raddb/mods-config/attr_filter/access_reject]:11 Check item "FreeRADIUS-Response-Delay"    found in filter list for realm "DEFAULT". 
[/etc/raddb/mods-config/attr_filter/access_reject]:11 Check item "FreeRADIUS-Response-Delay-USec"       found in filter list for realm "DEFAULT". 
  # Instantiating module "attr_filter.access_challenge" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/access_challenge
  # Instantiating module "attr_filter.accounting_response" from file /etc/raddb/mods-enabled/attr_filter
reading pairlist file /etc/raddb/mods-config/attr_filter/accounting_response
  # Instantiating module "cache_eap" from file /etc/raddb/mods-enabled/cache_eap
rlm_cache (cache_eap): Driver rlm_cache_rbtree (module rlm_cache_rbtree) loaded and linked
  # Instantiating module "detail" from file /etc/raddb/mods-enabled/detail
  # Instantiating module "auth_log" from file /etc/raddb/mods-enabled/detail.log
rlm_detail (auth_log): 'User-Password' suppressed, will not appear in detail output
  # Instantiating module "reply_log" from file /etc/raddb/mods-enabled/detail.log
  # Instantiating module "pre_proxy_log" from file /etc/raddb/mods-enabled/detail.log
  # Instantiating module "post_proxy_log" from file /etc/raddb/mods-enabled/detail.log
  # Instantiating module "eap" from file /etc/raddb/mods-enabled/eap
   # Linked to sub-module rlm_eap_md5
   # Linked to sub-module rlm_eap_leap
   # Linked to sub-module rlm_eap_gtc
   gtc {
        challenge = "Password: "
        auth_type = "PAP"
   }
   # Linked to sub-module rlm_eap_tls
   tls {
        tls = "tls-common"
   }
   tls-config tls-common {
        verify_depth = 0
        ca_path = "/etc/raddb/certs"
        pem_file_type = yes
        private_key_file = "/etc/raddb/certs/server.pem"
        certificate_file = "/etc/raddb/certs/server.pem"
        ca_file = "/etc/raddb/certs/ca.pem"
        private_key_password = <<< secret >>>
        dh_file = "/etc/raddb/certs/dh"
        fragment_size = 1024
        include_length = yes
        auto_chain = yes
        check_crl = no
        check_all_crl = no
        cipher_list = "DEFAULT"
        ecdh_curve = "prime256v1"
    cache {
        enable = yes
        lifetime = 24
        max_entries = 255
    }
    verify {
        skip_if_ocsp_ok = no
    }
    ocsp {
        enable = no
        override_cert_url = yes
        url = "http://127.0.0.1/ocsp/"
        use_nonce = yes
        timeout = 0
        softfail = no
    }
   }
   # Linked to sub-module rlm_eap_ttls
   ttls {
        tls = "tls-common"
        default_eap_type = "md5"
        copy_request_to_tunnel = no
        use_tunneled_reply = no
        virtual_server = "inner-tunnel"
        include_length = yes
        require_client_cert = no
   }
tls: Using cached TLS configuration from previous invocation
   # Linked to sub-module rlm_eap_peap
   peap {
        tls = "tls-common"
        default_eap_type = "mschapv2"
        copy_request_to_tunnel = no
        use_tunneled_reply = no
        proxy_tunneled_request_as_eap = yes
        virtual_server = "inner-tunnel"
        soh = no
        require_client_cert = no
   }
tls: Using cached TLS configuration from previous invocation
   # Linked to sub-module rlm_eap_mschapv2
   mschapv2 {
        with_ntdomain_hack = no
        send_error = no
   }
  # Instantiating module "expiration" from file /etc/raddb/mods-enabled/expiration
  # Instantiating module "files" from file /etc/raddb/mods-enabled/files
reading pairlist file /etc/raddb/mods-config/files/authorize
reading pairlist file /etc/raddb/mods-config/files/accounting
reading pairlist file /etc/raddb/mods-config/files/pre-proxy
  # Instantiating module "linelog" from file /etc/raddb/mods-enabled/linelog
  # Instantiating module "log_accounting" from file /etc/raddb/mods-enabled/linelog
  # Instantiating module "logintime" from file /etc/raddb/mods-enabled/logintime
  # Instantiating module "preprocess" from file /etc/raddb/mods-enabled/preprocess
reading pairlist file /etc/raddb/mods-config/preprocess/huntgroups
reading pairlist file /etc/raddb/mods-config/preprocess/hints
 } # modules
radiusd: #### Loading Virtual Servers ####
server { # from file /etc/raddb/radiusd.conf
} # server
server rubis { # from file /etc/raddb/sites-enabled/rubis
 # Loading authorize {...}
 # Loading preacct {...}
 # Loading accounting {...}
 # Loading post-auth {...}
} # server rubis
server default { # from file /etc/raddb/sites-enabled/default
 # Loading authorize {...}
 # Loading preacct {...}
 # Loading accounting {...}
 # Loading post-auth {...}
} # server default
server inner-tunnel { # from file /etc/raddb/sites-enabled/inner-tunnel
 # Loading authenticate {...}
 # Loading authorize {...}
Ignoring "sql" (see raddb/mods-available/README.rst)
Ignoring "ldap" (see raddb/mods-available/README.rst)
 # Loading session {...}
 # Loading post-proxy {...}
 # Loading post-auth {...}
} # server inner-tunnel
/etc/raddb/policy.d/sql_auth[47]: Please change "%{control:Pool-Name}" to &control:Pool-Name
/etc/raddb/policy.d/sql_auth[57]: Please change "%{control:Pool-Name}" to &control:Pool-Name
/etc/raddb/policy.d/sql_auth[62]: Please change "%{request:SQL-Test}" to &request:SQL-Test
/etc/raddb/sites-enabled/default[38]: Please change "%{Realm}" to &Realm
/etc/raddb/sites-enabled/default[38]: Please change "%{User-name}" to &User-name
/etc/raddb/policy.d/sql_auth[10]: Please change "%{control:Pool-Name}" to &control:Pool-Name
/etc/raddb/policy.d/sql_auth[18]: Please change "%{control:Pool-Name}" to &control:Pool-Name
/etc/raddb/policy.d/sql_auth[26]: Please change "%{reply:MS-Primary-DNS-Server}" to &reply:MS-Primary-DNS-Server
/etc/raddb/policy.d/sql_auth[26]: Please change ("%{reply:MS-Primary-DNS-Server}" == '') to !&reply:MS-Primary-DNS-Server
/etc/raddb/sites-enabled/default[56]: Please change "%{Realm}" to &Realm
/etc/raddb/sites-enabled/default[56]: Please change "%{User-name}" to &User-name
/etc/raddb/sites-enabled/default[67]: Please change "%{Realm}" to &Realm
/etc/raddb/sites-enabled/default[67]: Please change "%{User-name}" to &User-name
radiusd: #### Opening IP addresses and Ports ####
listen {
        type = "control"
 listen {
        socket = "/var/run/radiusd/radiusd.sock"
        peercred = yes
 }
}
listen {
        type = "auth"
        ipaddr = 127.0.0.1
        port = 1814
   limit {
        max_connections = 16
        lifetime = 0
        idle_timeout = 30
   }
}
listen {
        type = "acct"
        ipaddr = 127.0.0.1
        port = 1815
   limit {
        max_connections = 16
        lifetime = 0
        idle_timeout = 30
   }
}
listen {
        type = "auth"
        ipaddr = *
        port = 1812
   limit {
        max_connections = 16
        lifetime = 0
        idle_timeout = 30
   }
}
listen {
        type = "acct"
        ipaddr = *
        port = 1813
   limit {
        max_connections = 16
        lifetime = 0
        idle_timeout = 30
   }
}
listen {
        type = "auth"
        ipaddr = 127.0.0.1
        port = 18120
}
Listening on command file /var/run/radiusd/radiusd.sock
Listening on auth address 127.0.0.1 port 1814 bound to server rubis
Listening on acct address 127.0.0.1 port 1815 bound to server rubis
Listening on auth address * port 1812 bound to server default
Listening on acct address * port 1813 bound to server default
Listening on auth address 127.0.0.1 port 18120 bound to server inner-tunnel
Ready to process requests
bt
(0) Received Accounting-Request Id 14 from 192.168.1.18:50879 to 192.168.1.131:1813 length 93
(0)   User-Name = "p@rubis"
(0)   Acct-Status-Type = Start
(0)   Acct-Session-Id = "13836"
(0)   NAS-IP-Address = <secret>
(0)   Calling-Station-Id = "<secret>"
(0)   NAS-Identifier = "<secret>"
(0)   3GPP-IMSI = "<secret>"
(0) # Executing section preacct from file /etc/raddb/sites-enabled/default
(0)   preacct {
(0) suffix: Checking for suffix after "@"
(0) suffix: Looking up realm "rubis" for User-Name = "p@rubis"
(0) suffix: Found realm "rubis"
(0) suffix: Adding Stripped-User-Name = "p"
(0) suffix: Adding Realm = "rubis"
(0) suffix: Proxying request from user p to realm rubis
(0) suffix: Preparing to proxy accounting request to realm "rubis" 
(0)     [suffix] = updated
(0)     [preprocess] = ok
(0)   } # preacct = updated
(0) # Executing section accounting from file /etc/raddb/sites-enabled/default
(0)   accounting {
(0)     if ("%{Realm}" == "NULL" || "%{User-name}" == "") {
(0)     if ("%{Realm}" == "NULL" || "%{User-name}" == "")  -> FALSE
(0)   } # accounting = noop
Listening on proxy address * port 45237
(0) Proxying request to home server 127.0.0.1 port 1815 timeout 14.000000
(0) Sent Accounting-Request Id 250 from 0.0.0.0:45237 to 127.0.0.1:1815 length 97
(0)   User-Name = "p"
(0)   Acct-Status-Type = Start
(0)   Acct-Session-Id = "13836"
(0)   NAS-IP-Address = <secret>
(0)   Calling-Station-Id = "<secret>"
(0)   NAS-Identifier = "<secret>"
(0)   3GPP-IMSI = "<secret>"
(0)   Event-Timestamp = "Jul  4 2016 00:25:02 CEST"
(0)   Proxy-State = 0x3134
Waking up in 0.3 seconds.
(1) Received Accounting-Request Id 250 from 127.0.0.1:45237 to 127.0.0.1:1815 length 97
(1)   User-Name = "p"
(1)   Acct-Status-Type = Start
(1)   Acct-Session-Id = "13836"
(1)   NAS-IP-Address = <secret>
(1)   Calling-Station-Id = "<secret>"
(1)   NAS-Identifier = "<secret>"
(1)   3GPP-IMSI = "<secret>"
(1)   Event-Timestamp = "Jul  4 2016 00:25:02 CEST"
(1)   Proxy-State = 0x3134
(1) # Executing section preacct from file /etc/raddb/sites-enabled/rubis
(1)   preacct {
(1)     [preprocess] = ok
(1)   } # preacct = ok
(1) # Executing section accounting from file /etc/raddb/sites-enabled/rubis
(1)   accounting {
(1)     redundant sql_rubis_redundant {
(1) sql_rubis: EXPAND %{tolower:type.%{Acct-Status-Type}.query}
(1) sql_rubis:    --> type.start.query
(1) sql_rubis: Using query template 'query'
rlm_sql (sql_rubis): Reserved connection (0)
(1) sql_rubis: EXPAND %{User-Name}
(1) sql_rubis:    --> p
(1) sql_rubis: SQL-User-Name set to 'p'
(1) sql_rubis: EXPAND INSERT INTO Traffic (tra_timestamp,               tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'RUBIS', '1', '0', '0', '0', '0')
(1) sql_rubis:    --> INSERT INTO Traffic (tra_timestamp,               tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(1467584702), '<secret>', '<secret>', 'p', '', '<secret>', '<secret>', '', '', '', '', 'RUBIS', '1', '0', '0', '0', '0')
(1) sql_rubis: Executing query: INSERT INTO Traffic (tra_timestamp,             tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(1467584702), '<secret>', '<secret>', 'p', '', '<secret>', '<secret>', '', '', '', '', 'RUBIS', '1', '0', '0', '0', '0')
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reconnecting (0)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reserved connection (1)
(1) sql_rubis: Executing query: INSERT INTO Traffic (tra_timestamp,             tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(1467584702), '<secret>', '<secret>', 'p', '', '<secret>', '<secret>', '', '', '', '', 'RUBIS', '1', '0', '0', '0', '0')
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reconnecting (1)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reserved connection (2)
(1) sql_rubis: Executing query: INSERT INTO Traffic (tra_timestamp,             tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(1467584702), '<secret>', '<secret>', 'p', '', '<secret>', '<secret>', '', '', '', '', 'RUBIS', '1', '0', '0', '0', '0')
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reconnecting (2)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reserved connection (3)
(1) sql_rubis: Executing query: INSERT INTO Traffic (tra_timestamp,             tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(1467584702), '<secret>', '<secret>', 'p', '', '<secret>', '<secret>', '', '', '', '', 'RUBIS', '1', '0', '0', '0', '0')
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reconnecting (3)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reserved connection (4)
(1) sql_rubis: Executing query: INSERT INTO Traffic (tra_timestamp,             tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(1467584702), '<secret>', '<secret>', 'p', '', '<secret>', '<secret>', '', '', '', '', 'RUBIS', '1', '0', '0', '0', '0')
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Reconnecting (4)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_rubis): Failed to reconnect (4), no free connections are available
(1) sql_rubis: SQL query returned: no connection
(1)       [sql_rubis] = fail
(1) sql_rubis_2: EXPAND %{tolower:type.%{Acct-Status-Type}.query}
(1) sql_rubis_2:    --> type.start.query
(1) sql_rubis_2: Using query template 'query'
rlm_sql (sql_rubis_2): Reserved connection (0)
(1) sql_rubis_2: EXPAND %{User-Name}
(1) sql_rubis_2:    --> p
(1) sql_rubis_2: SQL-User-Name set to 'p'
(1) sql_rubis_2: EXPAND INSERT INTO Traffic (tra_timestamp,             tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{3GPP-IMSI}', '%{Calling-Station-Id}', '%{SQL-User-Name}', '%{Framed-IP-Address}', '%{NAS-Identifier}', '%{NAS-IP-Address}', '%{MS-Primary-DNS-Server}', '%{MS-Secondary-DNS-Server}', '%{3GPP-IMSI-MCC-MNC}', '%{3GPP-SGSN-MCC-MNC}', 'RUBIS', '1', '0', '0', '0', '0')
(1) sql_rubis_2:    --> INSERT INTO Traffic (tra_timestamp,             tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(1467584702), '<secret>', '<secret>', 'p', '', '<secret>', '<secret>', '', '', '', '', 'RUBIS', '1', '0', '0', '0', '0')
(1) sql_rubis_2: Executing query: INSERT INTO Traffic (tra_timestamp,           tra_imsi,               tra_msisdn, tra_user_name,              tra_ip_address,         tra_NAS_name, tra_NAS_address,  tra_DNS_primaire,     tra_DNS_secondaire, tra_IMSI_MCC_MNC,   tra_SGSN_MCC_MNC,       tra_fonction, tra_connection_status,    tra_bytes_in,           tra_bytes_out, tra_duration,            tra_total_data) VALUES (FROM_UNIXTIME(1467584702), '<secret>', '<secret>', 'p', '', '<secret>', '<secret>', '', '', '', '', 'RUBIS', '1', '0', '0', '0', '0')
(1) sql_rubis_2: SQL query returned: success
(1) sql_rubis_2: 1 record(s) updated
rlm_sql (sql_rubis_2): Released connection (0)
(1)       [sql_rubis_2] = ok
(1)     } # redundant sql_rubis_redundant = ok
(1)     redundant sqlippool_redundant {
rlm_sql (sql_standard): Reserved connection (0)
(1) sqlippool: EXPAND %{%{Stripped-User-Name}:-%{User-Name}}
(1) sqlippool:    --> p
(1) sqlippool: SQL-User-Name set to 'p'
(1) sqlippool: EXPAND START TRANSACTION
(1) sqlippool:    --> START TRANSACTION
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (0)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (1)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (1)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (2)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (2)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (3)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (3)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (4)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (4)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Failed to reconnect (4), no free connections are available

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff2b6f691 in sql_finish_query () from /usr/lib64/freeradius/rlm_sql_mysql.so
(gdb) 
(gdb) bt
#0  0x00007ffff2b6f691 in sql_finish_query () from /usr/lib64/freeradius/rlm_sql_mysql.so
#1  0x00007ffff1c4bc9f in sqlippool_command () from /usr/lib64/freeradius/rlm_sqlippool.so
#2  0x00007ffff1c4c421 in mod_accounting () from /usr/lib64/freeradius/rlm_sqlippool.so
#3  0x000055555557ef9e in modcall_recurse ()
#4  0x000055555557e099 in modcall_child ()
#5  0x000055555557e27e in modcall_recurse ()
#6  0x000055555557e099 in modcall_child ()
#7  0x000055555557e27e in modcall_recurse ()
#8  0x000055555557f4d6 in modcall ()
#9  0x000055555557a21d in indexed_modcall ()
#10 0x0000555555568858 in rad_accounting ()
#11 0x000055555558d302 in request_running ()
#12 0x00005555555893d4 in request_queue_or_run ()
#13 0x000055555558aaa1 in request_receive ()
#14 0x0000555555574adf in acct_socket_recv ()
#15 0x00005555555879de in event_socket_handler ()
#16 0x00007ffff7992025 in fr_event_loop () from /usr/lib64/freeradius/libfreeradius-radius.so
#17 0x0000555555568336 in main ()

I'm not really used to using gdb and such, so if you need me to do additionnal trace (because i probably didn't do it right), just tell me.

Thanks for your help.

@tapkuncoup
tapkuncoup commented Jul 7, 2016 edited

I dug a bit more into this and managed to add debugging symbols to the gdb trace (should have done this from the start, sadly I'm pretty much a sucker in development and didn't put a finger on gdb since my university time, and that was 10 years ago..)

  • beginning of the trace is same as first post*

(...)

(1) # Executing section post-auth from file /etc/raddb/sites-enabled/rubis
(1)   post-auth {
(1)     redundant sqlippool_redundant {
rlm_sql (sql_standard): Reserved connection (0)
(1) sqlippool: EXPAND %{%{Stripped-User-Name}:-%{User-Name}}
(1) sqlippool:    --> p
(1) sqlippool: SQL-User-Name set to 'p'
(1) sqlippool: EXPAND START TRANSACTION
(1) sqlippool:    --> START TRANSACTION
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (0)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (1)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (1)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (2)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (2)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (3)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (3)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (4)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (4)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Failed to reconnect (4), no free connections are available

Program received signal SIGSEGV, Segmentation fault.
sql_finish_query (handle=0x0, config=0x555555a4f350) at src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c:666
666             rlm_sql_mysql_conn_t    *conn = handle->conn;
Missing separate debuginfos, use: debuginfo-install glibc-2.17-106.el7_2.6.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.13.2-12.el7_2.x86_64 libcom_err-1.42.9-7.el7.x86_64 libgcc-4.8.5-4.el7.x86_64 libpcap-1.5.3-8.el7.x86_64 libselinux-2.2.2-6.el7.x86_64 libstdc++-4.8.5-4.el7.x86_64 libtalloc-2.1.5-1.el7_2.x86_64 mariadb-libs-5.5.47-1.el7_2.x86_64 ncurses-libs-5.9-13.20130511.el7.x86_64 nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64 openssl-libs-1.0.1e-51.el7_2.5.x86_64 pcre-8.32-15.el7_2.1.x86_64 readline-6.2-9.el7.x86_64 xz-libs-5.1.2-12alpha.el7.x86_64 zlib-1.2.7-15.el7.x86_64
(gdb) bt
#0  sql_finish_query (handle=0x0, config=0x555555a4f350) at src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c:666
#1  0x00007ffff1c3dc9f in sqlippool_command (fmt=<optimized out>, handle=0x0, handle@entry=0x555555af2750, data=data@entry=0x555555a5c760, request=request@entry=0x555555b8b0c0, param=param@entry=0x0, 
    param_len=param_len@entry=0) at src/modules/rlm_sqlippool/rlm_sqlippool.c:321
#2  0x00007ffff1c3e013 in mod_post_auth (instance=0x555555a5c760, request=0x555555b8b0c0) at src/modules/rlm_sqlippool/rlm_sqlippool.c:511
#3  0x000055555557f43f in call_modsingle (request=0x555555b8b0c0, sp=<optimized out>, component=MOD_POST_AUTH) at src/main/modcall.c:302
#4  modcall_recurse (request=<optimized out>, component=MOD_POST_AUTH, depth=2, entry=entry@entry=0x7fffffffdbd0, do_next_sibling=true) at src/main/modcall.c:574
#5  0x000055555557ff79 in modcall_child (request=<optimized out>, component=<optimized out>, depth=<optimized out>, entry=0x7fffffffdbb8, c=<optimized out>, result=0x7fffffffcfd4, do_next_sibling=true)
    at src/main/modcall.c:408
#6  0x000055555557ed1e in modcall_recurse (request=<optimized out>, component=MOD_POST_AUTH, depth=1, entry=entry@entry=0x7fffffffdbb8, do_next_sibling=true) at src/main/modcall.c:785
#7  0x000055555557ff79 in modcall_child (request=<optimized out>, component=<optimized out>, depth=<optimized out>, entry=0x7fffffffdba0, c=<optimized out>, result=0x7fffffffd604, do_next_sibling=true)
    at src/main/modcall.c:408
#8  0x000055555557ed1e in modcall_recurse (request=request@entry=0x555555b8b0c0, component=component@entry=MOD_POST_AUTH, depth=depth@entry=0, entry=entry@entry=0x7fffffffdba0, 
    do_next_sibling=do_next_sibling@entry=true) at src/main/modcall.c:785
#9  0x0000555555580036 in modcall (component=component@entry=MOD_POST_AUTH, c=c@entry=0x555555b63e30, request=request@entry=0x555555b8b0c0) at src/main/modcall.c:1130
#10 0x000055555557a99d in indexed_modcall (comp=comp@entry=MOD_POST_AUTH, idx=idx@entry=0, request=request@entry=0x555555b8b0c0) at src/main/modules.c:1028
#11 0x000055555557ba4f in process_post_auth (postauth_type=postauth_type@entry=0, request=request@entry=0x555555b8b0c0) at src/main/modules.c:2203
#12 0x0000555555569024 in rad_postauth (request=request@entry=0x555555b8b0c0) at src/main/auth.c:317
#13 0x000055555558ee00 in request_finish (request=0x555555b8b0c0, action=1) at src/main/process.c:1324
#14 0x000055555558afde in request_queue_or_run (request=request@entry=0x555555b8b0c0, process=process@entry=0x55555558f6a0 <request_running>) at src/main/process.c:1015
#15 0x000055555558cbf7 in request_receive (ctx=ctx@entry=0x555555b8ae80, listener=listener@entry=0x555555b86b10, packet=0x555555b8aee0, client=client@entry=0x5555559e6f60, 
    fun=fun@entry=0x5555555692c0 <rad_authenticate>) at src/main/process.c:1782
#16 0x00005555555754be in auth_socket_recv (listener=0x555555b86b10) at src/main/listen.c:1568
#17 0x000055555558924a in event_socket_handler (xel=0x555555a3fdd0, fd=<optimized out>, ctx=<optimized out>) at src/main/process.c:4557
#18 0x00007ffff798d525 in fr_event_loop (el=0x555555a3fdd0) at src/lib/event.c:641
#19 0x0000555555590f21 in radius_event_process () at src/main/process.c:5622
#20 0x0000555555568566 in main (argc=<optimized out>, argv=0x7fffffffe5b8) at src/main/radiusd.c:585

(gdb) frame 0
#0  sql_finish_query (handle=0x0, config=0x555555a4f350) at src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c:666
666             rlm_sql_mysql_conn_t    *conn = handle->conn;
(gdb) frame 1
#1  0x00007ffff1c3dc9f in sqlippool_command (fmt=<optimized out>, handle=0x0, handle@entry=0x555555af2750, data=data@entry=0x555555a5c760, request=request@entry=0x555555b8b0c0, param=param@entry=0x0, 
    param_len=param_len@entry=0) at src/modules/rlm_sqlippool/rlm_sqlippool.c:321
321             (data->sql_inst->module->sql_finish_query)(handle, data->sql_inst->config);
(gdb) frame 2
#2  0x00007ffff1c3e013 in mod_post_auth (instance=0x555555a5c760, request=0x555555b8b0c0) at src/modules/rlm_sqlippool/rlm_sqlippool.c:511
511                     DO(allocate_begin);
(gdb) frame 1
#1  0x00007ffff1c3dc9f in sqlippool_command (fmt=<optimized out>, handle=0x0, handle@entry=0x555555af2750, data=data@entry=0x555555a5c760, request=request@entry=0x555555b8b0c0, param=param@entry=0x0, 
    param_len=param_len@entry=0) at src/modules/rlm_sqlippool/rlm_sqlippool.c:321
321             (data->sql_inst->module->sql_finish_query)(handle, data->sql_inst->config);
(gdb) print handle
$3 = (rlm_sql_handle_t *) 0x0

If i understand this correctly, the handle variable is set to NULL, and that's the reason I'm getting a SIGSEGV.

Sadly, that's about as far I can get with my shitty programming skills. I tried to read the source code of the sqlippool_command function but I'm not able to understand it well enough to suggest a fix.

Any insight on how I could make progress on this would be deeply appreciated.

Regards.

@tapkuncoup
tapkuncoup commented Jul 7, 2016 edited

Some more trace (step-by-step) :

Breakpoint 2, sqlippool_command (fmt=0x555555a5ceb0 "START TRANSACTION", handle=handle@entry=0x555555af2750, data=data@entry=0x555555a5c760, request=request@entry=0x555555b8b0c0, param=param@entry=0x0, 
    param_len=param_len@entry=0) at src/modules/rlm_sqlippool/rlm_sqlippool.c:294
294     {
(gdb) n
303             if (!fmt || !*fmt) return 0;
(gdb) n
294     {
(gdb) n
303             if (!fmt || !*fmt) return 0;
(gdb) n
294     {
(gdb) n
296             char *expanded = NULL;
(gdb) n
303             if (!fmt || !*fmt) return 0;
(gdb) n
308             sqlippool_expand(query, sizeof(query), fmt, data, param, param_len);
(gdb) n
310             if (radius_axlat(&expanded, request, query, data->sql_inst->sql_escape_func, data->sql_inst) < 0) {
(gdb) n
(1) sqlippool: EXPAND START TRANSACTION
(1) sqlippool:    --> START TRANSACTION
314             ret = data->sql_inst->sql_query(data->sql_inst, request, &handle, expanded);
(gdb) print &handle
$12 = (rlm_sql_handle_t **) 0x7fffffffb778
(gdb) print request
$13 = (REQUEST *) 0x555555b8b0c0
(gdb) n
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (0)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (1)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (1)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (2)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (2)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (3)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (3)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reserved connection (4)
(1) sqlippool: Executing query: START TRANSACTION
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Reconnecting (4)
rlm_sql_mysql: Starting connect to MySQL server
rlm_sql_mysql: Couldn't connect to MySQL server radius@192.168.1.130:radius
rlm_sql_mysql: MySQL error: Can't connect to MySQL server on '192.168.1.130' (111)
rlm_sql_mysql: Socket destructor called, closing socket
rlm_sql (sql_standard): Failed to reconnect (4), no free connections are available
315             if (ret < 0){
(gdb) print ret
$14 = 1
(gdb) print handle
$15 = (rlm_sql_handle_t *) 0x0
(gdb) n
319             talloc_free(expanded);
(gdb) print expanded
$16 = 0x555555b8dbd0 "START TRANSACTION"
(gdb) n
321             (data->sql_inst->module->sql_finish_query)(handle, data->sql_inst->config);
(gdb) print handle
$17 = (rlm_sql_handle_t *) 0x0
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
sql_finish_query (handle=0x0, config=0x555555a4f350) at src/modules/rlm_sql/drivers/rlm_sql_mysql/rlm_sql_mysql.c:666
666             rlm_sql_mysql_conn_t    *conn = handle->conn;
@arr2036 arr2036 added a commit that closed this issue Jul 15, 2016
@arr2036 arr2036 Fix SEGV if SQL connection becomes unavailable Closes #1640 cd35f84
@arr2036 arr2036 closed this in cd35f84 Jul 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment