mirror of
https://github.com/systemd/systemd.git
synced 2024-11-08 11:27:32 +03:00
Merge pull request #1005 from poettering/resolved-refuse-compression
Don't do name compression when passing RRs across the bus
This commit is contained in:
commit
932b06b8ff
@ -392,6 +392,8 @@ static int resolve_record(sd_bus *bus, const char *name) {
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
p->refuse_compression = true;
|
||||
|
||||
r = dns_packet_append_blob(p, d, l, NULL);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
@ -441,7 +443,7 @@ static void help_dns_types(void) {
|
||||
const char *t;
|
||||
|
||||
if (arg_legend)
|
||||
puts("Known dns types:");
|
||||
puts("Known DNS RR types:");
|
||||
for (i = 0; i < _DNS_TYPE_MAX; i++) {
|
||||
t = dns_type_to_string(i);
|
||||
if (t)
|
||||
@ -454,7 +456,7 @@ static void help_dns_classes(void) {
|
||||
const char *t;
|
||||
|
||||
if (arg_legend)
|
||||
puts("Known dns classes:");
|
||||
puts("Known DNS RR classes:");
|
||||
for (i = 0; i < _DNS_CLASS_MAX; i++) {
|
||||
t = dns_class_to_string(i);
|
||||
if (t)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -86,6 +86,7 @@ struct DnsPacket {
|
||||
uint32_t ttl;
|
||||
|
||||
bool extracted;
|
||||
bool refuse_compression;
|
||||
};
|
||||
|
||||
static inline uint8_t* DNS_PACKET_DATA(DnsPacket *p) {
|
||||
|
Loading…
Reference in New Issue
Block a user