From d137714f115a3c41662c4d8a0fc21e6d6f9a4b4e Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 14 Mar 2000 14:11:53 +0000 Subject: [PATCH] Fix reporting of src and dst IP addresses for ICMP and generic IP packets. PR: 17319 Submitted by: Mike Heffner --- sys/netinet/ip_fw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c index 31da78191633..94826659dca3 100644 --- a/sys/netinet/ip_fw.c +++ b/sys/netinet/ip_fw.c @@ -464,7 +464,6 @@ ipfw_report(struct ip_fw *f, struct ip *ip, } } - len = 0; switch (ip->ip_p) { case IPPROTO_TCP: len = snprintf(SNPARGS(proto, 0), "TCP %s", @@ -500,12 +499,14 @@ ipfw_report(struct ip_fw *f, struct ip *ip, icmp->icmp_type, icmp->icmp_code); else len = snprintf(SNPARGS(proto, 0), "ICMP "); - snprintf(SNPARGS(proto, len), "%s %s", inet_ntoa(ip->ip_src), - inet_ntoa(ip->ip_dst)); + len += snprintf(SNPARGS(proto, len), "%s", + inet_ntoa(ip->ip_src)); + snprintf(SNPARGS(proto, len), " %s", inet_ntoa(ip->ip_dst)); break; default: - snprintf(SNPARGS(proto, 0), "P:%d %s %s", ip->ip_p, - inet_ntoa(ip->ip_src), inet_ntoa(ip->ip_dst)); + len = snprintf(SNPARGS(proto, 0), "P:%d %s", ip->ip_p, + inet_ntoa(ip->ip_src)); + snprintf(SNPARGS(proto, len), " %s", inet_ntoa(ip->ip_dst)); break; }