--- v2.2.16/net/ipv4/icmp.c	Sun Sep 17 21:19:10 2000
+++ linux/net/ipv4/icmp.c	Mon Jun 26 21:04:34 2000
@@ -693,14 +693,36 @@
 	if(icmph->type==ICMP_DEST_UNREACH) {
 		switch(icmph->code & 15) {
 			case ICMP_NET_UNREACH:
+  printk(KERN_INFO "ICMP: Network Unreachable for %s\n",
+         in_ntoa(iph->daddr));
 				break;
 			case ICMP_HOST_UNREACH:
+  printk(KERN_INFO "ICMP: Host Unreachable for %s\n",
+         in_ntoa(iph->daddr));
 				break;
 			case ICMP_PROT_UNREACH:
+  printk(KERN_INFO "ICMP: %s:%d: protocol unreachable.\n",
+                in_ntoa(iph->daddr), (int)iph->protocol);
 				break;
 			case ICMP_PORT_UNREACH:
+				switch(iph->protocol) {
+				  case IPPROTO_TCP:
+				    {
+				    struct tcphdr *th = (struct tcphdr *)(((unsigned char *)iph)+(iph->ihl<<2));
+ 				    printk(KERN_INFO "ICMP: Port Unreachable from %s (TCP port %d)\n",in_ntoa(iph->daddr),ntohs(th->dest));
+				    break;
+ 				    }
+				  case IPPROTO_UDP:
+				    {
+				    struct udphdr *uh = (struct udphdr *)(((unsigned char *)iph)+(iph->ihl<<2));
+				    printk(KERN_INFO "ICMP: Port Unreachable from %s (UDP port %d)\n",in_ntoa(iph->daddr),ntohs(uh->dest));
+				    break;
+				    }
+				}
 				break;
 			case ICMP_FRAG_NEEDED:
+                printk(KERN_INFO "ICMP: Fragmentation Needed from %s\n",
+                        in_ntoa(iph->daddr));
 				if (ipv4_config.no_pmtu_disc) {
 					if (sysctl_ip_always_defrag == 0 && net_ratelimit())
 						printk(KERN_INFO "ICMP: %d.%d.%d.%d: fragmentation needed and DF set.\n",
@@ -714,6 +736,8 @@
 				}
 				break;
 			case ICMP_SR_FAILED:
+                printk(KERN_INFO "ICMP: Source Route Failed from %s\n",
+                        in_ntoa(iph->daddr));
 				if (sysctl_ip_always_defrag == 0 && net_ratelimit())
 					printk(KERN_INFO "ICMP: %d.%d.%d.%d: Source Route Failed.\n", NIPQUAD(iph->daddr));
 				break;
@@ -812,6 +836,9 @@
 	iph = (struct iphdr *) (icmph + 1);
 	ip = iph->daddr;
 
+        printk(KERN_INFO "ICMP: Redirect from %s\n",
+               in_ntoa(ip));
+
 	switch(icmph->code & 7) {
 		case ICMP_REDIR_NET:
 		case ICMP_REDIR_NETTOS:
@@ -849,6 +876,8 @@
 		icmp_param.data_len=len;
 		icmp_reply(&icmp_param, skb);
 	}
+  printk(KERN_INFO "ICMP: Ping received from %s\n",
+         in_ntoa(skb->nh.iph->saddr));
 }
 
 /*
@@ -877,7 +906,10 @@
 	/*
 	 *	Fill in the current time as ms since midnight UT: 
 	 */
-	 
+
+  printk(KERN_INFO "ICMP: Timestamp received from %s\n",
+         in_ntoa(skb->nh.iph->saddr));
+ 
 	do_gettimeofday(&tv);
 	times[1] = htonl((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000);
 	times[2] = times[1];
@@ -962,6 +994,30 @@
 		       ntohl(mask), ntohl(rt->rt_src), dev->name);
 }
 
+static void icmp_ereply(struct icmphdr *icmph, struct sk_buff *skb, int len)
+{
+  printk(KERN_INFO "ICMP: Ping reply received from %s\n",
+         in_ntoa(skb->nh.iph->saddr));
+}
+
+static void icmp_info(struct icmphdr *icmph, struct sk_buff *skb, int len)
+{
+  printk(KERN_INFO "ICMP: Info received from %s\n",
+         in_ntoa(skb->nh.iph->saddr));
+}
+
+static void icmp_ireply(struct icmphdr *icmph, struct sk_buff *skb, int len)
+{
+  printk(KERN_INFO "ICMP: Info reply received from %s\n",
+         in_ntoa(skb->nh.iph->saddr));
+}
+
+static void icmp_treply(struct icmphdr *icmph, struct sk_buff *skb, int len)
+{
+  printk(KERN_INFO "ICMP: Timestamp reply received from %s\n",
+         in_ntoa(skb->nh.iph->saddr));
+}
+
 static void icmp_discard(struct icmphdr *icmph, struct sk_buff *skb, int len)
 {
 }
@@ -1105,7 +1161,7 @@
  
 static struct icmp_control icmp_pointers[NR_ICMP_TYPES+1] = {
 /* ECHO REPLY (0) */
- { &icmp_statistics.IcmpOutEchoReps, &icmp_statistics.IcmpInEchoReps, icmp_discard, 0, &sysctl_icmp_echoreply_time},
+ { &icmp_statistics.IcmpOutEchoReps, &icmp_statistics.IcmpInEchoReps, icmp_ereply, 0, &sysctl_icmp_echoreply_time},
  { &dummy, &icmp_statistics.IcmpInErrors, icmp_discard, 1, },
  { &dummy, &icmp_statistics.IcmpInErrors, icmp_discard, 1, },
 /* DEST UNREACH (3) */
@@ -1127,11 +1183,11 @@
 /* TIMESTAMP (13) */
  { &icmp_statistics.IcmpOutTimestamps, &icmp_statistics.IcmpInTimestamps, icmp_timestamp, 0,  },
 /* TIMESTAMP REPLY (14) */
- { &icmp_statistics.IcmpOutTimestampReps, &icmp_statistics.IcmpInTimestampReps, icmp_discard, 0, },
+ { &icmp_statistics.IcmpOutTimestampReps, &icmp_statistics.IcmpInTimestampReps, icmp_treply, 0, },
 /* INFO (15) */
- { &dummy, &dummy, icmp_discard, 0, },
+ { &dummy, &dummy, icmp_info, 0, },
 /* INFO REPLY (16) */
- { &dummy, &dummy, icmp_discard, 0, },
+ { &dummy, &dummy, icmp_ireply, 0, },
 /* ADDR MASK (17) */
  { &icmp_statistics.IcmpOutAddrMasks, &icmp_statistics.IcmpInAddrMasks, icmp_address, 0,  },
 /* ADDR MASK REPLY (18) */

