diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-28 22:42:58 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-28 22:42:58 +0000 |
commit | 22ba10e603c6b27c70aaeec1c6d690cd8dbe44ed (patch) | |
tree | 7372d9fd730b387baf35961574bb26a6b437b903 /sys/netinet/ip_icmp.c | |
parent | 6dc6026ab91dde19e61082beda57e0bd2a2f6629 (diff) |
add inet_ntoa() to the kernel. use it to log nicer messages. idea from freebsd
Diffstat (limited to 'sys/netinet/ip_icmp.c')
-rw-r--r-- | sys/netinet/ip_icmp.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index e0d9ee6f7c7..ad8dbddd243 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -190,10 +190,13 @@ icmp_input(m, hlen) * that not corrupted and of at least minimum length. */ #ifdef ICMPPRINTFS - if (icmpprintfs) - printf("icmp_input from %x to %x, len %d\n", - ntohl(ip->ip_src.s_addr), ntohl(ip->ip_dst.s_addr), - icmplen); + if (icmpprintfs) { + char buf[4*sizeof "123"]; + + strcpy(buf, inet_ntoa(ip->ip_dst)); + printf("icmp_input from %s to %s, len %d\n", + inet_ntoa(ip->ip_src), buf, icmplen); + } #endif if (icmplen < ICMP_MINLEN) { icmpstat.icps_tooshort++; @@ -367,9 +370,13 @@ reflect: icmpgw.sin_addr = ip->ip_src; icmpdst.sin_addr = icp->icmp_gwaddr; #ifdef ICMPPRINTFS - if (icmpprintfs) - printf("redirect dst %x to %x\n", icp->icmp_ip.ip_dst, - icp->icmp_gwaddr); + if (icmpprintfs) { + char buf[4 * sizeof "123"]; + strcpy(buf, inet_ntoa(icp->icmp_ip.ip_dst)); + + printf("redirect dst %s to %s\n", + buf, inet_ntoa(icp->icmp_gwaddr)); + } #endif icmpsrc.sin_addr = icp->icmp_ip.ip_dst; rtredirect(sintosa(&icmpsrc), sintosa(&icmpdst), @@ -545,8 +552,13 @@ icmp_send(m, opts) m->m_data -= hlen; m->m_len += hlen; #ifdef ICMPPRINTFS - if (icmpprintfs) - printf("icmp_send dst %x src %x\n", ip->ip_dst, ip->ip_src); + if (icmpprintfs) { + char buf[4 * sizeof "123"]; + + strcpy(buf, inet_ntoa(ip->ip_dst)); + printf("icmp_send dst %s src %s\n", + buf, inet_ntoa(ip->ip_src)); + } #endif (void) ip_output(m, opts, NULL, 0, NULL); } |