[Linux] 求问: Linux 怎么检测从接口中获取的 ipv6 地址是不是临时地址

struct ifaddrs *ifaddr, *ifa; int family, s; char *host = NULL; for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { family = ifa->ifa_addr->sa_family; if (family == AF_INET6) { if ((host = malloc(NI_MAXHOST)) == NULL) return NULL; s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); if (s != 0) { return NULL; } printf("%s %d %s \n\n",ifa->ifa_name,ifaddr->ifa_flags,host); } }

发表回复

您的电子邮箱地址不会被公开。