Lines Matching refs:ifas
288 map_newlink (int index, struct ifaddrs_storage *ifas, int *map, int max) in map_newlink() argument
298 ifas[i - 1].ifa.ifa_next = &ifas[i].ifa; in map_newlink()
320 struct ifaddrs_storage *ifas; in getifaddrs_internal() local
417 ifas = (struct ifaddrs_storage *) calloc (1, in getifaddrs_internal()
421 if (ifas == NULL) in getifaddrs_internal()
431 ifa_data_ptr = (char *) &ifas[newlink + newaddr]; in getifaddrs_internal()
469 ifa_index = map_newlink (ifim->ifi_index - 1, ifas, in getifaddrs_internal()
475 free (ifas); in getifaddrs_internal()
478 ifas[ifa_index].ifa.ifa_flags = ifim->ifi_flags; in getifaddrs_internal()
488 if (rta_payload <= sizeof (ifas[ifa_index].addr)) in getifaddrs_internal()
490 ifas[ifa_index].addr.sl.sll_family = AF_PACKET; in getifaddrs_internal()
491 memcpy (ifas[ifa_index].addr.sl.sll_addr, in getifaddrs_internal()
493 ifas[ifa_index].addr.sl.sll_halen = rta_payload; in getifaddrs_internal()
494 ifas[ifa_index].addr.sl.sll_ifindex in getifaddrs_internal()
496 ifas[ifa_index].addr.sl.sll_hatype = ifim->ifi_type; in getifaddrs_internal()
498 ifas[ifa_index].ifa.ifa_addr in getifaddrs_internal()
499 = &ifas[ifa_index].addr.sa; in getifaddrs_internal()
504 if (rta_payload <= sizeof (ifas[ifa_index].broadaddr)) in getifaddrs_internal()
506 ifas[ifa_index].broadaddr.sl.sll_family = AF_PACKET; in getifaddrs_internal()
507 memcpy (ifas[ifa_index].broadaddr.sl.sll_addr, in getifaddrs_internal()
509 ifas[ifa_index].broadaddr.sl.sll_halen = rta_payload; in getifaddrs_internal()
510 ifas[ifa_index].broadaddr.sl.sll_ifindex in getifaddrs_internal()
512 ifas[ifa_index].broadaddr.sl.sll_hatype in getifaddrs_internal()
515 ifas[ifa_index].ifa.ifa_broadaddr in getifaddrs_internal()
516 = &ifas[ifa_index].broadaddr.sa; in getifaddrs_internal()
521 if ((rta_payload + 1) <= sizeof (ifas[ifa_index].name)) in getifaddrs_internal()
523 ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name; in getifaddrs_internal()
524 *(char *) __mempcpy (ifas[ifa_index].name, rta_data, in getifaddrs_internal()
530 ifas[ifa_index].ifa.ifa_data = ifa_data_ptr; in getifaddrs_internal()
532 memcpy (ifas[ifa_index].ifa.ifa_data, rta_data, in getifaddrs_internal()
562 int idx = map_newlink (ifam->ifa_index - 1, ifas, in getifaddrs_internal()
566 ifas[ifa_index].ifa.ifa_flags = ifas[idx].ifa.ifa_flags; in getifaddrs_internal()
568 ifas[ifa_index - 1].ifa.ifa_next = &ifas[ifa_index].ifa; in getifaddrs_internal()
582 if (ifas[ifa_index].ifa.ifa_addr != NULL) in getifaddrs_internal()
590 ifas[ifa_index].ifa.ifa_broadaddr in getifaddrs_internal()
591 = &ifas[ifa_index].broadaddr.sa; in getifaddrs_internal()
592 sa = &ifas[ifa_index].broadaddr.sa; in getifaddrs_internal()
596 ifas[ifa_index].ifa.ifa_addr in getifaddrs_internal()
597 = &ifas[ifa_index].addr.sa; in getifaddrs_internal()
598 sa = &ifas[ifa_index].addr.sa; in getifaddrs_internal()
626 if (rta_payload <= sizeof (ifas[ifa_index].addr)) in getifaddrs_internal()
634 if (ifas[ifa_index].ifa.ifa_addr != NULL) in getifaddrs_internal()
639 ifas[ifa_index].broadaddr = ifas[ifa_index].addr; in getifaddrs_internal()
640 ifas[ifa_index].ifa.ifa_broadaddr in getifaddrs_internal()
641 = &ifas[ifa_index].broadaddr.sa; in getifaddrs_internal()
642 memset (&ifas[ifa_index].addr, '\0', in getifaddrs_internal()
643 sizeof (ifas[ifa_index].addr)); in getifaddrs_internal()
646 ifas[ifa_index].ifa.ifa_addr = &ifas[ifa_index].addr.sa; in getifaddrs_internal()
647 ifas[ifa_index].ifa.ifa_addr->sa_family in getifaddrs_internal()
655 memcpy (&ifas[ifa_index].addr.s4.sin_addr, in getifaddrs_internal()
663 memcpy (&ifas[ifa_index].addr.s6.sin6_addr, in getifaddrs_internal()
667 ifas[ifa_index].addr.s6.sin6_scope_id = in getifaddrs_internal()
673 if (rta_payload <= sizeof (ifas[ifa_index].addr)) in getifaddrs_internal()
674 memcpy (ifas[ifa_index].addr.sa.sa_data, in getifaddrs_internal()
682 if (ifas[ifa_index].ifa.ifa_broadaddr != NULL) in getifaddrs_internal()
683 memset (&ifas[ifa_index].broadaddr, '\0', in getifaddrs_internal()
684 sizeof (ifas[ifa_index].broadaddr)); in getifaddrs_internal()
686 ifas[ifa_index].ifa.ifa_broadaddr in getifaddrs_internal()
687 = &ifas[ifa_index].broadaddr.sa; in getifaddrs_internal()
688 ifas[ifa_index].ifa.ifa_broadaddr->sa_family in getifaddrs_internal()
696 memcpy (&ifas[ifa_index].broadaddr.s4.sin_addr, in getifaddrs_internal()
704 memcpy (&ifas[ifa_index].broadaddr.s6.sin6_addr, in getifaddrs_internal()
708 ifas[ifa_index].broadaddr.s6.sin6_scope_id in getifaddrs_internal()
714 if (rta_payload <= sizeof (ifas[ifa_index].addr)) in getifaddrs_internal()
715 memcpy (&ifas[ifa_index].broadaddr.sa.sa_data, in getifaddrs_internal()
722 if (rta_payload + 1 <= sizeof (ifas[ifa_index].name)) in getifaddrs_internal()
724 ifas[ifa_index].ifa.ifa_name = ifas[ifa_index].name; in getifaddrs_internal()
725 *(char *) __mempcpy (ifas[ifa_index].name, rta_data, in getifaddrs_internal()
745 if (ifas[ifa_index].ifa.ifa_name == NULL) in getifaddrs_internal()
747 int idx = map_newlink (ifam->ifa_index - 1, ifas, in getifaddrs_internal()
751 ifas[ifa_index].ifa.ifa_name = ifas[idx].ifa.ifa_name; in getifaddrs_internal()
755 if (ifas[ifa_index].ifa.ifa_addr in getifaddrs_internal()
756 && ifas[ifa_index].ifa.ifa_addr->sa_family != AF_UNSPEC in getifaddrs_internal()
757 && ifas[ifa_index].ifa.ifa_addr->sa_family != AF_PACKET) in getifaddrs_internal()
762 ifas[ifa_index].ifa.ifa_netmask in getifaddrs_internal()
763 = &ifas[ifa_index].netmask.sa; in getifaddrs_internal()
765 switch (ifas[ifa_index].ifa.ifa_addr->sa_family) in getifaddrs_internal()
768 cp = (char *) &ifas[ifa_index].netmask.s4.sin_addr; in getifaddrs_internal()
773 cp = (char *) &ifas[ifa_index].netmask.s6.sin6_addr; in getifaddrs_internal()
778 ifas[ifa_index].ifa.ifa_netmask->sa_family in getifaddrs_internal()
779 = ifas[ifa_index].ifa.ifa_addr->sa_family; in getifaddrs_internal()
800 assert (ifa_data_ptr <= (char *) &ifas[newlink + newaddr] + ifa_data_size); in getifaddrs_internal()
809 ifas[i - 1].ifa.ifa_next = &ifas[newlink].ifa; in getifaddrs_internal()
815 memmove (ifas, &ifas[newlink], sizeof (struct ifaddrs_storage)); in getifaddrs_internal()
818 *ifap = &ifas[0].ifa; in getifaddrs_internal()