summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-rr.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-31 21:06:00 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-07-31 08:56:03 -0400
commit946c70944ebdf428ffeb9991a7449edbd4011461 (patch)
tree8c684c2c65c4e2fcaa8d9a4b46faa70d733860ba /src/resolve/resolved-dns-rr.c
parentb93312f5960b276bae915906ccde36f545bae3e0 (diff)
resolved: MX records
Diffstat (limited to 'src/resolve/resolved-dns-rr.c')
-rw-r--r--src/resolve/resolved-dns-rr.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-rr.c b/src/resolve/resolved-dns-rr.c
index e1200c9bc0..2e13b9c51a 100644
--- a/src/resolve/resolved-dns-rr.c
+++ b/src/resolve/resolved-dns-rr.c
@@ -237,6 +237,8 @@ DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr) {
} else if (rr->key->type == DNS_TYPE_SOA) {
free(rr->soa.mname);
free(rr->soa.rname);
+ } else if (rr->key->type == DNS_TYPE_MX) {
+ free(rr->mx.exchange);
} else if (!IN_SET(rr->key->type, DNS_TYPE_A, DNS_TYPE_AAAA))
free(rr->generic.data);
@@ -322,6 +324,12 @@ int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecor
a->soa.retry == b->soa.retry &&
a->soa.expire == b->soa.expire &&
a->soa.minimum == b->soa.minimum;
+ case DNS_TYPE_MX:
+ if (a->mx.priority != b->mx.priority)
+ return 0;
+
+ return dns_name_equal(a->mx.exchange, b->mx.exchange);
+
default:
return a->generic.size == b->generic.size &&
memcmp(a->generic.data, b->generic.data, a->generic.size) == 0;
@@ -396,6 +404,15 @@ int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret) {
return -ENOMEM;
break;
+ case DNS_TYPE_MX:
+ r = asprintf(&s, "%s %u %s",
+ k,
+ rr->mx.priority,
+ rr->mx.exchange);
+ if (r < 0)
+ return -ENOMEM;
+ break;
+
default: {
_cleanup_free_ char *x = NULL;