From: Lennart Poettering Date: Mon, 22 Nov 2021 10:13:26 +0000 (+0100) Subject: resolved: include IP address info in debug output for incoming datagrams X-Git-Tag: v250-rc1~186^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f96b500eced522adb56e4e79a876c6a9471bb134;p=thirdparty%2Fsystemd.git resolved: include IP address info in debug output for incoming datagrams --- diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index 246e2d9db7c..431093ad01c 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -880,8 +880,16 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) { p->ifindex = manager_find_ifindex(m, p->family, &p->destination); } - log_debug("Received %s UDP packet of size %zu, ifindex=%i, ttl=%i, fragsize=%zu", - dns_protocol_to_string(protocol), p->size, p->ifindex, p->ttl, p->fragsize); + if (DEBUG_LOGGING) { + _cleanup_free_ char *sender_address = NULL, *destination_address = NULL; + + (void) in_addr_to_string(p->family, &p->sender, &sender_address); + (void) in_addr_to_string(p->family, &p->destination, &destination_address); + + log_debug("Received %s UDP packet of size %zu, ifindex=%i, ttl=%i, fragsize=%zu, sender=%s, destination=%s", + dns_protocol_to_string(protocol), p->size, p->ifindex, p->ttl, p->fragsize, + strna(sender_address), strna(destination_address)); + } *ret = TAKE_PTR(p); return 1;