From: Lennart Poettering Date: Mon, 21 Jan 2019 17:34:00 +0000 (+0100) Subject: transaction: simplify handling if we get an unexpected DNS packet via TCP X-Git-Tag: v242-rc1~276^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8227cfa137d8a930519717b752128b8d035b83e5;p=thirdparty%2Fsystemd.git transaction: simplify handling if we get an unexpected DNS packet via TCP There's no point in calling on_stream_complete() as it doesn't do anything with the zero argument. Let's hence simplify this and just log. --- diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index 075dfac01bd..50c007c3078 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -540,12 +540,8 @@ static int on_stream_packet(DnsStream *s) { if (t) return dns_transaction_on_stream_packet(t, p); - /* Ignore incorrect transaction id as transaction can have been canceled */ - if (dns_packet_validate_reply(p) <= 0) { - log_debug("Invalid TCP reply packet."); - on_stream_complete(s, 0); - } - + /* Ignore incorrect transaction id as an old transaction can have been canceled. */ + log_debug("Received unexpected TCP reply packet with id %" PRIu16 ", ignoring.", t->id); return 0; } @@ -639,8 +635,8 @@ static int dns_transaction_emit_tcp(DnsTransaction *t) { if (t->server) { dns_server_unref_stream(t->server); - t->server->stream = dns_stream_ref(s); s->server = dns_server_ref(t->server); + t->server->stream = dns_stream_ref(s); } s->complete = on_stream_complete;