Add flag to inhibit ICMP replies.

This commit is contained in:
Eric Norum
2006-05-30 15:12:54 +00:00
parent ebbe2af238
commit 261e743d66
4 changed files with 16 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
2006-05-30 Eric Norum <norume@aps.anl.gov>
* libnetworking/netinet/icmp_var.h,
libnetworking/netinet/ip_icmp.c,
libnetworking/rtems/rtems_showicmpstat.c: Add flag to inhibit ICMP replies.
2006-05-25 Eric Norum <norume@aps.anl.gov>
* libnetworking/Makefile.am,

View File

@@ -54,6 +54,7 @@ struct icmpstat {
u_long icps_badlen; /* calculated bound mismatch */
u_long icps_reflect; /* number of responses */
u_long icps_inhist[ICMP_MAXTYPE + 1];
u_long icps_allecho; /* all echo requests dropped */
u_long icps_bmcastecho; /* b/mcast echo requests dropped */
u_long icps_bmcasttstamp; /* b/mcast tstamp requests dropped */
};

View File

@@ -88,6 +88,10 @@ static int icmpbmcastecho = 1;
SYSCTL_INT(_net_inet_icmp, OID_AUTO, bmcastecho, CTLFLAG_RW, &icmpbmcastecho,
0, "");
static int icmpallecho = 1;
SYSCTL_INT(_net_inet_icmp, OID_AUTO, allecho, CTLFLAG_RW, &icmpallecho,
0, "");
/* #define ICMPPRINTFS 1 */
#ifdef ICMPPRINTFS
int icmpprintfs = 0;
@@ -399,9 +403,10 @@ icmp_input(m, off)
break;
case ICMP_ECHO:
if (!icmpbmcastecho
&& (m->m_flags & (M_MCAST | M_BCAST)) != 0
&& IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
if (!icmpallecho
|| (!icmpbmcastecho
&& (m->m_flags & (M_MCAST | M_BCAST)) != 0
&& IN_MULTICAST(ntohl(ip->ip_dst.s_addr)))) {
icmpstat.icps_bmcastecho++;
break;
}

View File

@@ -52,6 +52,7 @@ rtems_bsdnet_show_icmp_stats (void)
showicmpstat ("bad checksum", icmpstat.icps_checksum);
showicmpstat ("calculated bound mismatch", icmpstat.icps_badlen);
showicmpstat ("number of responses", icmpstat.icps_reflect);
showicmpstat ("all echo requests dropped", icmpstat.icps_allecho);
showicmpstat ("b/mcast echo requests dropped", icmpstat.icps_bmcastecho);
showicmpstat ("b/mcast tstamp requests dropped", icmpstat.icps_bmcasttstamp);
for (i = 0 ; i <= ICMP_MAXTYPE ; i++) {