From 2a94c854204833f8c3c3823091240cc4a60ce319 Mon Sep 17 00:00:00 2001 From: Eric Norum Date: Tue, 24 May 2005 00:36:35 +0000 Subject: Add "ICMP panic avoided" diagnostic counter. --- cpukit/ChangeLog | 5 +++++ cpukit/libnetworking/netinet/ip_icmp.c | 6 +++++- cpukit/libnetworking/rtems/rtems_showicmpstat.c | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index f6287721c1..a0e19d5a14 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2005-05-23 Eric Norum + + * libnetworking/rtems/rtems_showicmpstat.c + * libnetworking/netinet/ip_icmp.c: note that a panic has been avoided + 2005-05-23 Ralf Corsepius * Makefile.am: Remove ada. diff --git a/cpukit/libnetworking/netinet/ip_icmp.c b/cpukit/libnetworking/netinet/ip_icmp.c index 11e954dc9b..564a785b04 100644 --- a/cpukit/libnetworking/netinet/ip_icmp.c +++ b/cpukit/libnetworking/netinet/ip_icmp.c @@ -97,6 +97,7 @@ static void icmp_reflect(struct mbuf *); static void icmp_send(struct mbuf *, struct mbuf *); extern struct protosw inetsw[]; +unsigned int icmplenPanicAvoided; /* * Generate an error packet of type error @@ -139,8 +140,11 @@ icmp_error(n, type, code, dest, destifp) goto freeit; /* Don't send error in response to malicious packet */ icmplen = min(oiplen + 8, oip->ip_len); - if (icmplen < sizeof(struct ip)) + if (icmplen < sizeof(struct ip)) { + icmplenPanicAvoided++; goto freeit; + } + /* * First, formulate icmp message */ diff --git a/cpukit/libnetworking/rtems/rtems_showicmpstat.c b/cpukit/libnetworking/rtems/rtems_showicmpstat.c index dfe1bc45a4..13f378826a 100644 --- a/cpukit/libnetworking/rtems/rtems_showicmpstat.c +++ b/cpukit/libnetworking/rtems/rtems_showicmpstat.c @@ -36,6 +36,7 @@ rtems_bsdnet_show_icmp_stats (void) { int i; char cbuf[20]; + extern unsigned int icmplenPanicAvoided; printf ("************ ICMP Statistics ************\n"); showicmpstat ("Calls to icmp_error()", icmpstat.icps_error); @@ -59,6 +60,6 @@ rtems_bsdnet_show_icmp_stats (void) showicmpstat (cbuf, icmpstat.icps_inhist[i]); } } - + showicmpstat ("ICMP panic avoided", icmplenPanicAvoided); printf ("\n"); } -- cgit v1.2.3