summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve/resolved-dns-packet.c')
-rw-r--r--src/resolve/resolved-dns-packet.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index ba6fb3d787..ba056f1f44 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -390,6 +390,7 @@ int dns_packet_append_name(DnsPacket *p, const char *name, size_t *start) {
_cleanup_free_ char *s = NULL;
char label[DNS_LABEL_MAX];
size_t n;
+ int k;
n = PTR_TO_SIZE(hashmap_get(p->names, name));
if (n > 0) {
@@ -414,6 +415,17 @@ int dns_packet_append_name(DnsPacket *p, const char *name, size_t *start) {
if (r < 0)
goto fail;
+ if (p->protocol == DNS_PROTOCOL_DNS)
+ k = dns_label_apply_idna(label, r, label, sizeof(label));
+ else
+ k = dns_label_undo_idna(label, r, label, sizeof(label));
+ if (k < 0) {
+ r = k;
+ goto fail;
+ }
+ if (k > 0)
+ r = k;
+
r = dns_packet_append_label(p, label, r, &n);
if (r < 0)
goto fail;