summaryrefslogtreecommitdiff
path: root/src/resolve/test-dns-domain.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-29 19:49:45 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-29 20:57:58 +0200
commitb914e211f3a40f507b3cdc572838ec7f3fd5e4cf (patch)
treec1a0ec49b99a76c0108f2072b5a77eb398d99777 /src/resolve/test-dns-domain.c
parent623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbf (diff)
resolved: when resolving an address PTR record via llmnr, make a tcp connection by default
Diffstat (limited to 'src/resolve/test-dns-domain.c')
-rw-r--r--src/resolve/test-dns-domain.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/resolve/test-dns-domain.c b/src/resolve/test-dns-domain.c
index bd53402be8..dfe2a44eae 100644
--- a/src/resolve/test-dns-domain.c
+++ b/src/resolve/test-dns-domain.c
@@ -159,6 +159,24 @@ static void test_dns_name_single_label(void) {
assert_se(dns_name_single_label("xx.yy") == false);
}
+static void test_dns_name_reverse_one(const char *address, const char *name) {
+ _cleanup_free_ char *p = NULL;
+ union in_addr_union a, b;
+ int familya, familyb;
+
+ assert_se(in_addr_from_string_auto(address, &familya, &a) >= 0);
+ assert_se(dns_name_reverse(familya, &a, &p) >= 0);
+ assert_se(streq(p, name));
+ assert_se(dns_name_address(p, &familyb, &b) > 0);
+ assert_se(familya == familyb);
+ assert_se(in_addr_equal(familya, &a, &b));
+}
+
+static void test_dns_name_reverse(void) {
+ test_dns_name_reverse_one("47.11.8.15", "15.8.11.47.in-addr.arpa");
+ test_dns_name_reverse_one("fe80::47", "7.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa");
+}
+
int main(int argc, char *argv[]) {
test_dns_label_unescape();
@@ -168,6 +186,7 @@ int main(int argc, char *argv[]) {
test_dns_name_endswith();
test_dns_name_root();
test_dns_name_single_label();
+ test_dns_name_reverse();
return 0;
}