]> git.ipfire.org Git - thirdparty/systemd.git/commit
resolved: pass mDNS reply packets to each transaction exactly once
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Mar 2021 17:36:41 +0000 (18:36 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 25 Mar 2021 10:37:30 +0000 (11:37 +0100)
commit8640566ac41447e07bb8b4e990626a17b183c80c
tree6ca32f5de1f43cb526fc631d7ed7630ed0b8d271
parent9b564bbca5fcfb251b7990c8642c82846d09338b
resolved: pass mDNS reply packets to each transaction exactly once

Previously we'd iterate through the RRs of an mDNS reply and then find
exactly one matching transaction on our scope for it, and pass it as
reply to that. If multiple RRs of the same packet match we'd pas the
packet multiple times to the transaction even.

This all doesn't really work anymore since there can be multiple open
transactions for the same key (with different flags), and it's kinda
ugly anywy. Hence let's turn this around: let's iterate through the
transactions and check if any of the included RRs match it, and if so
pass the packet to that transaction exactly once.

This speeds up mDNS a bit, since previously we'd oftentimes fail to find
all suitable transactions for an mDNS reply (because there can be
multiple transactions for the same RR key with different flags, and we
checked exactly one flag combination). Which would then mean the
transaction would time out, and be retried – at which point the cache
would be populated and thus it would still succeed, but only after this
timeout. With this fix this is corrected: every transaction that matches
will get the reply, instantly as we get it.
src/resolve/resolved-mdns.c