summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-08-21 16:23:02 +0200
committerTom Gundersen <teg@jklm.no>2015-08-21 16:23:02 +0200
commit932b06b8fff181aad50ce3ff839865def5574454 (patch)
tree9985b4bcede7c6cd9cd8a3c305e6925bbfc49e98 /src/resolve
parent37ebef9873ba5cbcb2d26a0b0ebb749b13dfac79 (diff)
parent09b1fe142b6f4bdbf925e04a916b97e5eb445bcb (diff)
Merge pull request #1005 from poettering/resolved-refuse-compression
Don't do name compression when passing RRs across the bus
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/resolved-bus.c2
-rw-r--r--src/resolve/resolved-dns-packet.c22
-rw-r--r--src/resolve/resolved-dns-packet.h1
3 files changed, 21 insertions, 4 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index de5e8e9c29..1f23834ce3 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -542,6 +542,8 @@ static void bus_method_resolve_record_complete(DnsQuery *q) {
if (r < 0)
goto finish;
+ p->refuse_compression = true;
+
r = dns_packet_append_rr(p, answer->items[i].rr, &start);
if (r < 0)
goto finish;
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index ad337c2714..bebd1ee4a6 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -388,14 +388,21 @@ int dns_packet_append_label(DnsPacket *p, const char *d, size_t l, size_t *start
return 0;
}
-int dns_packet_append_name(DnsPacket *p, const char *name,
- bool allow_compression, size_t *start) {
+int dns_packet_append_name(
+ DnsPacket *p,
+ const char *name,
+ bool allow_compression,
+ size_t *start) {
+
size_t saved_size;
int r;
assert(p);
assert(name);
+ if (p->refuse_compression)
+ allow_compression = false;
+
saved_size = p->size;
while (*name) {
@@ -1053,8 +1060,12 @@ fail:
return r;
}
-int dns_packet_read_name(DnsPacket *p, char **_ret,
- bool allow_compression, size_t *start) {
+int dns_packet_read_name(
+ DnsPacket *p,
+ char **_ret,
+ bool allow_compression,
+ size_t *start) {
+
size_t saved_rindex, after_rindex = 0, jump_barrier;
_cleanup_free_ char *ret = NULL;
size_t n = 0, allocated = 0;
@@ -1064,6 +1075,9 @@ int dns_packet_read_name(DnsPacket *p, char **_ret,
assert(p);
assert(_ret);
+ if (p->refuse_compression)
+ allow_compression = false;
+
saved_rindex = p->rindex;
jump_barrier = p->rindex;
diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h
index 58559c85df..e81f8a8202 100644
--- a/src/resolve/resolved-dns-packet.h
+++ b/src/resolve/resolved-dns-packet.h
@@ -86,6 +86,7 @@ struct DnsPacket {
uint32_t ttl;
bool extracted;
+ bool refuse_compression;
};
static inline uint8_t* DNS_PACKET_DATA(DnsPacket *p) {