/* Check if an address matches a certain family.  */
int nl_addr_valid(char *addr, int family)
/* Check if an address matches a certain family.  */
int nl_addr_valid(char *addr, int family)
{
	int ret;
	char buf[32];
	switch (family) {
	case AF_INET:
	case AF_INET6:
		ret = inet_pton(family, addr, buf);
		if (ret <= 0)
			return 0;
		break;
	case AF_DECnet:
		ret = dnet_pton(addr, buf);
		if (ret <= 0)
			return 0;
		break;
	case AF_LLC:
		if (sscanf(addr, "%*02x:%*02x:%*02x:%*02x:%*02x:%*02x") != 6)
			return 0;
		break;
	}
	return 1;
}