diff options
author | Tom Gundersen <teg@jklm.no> | 2015-08-21 15:26:45 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-08-21 15:26:45 +0200 |
commit | ef7051360aefca01d20f700ee74ac1baced59879 (patch) | |
tree | 7e74c19fc5928d35012d1ff99ddce20406cf92a6 /src/resolve/resolved-dns-rr.c | |
parent | 6b8b67e7aed7d4f98881f823b89f5f4079e52066 (diff) | |
parent | 78c6a153c47f8d597c827bdcaf8c4e42ac87f738 (diff) |
Merge pull request #1002 from poettering/resolved-various
resolved: synthesize more RRs locally and other fixes
Diffstat (limited to 'src/resolve/resolved-dns-rr.c')
-rw-r--r-- | src/resolve/resolved-dns-rr.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c index ad7ca26cfe..f31644eebc 100644 --- a/src/resolve/resolved-dns-rr.c +++ b/src/resolve/resolved-dns-rr.c @@ -350,6 +350,36 @@ int dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const u return 0; } +int dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name) { + DnsResourceRecord *rr; + + assert(ret); + assert(address); + assert(family); + + if (family == AF_INET) { + + rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_A, name); + if (!rr) + return -ENOMEM; + + rr->a.in_addr = address->in; + + } else if (family == AF_INET6) { + + rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_AAAA, name); + if (!rr) + return -ENOMEM; + + rr->aaaa.in6_addr = address->in6; + } else + return -EAFNOSUPPORT; + + *ret = rr; + + return 0; +} + int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b) { int r; |