Repository navigation
resolve: add support to read mDNS cache - #20053
aditiambadkar wants to merge 2 commits into
Conversation
2b5c698 to
8b0578d
Compare
This comment has been minimized.
This comment has been minimized.
|
Maybe conflict with #19104? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8b0578d to
225696f
Compare
Yeah, there's overlap |
Thanks. So, @aditiambadkar I do not want to block your work, but please see the suggestion in #19104 by @poettering about to use json format. |
|
@bluca - 3 of my checks have failed:
Do you know the reason and can you provide any suggestions? |
|
The network tests failed, it looks like it might be related: |
|
In the other CI resolved crashes, again looks like it could be related: |
00d694e to
617e26b
Compare
@bluca : |
cdfbcc4 to
4c1a7d6
Compare
Sure thing! journalDetails from the coredump: Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000565337e61e3b in dns_transaction_cache_answer (t=t@entry=0x5653396ccbc0) at ../build/src/resolve/resolved-dns-transaction.c:817
817 dns_cache_put(&t->scope->cache,
(gdb) list 812,834
812 /* Packet from localhost? */
813 if (!t->scope->manager->cache_from_localhost &&
814 in_addr_is_localhost(t->received->family, &t->received->sender) != 0)
815 return;
816
817 dns_cache_put(&t->scope->cache,
818 t->scope->manager->enable_cache,
819 dns_transaction_key(t),
820 t->answer_rcode,
821 t->answer,
822 DNS_PACKET_CD(t->received) ? t->received : NULL, /* only cache full packets with CD on,
823 * since our usecase for caching them
824 * is "bypass" mode which is only
825 * enabled for CD packets. */
826 t->answer_query_flags,
827 t->answer_dnssec_result,
828 t->answer_nsec_ttl,
829 t->received->family,
830 &t->received->sender,
831 t->scope->link->ifname,
832 t->scope->protocol);
833 }
834
(gdb) set print pretty
(gdb) p *(t->scope)
$3 = {
manager = 0x5653391269c0,
protocol = DNS_PROTOCOL_DNS,
family = 0,
dnssec_mode = DNSSEC_ALLOW_DOWNGRADE,
dns_over_tls_mode = DNS_OVER_TLS_NO,
link = 0x0,
cache = {
by_key = 0x0,
by_expiry = 0x0,
n_hit = 0,
n_miss = 7
},
zone = {
by_key = 0x0,
by_name = 0x0
},
conflict_queue = 0x0,
conflict_event_source = 0x0,
announce_event_source = 0x0,
ratelimit = {
interval = 1000000,
burst = 1000,
num = 0,
begin = 0
},
resend_timeout = 100000,
max_rtt = 0,
query_candidates = 0x5653391e4610,
transactions_by_key = 0x5653391275a0,
transactions = 0x5653396ccbc0,
scopes_next = 0x0,
scopes_prev = 0x5653391a0e70,
announced = false
}
(gdb) p t->scope->link
$4 = (Link *) 0x0Looks like a similar issue - |
b11a7d6 to
95a59bc
Compare
-"ShowCaches" takes no parameters and returns an array of structures - Each structure represents a cache entry and comprises - Interface, Protocol, Name, Type and Domain - Emit D-Bus signals ItemNew, ItemRemove, CacheExhausted and AllForNow on the basis of events - sd-bus API implements the D-Bus methods and signals
-"resolvectl show-caches" displays the mDNS cache entries on the terminal -Each cache entry comprises: Interface, Protocol, Name, Type and Domain
95a59bc to
8e25a3c
Compare
|
@mrc0mmand - Thank you for the guidance! I have resolved all the issues and all the checks have passed. |
@poettering - Where exactly should the JSON format be used in my case? Should it be used in the ShowCaches D-Bus method or the resolvectl show-caches command-line tool or both? |
|
@bluca @poettering @yuwata - I have implemented the JSON format for the cache entries. Currently, I am sending the cache entries in form of a JSON string similar to PR #19451 over the D-Bus and displaying them using the My question is - is it sufficient to display the cache in JSON format only or should it also be displayed in a tabular format? |
|
the command line tool output should be in table format, as all other tools are already doing, with a --json switch to output pure json |
Going forward, there are two possible options:
or
Which option is preferable? |
|
The second one, see: #19104 (comment) |
|
What is the usecase for this? I mean I can see that it is useful to dump the cache, but have a live view of it? what#s the point? D-Bus really sucs for bulk data and for high-frequency updates. it's not for that, it's for control msgs. I'd probably put the cache dumping in the varlink server we already expose. unlike dbus it supports bulk data and via the "continues" stuff also allows us to notify clients efficeintly. BTW, please make sure to always follow coding style. Glancing over the PR shows not even the most basic indenting rules are followed. as your additions follow a completely diffeent indentation then the rest of the file. https://systemd.io/CODING_STYLE |
@poettering What is your recommendation to implement something like avahi-browse that will be acceptable upstream and usable by us? |
|
So I understand you intend to browse for DNS-SD/mDNS services? we should have a proper, high-level API for that in resolved, modelled after the existing ResolveXYZ APIs, but called BrowseServices(), and since browsing is a long-running op this must allocate some server side object that fires service add/service remove signals, and then is destroy with another call BrowseServicesClose(). BrowseServices() should implement service browsing as is described in the DNS-SD/mDNS pair of RFCs. |
@poettering
The client would call the BrowseServices() API and subscribe to the D-Bus signals (ItemNew, ItemRemove). Does this overall workflow sound okay? |
@poettering I request you to please look at this |
|
We are re-implementing this PR however before just want to reconfirm that you would like to have implementation of BrowseServices API for mDNS/DNS-SD in varlink IPC rather than SMBUS IPC like io.systemd.Resolve.ResolveHostname and io.systemd.Resolve.ResolveAddress? |
|
@poettering |
… all of resolved's RR caches This adds a simple varlink call io.systemd.Resolve.Monitor.DumpCache to the existing io.systemd.Resolve.Monitor service. It compiles a JSON object containing the per-scope cache entries and returns it. Replaces: systemd#20053 systemd#19104 Fixes: systemd#14796
|
#28012 contains a "resolvectl show-caches" verb that implements much of what was requested here, and builds on the varlink stuff recently added for the query monitoring stuff. Let's continue there. |
… all of resolved's RR caches This adds a simple varlink call io.systemd.Resolve.Monitor.DumpCache to the existing io.systemd.Resolve.Monitor service. It compiles a JSON object containing the per-scope cache entries and returns it. Replaces: systemd#20053 systemd#19104 Fixes: systemd#14796


Add support to read mDNS cache