Skip to content

Commit 0108065

Browse files
author
ionutrazvanionita
committed
fixed bug: PW_NAS_IPV6_ADDRESS check
1 parent eaf88cc commit 0108065

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/sendserver.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,13 @@ int rc_send_server (rc_handle *rh, SEND_DATA *data, char *msg, unsigned flags)
380380
getnameinfo(SA(&our_sockaddr), SS_LEN(&our_sockaddr), NULL, 0, our_addr_txt, sizeof(our_addr_txt), NI_NUMERICHOST);
381381
getnameinfo(auth_addr->ai_addr, auth_addr->ai_addrlen, NULL, 0, auth_addr_txt, sizeof(auth_addr_txt), NI_NUMERICHOST);
382382

383-
DEBUG(LOG_ERR, "DEBUG: local %s : 0, remote %s : %u\n",
383+
DEBUG(LOG_ERR, "DEBUG: local %s : 0, remote %s : %u\n",
384384
our_addr_txt, auth_addr_txt, data->svc_port);
385385

386386
for (;;)
387387
{
388388
do {
389-
result = sendto (sockfd, (char *) auth, (unsigned int)total_length,
389+
result = sendto (sockfd, (char *) auth, (unsigned int)total_length,
390390
(int) 0, SA(auth_addr->ai_addr), auth_addr->ai_addrlen);
391391
} while (result == -1 && errno == EINTR);
392392
if (result == -1) {
@@ -669,7 +669,8 @@ int rc_send_server_async(rc_handle *rh, SEND_DATA *data, char *msg, unsigned fla
669669
/*
670670
* Fill in NAS-IP-Address (if needed)
671671
*/
672-
if (rc_avpair_get(data->send_pairs, PW_NAS_IP_ADDRESS, 0) == NULL) {
672+
if (rc_avpair_get(data->send_pairs, PW_NAS_IP_ADDRESS, 0) == NULL &&
673+
rc_avpair_get(data->send_pairs, PW_NAS_IPV6_ADDRESS, 0) == NULL) {
673674
if (our_sockaddr.ss_family == AF_INET) {
674675
uint32_t ip;
675676
ip = *((uint32_t*)(&((struct sockaddr_in*)&our_sockaddr)->sin_addr));

0 commit comments

Comments
 (0)