Lines Matching refs:nai

436 		struct addrinfo *nai;
443 nai = malloc(sizeof (struct addrinfo));
444 if (nai == NULL)
446 *nai = *aip;
448 nai->ai_addr = malloc(addrlen);
449 if (nai->ai_addr == NULL) {
450 freeaddrinfo(nai);
453 bzero(nai->ai_addr, addrlen);
454 nai->ai_addrlen = addrlen;
455 nai->ai_family = PF_INET6;
456 nai->ai_canonname = NULL;
457 if (nai->ai_flags & AI_PASSIVE) {
459 ai2sin6(nai)->sin6_addr = in6addr_any;
462 ai2sin6(nai)->sin6_addr = in6addr_loopback;
463 if (nai->ai_flags & AI_CANONNAME) {
466 freeaddrinfo(nai);
469 nai->ai_canonname = canonname;
473 ai2sin6(nai)->sin6_family = PF_INET6;
475 ai2sin6(nai)->sin6_port = port;
476 cur->ai_next = nai;
477 cur = nai;
485 nai = malloc(sizeof (struct addrinfo));
486 if (nai == NULL)
488 *nai = *aip;
490 nai->ai_addr = malloc(addrlen);
491 if (nai->ai_addr == NULL) {
492 freeaddrinfo(nai);
495 bzero(nai->ai_addr, addrlen);
496 nai->ai_addrlen = addrlen;
497 nai->ai_family = PF_INET;
498 nai->ai_canonname = NULL;
499 if (nai->ai_flags & AI_PASSIVE) {
501 ai2sin(nai)->sin_addr.s_addr = INADDR_ANY;
504 ai2sin(nai)->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
505 if (nai->ai_flags & AI_CANONNAME &&
506 nai->ai_family != PF_UNSPEC) {
509 freeaddrinfo(nai);
512 nai->ai_canonname = canonname;
516 ai2sin(nai)->sin_family = PF_INET;
518 ai2sin(nai)->sin_port = port;
519 cur->ai_next = nai;
520 cur = nai;
561 struct addrinfo *nai;
653 nai = malloc(sizeof (struct addrinfo));
654 if (nai == NULL)
656 *nai = *aip;
658 nai->ai_addr = malloc(addrlen);
659 if (nai->ai_addr == NULL) {
660 freeaddrinfo(nai);
663 bzero(nai->ai_addr, addrlen);
664 nai->ai_addrlen = addrlen;
665 nai->ai_family = PF_INET6;
668 (void) memcpy(ai2sin6(nai)->sin6_addr.s6_addr,
670 nai->ai_canonname = NULL;
671 if ((nai->ai_flags & AI_CANONNAME) && firsttime) {
674 freeaddrinfo(nai);
677 nai->ai_canonname = canonname;
681 ai2sin6(nai)->sin6_family = PF_INET6;
683 ai2sin6(nai)->sin6_port = port;
692 getscopeidfromzone(ai2sin6(nai), zonestr,
694 &ai2sin6(nai)->sin6_scope_id)) != 0) {
699 ai2sin6(nai)->sin6_scope_id = 0;
703 nai = malloc(sizeof (struct addrinfo));
704 if (nai == NULL)
706 *nai = *aip;
708 nai->ai_addr = malloc(addrlen);
709 if (nai->ai_addr == NULL) {
710 freeaddrinfo(nai);
713 bzero(nai->ai_addr, addrlen);
714 nai->ai_addrlen = addrlen;
715 nai->ai_family = PF_INET;
717 (void) memcpy(&(ai2sin(nai)->sin_addr.s_addr),
719 nai->ai_canonname = NULL;
720 if (nai->ai_flags & AI_CANONNAME && firsttime) {
723 freeaddrinfo(nai);
726 nai->ai_canonname = canonname;
730 ai2sin(nai)->sin_family = PF_INET;
732 ai2sin(nai)->sin_port = port;
735 cur->ai_next = nai;
736 cur = nai;