Lines Matching refs:nai
450 struct addrinfo *nai;
457 nai = malloc(sizeof (struct addrinfo));
458 if (nai == NULL)
460 *nai = *aip;
462 nai->ai_addr = malloc(addrlen);
463 if (nai->ai_addr == NULL) {
464 freeaddrinfo(nai);
467 bzero(nai->ai_addr, addrlen);
468 nai->ai_addrlen = addrlen;
469 nai->ai_family = PF_INET6;
470 nai->ai_canonname = NULL;
471 if (nai->ai_flags & AI_PASSIVE) {
472 ai2sin6(nai)->sin6_addr = in6addr_any;
474 ai2sin6(nai)->sin6_addr = in6addr_loopback;
475 if (nai->ai_flags & AI_CANONNAME) {
478 freeaddrinfo(nai);
481 nai->ai_canonname = canonname;
484 ai2sin6(nai)->sin6_family = PF_INET6;
485 ai2sin6(nai)->sin6_port = port;
486 cur->ai_next = nai;
487 cur = nai;
495 nai = malloc(sizeof (struct addrinfo));
496 if (nai == NULL)
498 *nai = *aip;
500 nai->ai_addr = malloc(addrlen);
501 if (nai->ai_addr == NULL) {
502 freeaddrinfo(nai);
505 bzero(nai->ai_addr, addrlen);
506 nai->ai_addrlen = addrlen;
507 nai->ai_family = PF_INET;
508 nai->ai_canonname = NULL;
509 if (nai->ai_flags & AI_PASSIVE) {
510 ai2sin(nai)->sin_addr.s_addr = INADDR_ANY;
512 ai2sin(nai)->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
513 if (nai->ai_flags & AI_CANONNAME &&
514 nai->ai_family != PF_UNSPEC) {
517 freeaddrinfo(nai);
520 nai->ai_canonname = canonname;
523 ai2sin(nai)->sin_family = PF_INET;
524 ai2sin(nai)->sin_port = port;
525 cur->ai_next = nai;
526 cur = nai;
567 struct addrinfo *nai;
658 nai = malloc(sizeof (struct addrinfo));
659 if (nai == NULL)
661 *nai = *aip;
663 nai->ai_addr = malloc(addrlen);
664 if (nai->ai_addr == NULL) {
665 freeaddrinfo(nai);
668 bzero(nai->ai_addr, addrlen);
669 nai->ai_addrlen = addrlen;
670 nai->ai_family = PF_INET6;
672 (void) memcpy(ai2sin6(nai)->sin6_addr.s6_addr,
674 nai->ai_canonname = NULL;
675 if ((nai->ai_flags & AI_CANONNAME) && firsttime) {
678 freeaddrinfo(nai);
681 nai->ai_canonname = canonname;
684 ai2sin6(nai)->sin6_family = PF_INET6;
685 ai2sin6(nai)->sin6_port = port;
693 getscopeidfromzone(ai2sin6(nai), zonestr,
694 &ai2sin6(nai)->sin6_scope_id)) != 0) {
698 ai2sin6(nai)->sin6_scope_id = 0;
702 nai = malloc(sizeof (struct addrinfo));
703 if (nai == NULL)
705 *nai = *aip;
707 nai->ai_addr = malloc(addrlen);
708 if (nai->ai_addr == NULL) {
709 freeaddrinfo(nai);
712 bzero(nai->ai_addr, addrlen);
713 nai->ai_addrlen = addrlen;
714 nai->ai_family = PF_INET;
715 (void) memcpy(&(ai2sin(nai)->sin_addr.s_addr),
717 nai->ai_canonname = NULL;
718 if (nai->ai_flags & AI_CANONNAME && firsttime) {
721 freeaddrinfo(nai);
724 nai->ai_canonname = canonname;
727 ai2sin(nai)->sin_family = PF_INET;
728 ai2sin(nai)->sin_port = port;
731 cur->ai_next = nai;
732 cur = nai;