# HG changeset patch # User Sebastien Decugis # Date 1282893643 -32400 # Node ID 9b5422e5385cb9f82256d9640873a581b8514a81 # Parent 3f43713be92db409678a70379dffec6581760db1 Better handle localhost RADIUS clients diff -r 3f43713be92d -r 9b5422e5385c extensions/app_radgw/rgw_clients.c --- a/extensions/app_radgw/rgw_clients.c Fri Aug 27 15:28:31 2010 +0900 +++ b/extensions/app_radgw/rgw_clients.c Fri Aug 27 16:20:43 2010 +0900 @@ -453,11 +453,11 @@ */ if (nas_ip || nas_ip6) { if (!valid_nas_info) { - if (cli->type == RGW_CLI_NAS) { + if ((!cli->is_local) && (cli->type == RGW_CLI_NAS)) { TRACE_DEBUG(INFO, "Message received with a NAS-IP-Address or NAS-IPv6-Address different \nfrom the sender's. Please configure as Proxy if this is expected.\n Message discarded."); return EINVAL; } else { - /* the peer is configured as a proxy, so accept the message */ + /* the peer is configured as a proxy, or running on localhost, so accept the message */ sSS ss; /* In that case, the cli will be stored as Route-Record and the NAS-IP-Address as origin */ @@ -478,6 +478,11 @@ } CHECK_SYS_DO( getnameinfo( (sSA *)&ss, sSAlen(&ss), &buf[0], sizeof(buf), NULL, 0, NI_NAMEREQD), { + if (cli->is_local) { + CHECK_FCT( rgw_clients_get_origin(cli, &oh_str, &or_str) ); + goto diameter; + } + TRACE_DEBUG(INFO, "The NAS-IP*-Address cannot be DNS reversed in order to create the Origin-Host AVP; rejecting the message (translation is impossible)."); return EINVAL; } );