Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Sep 2007 22:11:52 +0200
From:      Matus Harvan <mharvan@inf.ethz.ch>
To:        freebsd-net@freebsd.org
Cc:        Max Laier <max@love2party.net>, Brooks Davis <brooks@freebsd.org>, mharvan@inf.ethz.ch
Subject:   icmp echo_user
Message-ID:  <20070909201152.GA18039@inf.ethz.ch>

next in thread | raw e-mail | index | archive | help

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello,

I am a Google Summer of Code student working on mtund, aka Magic
Tunnel Daemon aka Super Tunnel Daemon,
http://wiki.freebsd.org/SuperTunnelDaemon.

For mtund it would be useful to tunnel in ICMP echo request/reply
pairs. For this being able to receive ICMP echo requests in the user
space would be helpful. Currently, ICMP echo requests are processed in
the kernel where an ICMP echo reply is generated, but they are not
passed to the user space. I would suggest the patch below, adding a
sysctl variable net.inet.icmp.echo_user, allowing to recevie the ICMP
echo requests in the user space on a raw IP/ICMP socket rather than
having the kernel generate a reply to them.

Matus

patch:
Index: ip_icmp.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.117
diff -d -u -r1.117 ip_icmp.c
--- ip_icmp.c	19 Jul 2007 22:34:25 -0000	1.117
+++ ip_icmp.c	6 Sep 2007 21:26:08 -0000
@@ -124,6 +124,10 @@
 SYSCTL_INT(_net_inet_icmp, OID_AUTO, bmcastecho, CTLFLAG_RW,
 	&icmpbmcastecho, 0, "");
=20
+static int     icmpechouser =3D 0;
+SYSCTL_INT(_net_inet_icmp, OID_AUTO, echo_user, CTLFLAG_RW | CTLFLAG_SECUR=
E,
+        &icmpechouser, 0, "Pass ICMP echo requests to userspace rather tha=
n"
+	"replying to them in the kernel");
=20
 #ifdef ICMPPRINTFS
 int	icmpprintfs =3D 0;
@@ -454,6 +458,9 @@
 		break;
=20
 	case ICMP_ECHO:
+		if (icmpechouser)
+			goto raw;
+
 		if (!icmpbmcastecho
 		    && (m->m_flags & (M_MCAST | M_BCAST)) !=3D 0) {
 			icmpstat.icps_bmcastecho++;

--azLHFNyN32YCQGCU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFG5FOI43LQWDWf0QIRAiQyAJ9PvtTv2OxaBPpZRum6M2PSC0KkkwCbBt48
YHpjkNJzXpS541oC/r58pCw=
=WGkU
-----END PGP SIGNATURE-----

--azLHFNyN32YCQGCU--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070909201152.GA18039>