ipv6地址合法性、ipcalc、ipv6网关报错ipv6_add_route

520阅读 0评论2020-07-20 可怜的猪头
分类:LINUX






int net_is_validipv6(const char *hostname)
{
struct sockaddr_in6 addr;

if (!hostname) return -1;
if (strchr(hostname, '.')) return -1;//暂时排除::ffff:204.152.189.116
if (inet_pton(AF_INET6, hostname, &addr.sin6_addr) != 1) return -1;
   
return 0;
}


上一篇:K8S:创建pod资源两种方式: kubectl命令 && yaml文件
下一篇:get_fs()和set_fs()解析