changeset 520:9b5422e5385c

Better handle localhost RADIUS clients
author Sebastien Decugis <sdecugis@nict.go.jp>
date Fri, 27 Aug 2010 16:20:43 +0900
parents 3f43713be92d
children b793d43e4686
files extensions/app_radgw/rgw_clients.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
 					} );
"Welcome to our mercurial repository"