Fixed RADIUS client local address forcing for IPv6 (eapol_test)

Need to use the IPv6 address data in bind() call if IPv6 is selected.
This commit is contained in:
Jouni Malinen 2008-06-05 20:33:33 +03:00
parent c5f5c91aeb
commit 815c5e1435

View file

@ -742,7 +742,7 @@ radius_change_server(struct radius_client_data *radius,
#ifdef CONFIG_IPV6 #ifdef CONFIG_IPV6
struct sockaddr_in6 serv6, claddr6; struct sockaddr_in6 serv6, claddr6;
#endif /* CONFIG_IPV6 */ #endif /* CONFIG_IPV6 */
struct sockaddr *addr; struct sockaddr *addr, *cl_addr;
socklen_t addrlen, claddrlen; socklen_t addrlen, claddrlen;
char abuf[50]; char abuf[50];
int sel_sock; int sel_sock;
@ -824,6 +824,7 @@ radius_change_server(struct radius_client_data *radius,
claddr.sin_family = AF_INET; claddr.sin_family = AF_INET;
claddr.sin_addr.s_addr = conf->client_addr.u.v4.s_addr; claddr.sin_addr.s_addr = conf->client_addr.u.v4.s_addr;
claddr.sin_port = htons(0); claddr.sin_port = htons(0);
cl_addr = (struct sockaddr *) &claddr;
claddrlen = sizeof(claddr); claddrlen = sizeof(claddr);
break; break;
#ifdef CONFIG_IPV6 #ifdef CONFIG_IPV6
@ -833,6 +834,7 @@ radius_change_server(struct radius_client_data *radius,
os_memcpy(&claddr6.sin6_addr, &conf->client_addr.u.v6, os_memcpy(&claddr6.sin6_addr, &conf->client_addr.u.v6,
sizeof(struct in6_addr)); sizeof(struct in6_addr));
claddr6.sin6_port = htons(0); claddr6.sin6_port = htons(0);
cl_addr = (struct sockaddr *) &claddr6;
claddrlen = sizeof(claddr6); claddrlen = sizeof(claddr6);
break; break;
#endif /* CONFIG_IPV6 */ #endif /* CONFIG_IPV6 */
@ -840,8 +842,7 @@ radius_change_server(struct radius_client_data *radius,
return -1; return -1;
} }
if (bind(sel_sock, (struct sockaddr *) &claddr, claddrlen) < 0) if (bind(sel_sock, cl_addr, claddrlen) < 0) {
{
perror("bind[radius]"); perror("bind[radius]");
return -1; return -1;
} }