Thinking again, it's nicer to move the raw redirection after the bmcastecho
processing:
Index: icmp_var.h
===================================================================
RCS file: /cvs/src/sys/netinet/icmp_var.h,v
retrieving revision 1.13
diff -d -u -p -w -r1.13 icmp_var.h
--- icmp_var.h 13 Dec 2007 20:00:53 -0000 1.13
+++ icmp_var.h 15 Jul 2011 23:18:08 -0000
@@ -65,7 +65,8 @@ struct icmpstat {
#define ICMPCTL_REDIRTIMEOUT 5 /* Remove routes added via
redirects */
#define ICMPCTL_TSTAMPREPL 6 /* allow replies to timestamp
requests */
#define ICMPCTL_STATS 7 /* ICMP statistics */
-#define ICMPCTL_MAXID 8
+#define ICMPCTL_USERECHO 8 /* ICMP echo requests in raw sockets */
+#define ICMPCTL_MAXID 9
#define ICMPCTL_NAMES { \
{ 0, 0 }, \
@@ -75,7 +76,8 @@ struct icmpstat {
{ "rediraccept", CTLTYPE_INT }, \
{ "redirtimeout", CTLTYPE_INT }, \
{ "tstamprepl", CTLTYPE_INT }, \
- { "stats", CTLTYPE_STRUCT } \
+ { "stats", CTLTYPE_STRUCT }, \
+ { "userecho", CTLTYPE_INT } \
}
#define ICMPCTL_VARS { \
@@ -86,7 +88,8 @@ struct icmpstat {
&icmp_rediraccept, \
NULL, \
&icmptstamprepl, \
- NULL \
+ NULL, \
+ &icmpuserecho, \
}
#ifdef _KERNEL
Index: ip_icmp.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.94
diff -d -u -p -w -r1.94 ip_icmp.c
--- ip_icmp.c 6 Jul 2011 01:57:37 -0000 1.94
+++ ip_icmp.c 15 Jul 2011 23:18:08 -0000
@@ -106,6 +106,7 @@
*/
int icmpmaskrepl = 0;
+int icmpuserecho = 0;
int icmpbmcastecho = 0;
int icmptstamprepl = 1;
#ifdef ICMPPRINTFS
@@ -487,6 +488,8 @@ icmp_input(struct mbuf *m, ...)
icmpstat.icps_bmcastecho++;
break;
}
+ if (icmpuserecho)
+ goto raw;
icp->icmp_type = ICMP_ECHOREPLY;
goto reflect;