diff options
author | ru <ru@FreeBSD.org> | 2000-03-14 14:11:53 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2000-03-14 14:11:53 +0000 |
commit | f28f5915b49f6d545fba83143777714ea348e195 (patch) | |
tree | b399783c0fcf110bd2b1d1867085e3d819795010 /sys/netinet/ip_fw.c | |
parent | ee02aafa7242015ae9346fb8323eccc7451c28ae (diff) | |
download | FreeBSD-src-f28f5915b49f6d545fba83143777714ea348e195.zip FreeBSD-src-f28f5915b49f6d545fba83143777714ea348e195.tar.gz |
Fix reporting of src and dst IP addresses for ICMP and generic IP packets.
PR: 17319
Submitted by: Mike Heffner <spock@techfour.net>
Diffstat (limited to 'sys/netinet/ip_fw.c')
-rw-r--r-- | sys/netinet/ip_fw.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/netinet/ip_fw.c b/sys/netinet/ip_fw.c index 31da781..9482665 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; } |