From 1e14daab904b4c74e1ee4edd081d42478aa5d12a Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Thu, 11 Dec 2008 20:11:42 +0100 Subject: [PATCH] Include host in invalid packet messages Include the source host in warning messages about invalid packets. This is a result of rhbz #438013 --- avahi-core/server.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/avahi-core/server.c b/avahi-core/server.c index 453db09..c4980af 100644 --- a/avahi-core/server.c +++ b/avahi-core/server.c @@ -941,26 +941,30 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres handle_query_packet(s, p, i, src_address, port, legacy_unicast, from_local_iface); } else { + char t[AVAHI_ADDRESS_STR_MAX]; + if (port != AVAHI_MDNS_PORT) { - avahi_log_warn("Recieved repsonse with invalid source port %u on interface '%s.%i'", port, i->hardware->name, i->protocol); + avahi_log_warn("Received response from host %s with invalid source port %u on interface '%s.%i'", avahi_address_snprint(t, sizeof(t), src_address), port, i->hardware->name, i->protocol); return; } if (ttl != 255 && s->config.check_response_ttl) { - avahi_log_warn("Recieved response with invalid TTL %u on interface '%s.%i'.", ttl, i->hardware->name, i->protocol); + avahi_log_warn("Received response from host %s with invalid TTL %u on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), ttl, i->hardware->name, i->protocol); return; } if (!is_mdns_mcast_address(dst_address) && !avahi_interface_address_on_link(i, src_address)) { - avahi_log_warn("Received non-local response on interface '%s.%i'.", i->hardware->name, i->protocol); + + avahi_log_warn("Received non-local response from host %s on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), i->hardware->name, i->protocol); return; } if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT) != 0 || avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0 || avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) != 0) { - avahi_log_warn("Invalid response packet."); + + avahi_log_warn("Invalid response packet from host %s.", avahi_address_snprint(t, sizeof(t), src_address)); return; } -- 1.6.0.5