bool dns_name_equal(const char *name1, const char *name2)
{
	size_t len1 = strlen(name1);
	size_t len2 = strlen(name2);

	if (len1 > 0 && name1[len1 - 1] == '.') {
		len1--;
	}
	if (len2 > 0 && name2[len2 - 1] == '.') {
		len2--;
	}
	if (len1 != len2) {
		return false;
	}
	return strncasecmp(name1, name2, len1) == 0;
}
bool dns_name_equal(const char *name1, const char *name2)
{
	size_t len1 = strlen(name1);
	size_t len2 = strlen(name2);

	if (len1 > 0 && name1[len1 - 1] == '.') {
		len1--;
	}
	if (len2 > 0 && name2[len2 - 1] == '.') {
		len2--;
	}
	if (len1 != len2) {
		return false;
	}
	return strncasecmp(name1, name2, len1) == 0;
}