From 261e743d66d3f666cd3a683a044c428c241ca457 Mon Sep 17 00:00:00 2001 From: Eric Norum Date: Tue, 30 May 2006 15:12:54 +0000 Subject: Add flag to inhibit ICMP replies. --- cpukit/libnetworking/netinet/icmp_var.h | 1 + cpukit/libnetworking/netinet/ip_icmp.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'cpukit/libnetworking/netinet') diff --git a/cpukit/libnetworking/netinet/icmp_var.h b/cpukit/libnetworking/netinet/icmp_var.h index 8e005822ba..da74e58f98 100644 --- a/cpukit/libnetworking/netinet/icmp_var.h +++ b/cpukit/libnetworking/netinet/icmp_var.h @@ -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 */ }; diff --git a/cpukit/libnetworking/netinet/ip_icmp.c b/cpukit/libnetworking/netinet/ip_icmp.c index 564a785b04..7cd2668aa9 100644 --- a/cpukit/libnetworking/netinet/ip_icmp.c +++ b/cpukit/libnetworking/netinet/ip_icmp.c @@ -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; } -- cgit v1.2.3