Mercurial > hg > freeDiameter
comparison extensions/app_radgw/rgw_clients.c @ 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 |
comparison
equal
deleted
inserted
replaced
519:3f43713be92d | 520:9b5422e5385c |
---|---|
451 Record AVP. If no match is found, then an error is logged, but no | 451 Record AVP. If no match is found, then an error is logged, but no |
452 other action is taken. | 452 other action is taken. |
453 */ | 453 */ |
454 if (nas_ip || nas_ip6) { | 454 if (nas_ip || nas_ip6) { |
455 if (!valid_nas_info) { | 455 if (!valid_nas_info) { |
456 if (cli->type == RGW_CLI_NAS) { | 456 if ((!cli->is_local) && (cli->type == RGW_CLI_NAS)) { |
457 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."); | 457 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."); |
458 return EINVAL; | 458 return EINVAL; |
459 } else { | 459 } else { |
460 /* the peer is configured as a proxy, so accept the message */ | 460 /* the peer is configured as a proxy, or running on localhost, so accept the message */ |
461 sSS ss; | 461 sSS ss; |
462 | 462 |
463 /* In that case, the cli will be stored as Route-Record and the NAS-IP-Address as origin */ | 463 /* In that case, the cli will be stored as Route-Record and the NAS-IP-Address as origin */ |
464 if (!cli->is_local) { | 464 if (!cli->is_local) { |
465 rr_str = cli->fqdn; | 465 rr_str = cli->fqdn; |
476 sin6->sin6_family = AF_INET6; | 476 sin6->sin6_family = AF_INET6; |
477 memcpy(&sin6->sin6_addr, nas_ip6 + 1, sizeof(struct in6_addr)); | 477 memcpy(&sin6->sin6_addr, nas_ip6 + 1, sizeof(struct in6_addr)); |
478 } | 478 } |
479 CHECK_SYS_DO( getnameinfo( (sSA *)&ss, sSAlen(&ss), &buf[0], sizeof(buf), NULL, 0, NI_NAMEREQD), | 479 CHECK_SYS_DO( getnameinfo( (sSA *)&ss, sSAlen(&ss), &buf[0], sizeof(buf), NULL, 0, NI_NAMEREQD), |
480 { | 480 { |
481 if (cli->is_local) { | |
482 CHECK_FCT( rgw_clients_get_origin(cli, &oh_str, &or_str) ); | |
483 goto diameter; | |
484 } | |
485 | |
481 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)."); | 486 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)."); |
482 return EINVAL; | 487 return EINVAL; |
483 } ); | 488 } ); |
484 | 489 |
485 oh_str = &buf[0]; | 490 oh_str = &buf[0]; |