{"action":"created","issue":{"url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/1128","labels_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/1128/labels{/name}","comments_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/1128/comments","events_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/1128/events","html_url":"https://github.com/FreeRADIUS/freeradius-server/pull/1128","id":93637133,"number":1128,"title":"Fixing the missing '%{client:nas_type}' caused by use of old client_afrom_query()","user":{"login":"jpereira","id":254448,"avatar_url":"https://avatars.githubusercontent.com/u/254448?v=3","gravatar_id":"","url":"https://api.github.com/users/jpereira","html_url":"https://github.com/jpereira","followers_url":"https://api.github.com/users/jpereira/followers","following_url":"https://api.github.com/users/jpereira/following{/other_user}","gists_url":"https://api.github.com/users/jpereira/gists{/gist_id}","starred_url":"https://api.github.com/users/jpereira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpereira/subscriptions","organizations_url":"https://api.github.com/users/jpereira/orgs","repos_url":"https://api.github.com/users/jpereira/repos","events_url":"https://api.github.com/users/jpereira/events{/privacy}","received_events_url":"https://api.github.com/users/jpereira/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-07-07T21:49:09Z","updated_at":"2015-08-17T19:03:05Z","closed_at":"2015-08-17T19:02:20Z","pull_request":{"url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/pulls/1128","html_url":"https://github.com/FreeRADIUS/freeradius-server/pull/1128","diff_url":"https://github.com/FreeRADIUS/freeradius-server/pull/1128.diff","patch_url":"https://github.com/FreeRADIUS/freeradius-server/pull/1128.patch"},"body":"Hi,\r\n\r\nThis patch fixes the issue 1108, below some evidence.\r\n\r\n1) I added the below peaces in my $raddb/mods-enabled/sql\r\n\r\n```\r\n............\r\n  \tclient_table = \"nas\"\r\n \r\n \t#\r\n\t# Table to keep radius client info\r\n\t#\r\n\tclient {\r\n#\t\tidentifier = \"myid\"\r\n\r\n\t\t#  Sets default values (not obtained from SQL) for new client entries\r\n\t\t#\r\n\t\ttemplate {\r\n#\t\t\tlogin\t\t\t\t= 'test'\r\n#\t\t\tpassword\t\t\t= 'test'\r\n#\t\t\tproto\t \t\t\t= tcp\r\n#\t\t\trequire_message_authenticator\t= yes\r\n\r\n\t\t\t# Uncomment to add a home_server with the same\r\n\t\t\t# attributes as the client.\r\n#\t\t\tcoa_server {\r\n#\t\t\t\tresponse_window = 2.0\r\n#\t\t\t}\r\n\t\t}\r\n\r\n\t\t#  Client attribute mappings are in the format:\r\n\t\t#      <client attribute> = <table field name>\r\n\t\t#\r\n\t\t#  The following attributes are required:\r\n\t\t#    * ipaddr - Client IP Address.\r\n\t\t#    * secret - RADIUS shared secret.\r\n\t\t#\r\n\t\t#  All other attributes usually supported in a client\r\n\t\t#  definition are also supported here.\r\n\t\tattribute {\r\n\t\t\tipaddr\t\t= \"nasname\"\r\n\t\t\tshortname\t= \"shortname\"\r\n\t\t\tnas_type\t= \"type\"\r\n\t\t\tsecret\t\t= \"secret\"\r\n\t\t\tvirtual_server\t= \"server\"\r\n\t\t}\r\n\t}\r\n................\r\n```\r\n\r\n2) The output of my instance during load of clients from SQL.\r\n```\r\nTue Jul  7 18:44:59 2015 : Debug: rlm_sql (sql): Executing select query: SELECT id, nasname, shortname, type, secret, server FROM nas\r\nTue Jul  7 18:44:59 2015 : Debug: rlm_sql (sql): Adding client 10.1.2.128 (client-sql1) to global clients list\r\nTue Jul  7 18:44:59 2015 : Debug: client client-sql1 {\r\nTue Jul  7 18:44:59 2015 : Debug: \tipaddr = 10.1.2.128\r\nTue Jul  7 18:44:59 2015 : Debug: \trequire_message_authenticator = no\r\nTue Jul  7 18:44:59 2015 : Debug: \tsecret = \"caiprinha123\"\r\nTue Jul  7 18:44:59 2015 : Debug: \tshortname = \"client-sql1\"\r\nTue Jul  7 18:44:59 2015 : Debug: \tnas_type = \"alcatel\"\r\nTue Jul  7 18:44:59 2015 : Debug:  limit {\r\nTue Jul  7 18:44:59 2015 : Debug:  \tmax_connections = 16\r\nTue Jul  7 18:44:59 2015 : Debug:  \tlifetime = 0\r\nTue Jul  7 18:44:59 2015 : Debug:  \tidle_timeout = 30\r\nTue Jul  7 18:44:59 2015 : Debug:  }\r\nTue Jul  7 18:44:59 2015 : Debug: }\r\nTue Jul  7 18:44:59 2015 : Debug: Adding client 10.1.2.128/32 (10.1.2.128) to prefix tree 32\r\nTue Jul  7 18:44:59 2015 : Debug: rlm_sql (10.1.2.128): Client \"client-sql1\" (sql) added\r\nTue Jul  7 18:44:59 2015 : Debug: rlm_sql (sql): Adding client 10.1.1.86 (client-sql2) to global clients list\r\nTue Jul  7 18:44:59 2015 : Debug: client client-sql2 {\r\nTue Jul  7 18:44:59 2015 : Debug: \tipaddr = 10.1.1.86\r\nTue Jul  7 18:44:59 2015 : Debug: \trequire_message_authenticator = no\r\nTue Jul  7 18:44:59 2015 : Debug: \tsecret = \"caipirinha321\"\r\nTue Jul  7 18:44:59 2015 : Debug: \tshortname = \"client-sql2\"\r\nTue Jul  7 18:44:59 2015 : Debug: \tnas_type = \"aptilo\"\r\nTue Jul  7 18:44:59 2015 : Debug:  limit {\r\nTue Jul  7 18:44:59 2015 : Debug:  \tmax_connections = 16\r\nTue Jul  7 18:44:59 2015 : Debug:  \tlifetime = 0\r\nTue Jul  7 18:44:59 2015 : Debug:  \tidle_timeout = 30\r\nTue Jul  7 18:44:59 2015 : Debug:  }\r\nTue Jul  7 18:44:59 2015 : Debug: }\r\nTue Jul  7 18:44:59 2015 : Debug: Adding client 10.1.1.86/32 (10.1.1.86) to prefix tree 32\r\nTue Jul  7 18:44:59 2015 : Debug: rlm_sql (10.1.1.86): Client \"client-sql2\" (sql) added\r\nTue Jul  7 18:44:59 2015 : Debug: rlm_sql (sql): Released connection (0)\r\nTue Jul  7 18:44:59 2015 : Debug:  } # modules\r\n\r\n```\r\n\r\n3) I used this approach to testing.\r\n```\r\nupdate {\r\n   &reply:Reply-Message += \"NAS Info: nasname=%{client:ipaddr}, shortname=%{client:shortname}, nas_type=%{client    :nas_type}, secret=%{client:secret}\"                                                                                    \r\n}\r\nupdated\r\n```\r\n\r\n4) And... the result is:\r\n\r\n```\r\n$ echo \"User-Name = 'bob'\" | /opt/prefix/bin/radclient 10.1.2.128 auth caipirinha123 -x\r\nSent Access-Request Id 29 from 0.0.0.0:55083 to 10.1.2.128:1812 length 25\r\n\tUser-Name = \"bob\"\r\nReceived Access-Accept Id 29 from 10.1.2.128:1812 to 0.0.0.0:0 length 110\r\n\tReply-Message = \"NAS Info: nasname=10.1.2.128, shortname=cliente-sql1 nas_type=alcatel, secret=caipirinha123\"\r\n$\r\n```\r\n\r\nFixed! :+1: "},"comment":{"url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/comments/131931160","html_url":"https://github.com/FreeRADIUS/freeradius-server/pull/1128#issuecomment-131931160","issue_url":"https://api.github.com/repos/FreeRADIUS/freeradius-server/issues/1128","id":131931160,"user":{"login":"arr2036","id":791758,"avatar_url":"https://avatars.githubusercontent.com/u/791758?v=3","gravatar_id":"","url":"https://api.github.com/users/arr2036","html_url":"https://github.com/arr2036","followers_url":"https://api.github.com/users/arr2036/followers","following_url":"https://api.github.com/users/arr2036/following{/other_user}","gists_url":"https://api.github.com/users/arr2036/gists{/gist_id}","starred_url":"https://api.github.com/users/arr2036/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arr2036/subscriptions","organizations_url":"https://api.github.com/users/arr2036/orgs","repos_url":"https://api.github.com/users/arr2036/repos","events_url":"https://api.github.com/users/arr2036/events{/privacy}","received_events_url":"https://api.github.com/users/arr2036/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T19:03:05Z","updated_at":"2015-08-17T19:03:05Z","body":"Could you leave it open :("}}