From owner-freebsd-net@FreeBSD.ORG Wed Mar 2 12:38:38 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8D1516A4CE for ; Wed, 2 Mar 2005 12:38:38 +0000 (GMT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id DDC4E43D54 for ; Wed, 2 Mar 2005 12:38:37 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id j22CcaUm093116; Wed, 2 Mar 2005 14:38:36 +0200 (EET) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 34346-11; Wed, 2 Mar 2005 14:38:35 +0200 (EET) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id j22CcZJN093113 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 2 Mar 2005 14:38:35 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.1/8.13.1) id j22CckPi047232; Wed, 2 Mar 2005 14:38:46 +0200 (EET) (envelope-from ru) Date: Wed, 2 Mar 2005 14:38:46 +0200 From: Ruslan Ermilov To: Aziz KEZZOU Message-ID: <20050302123846.GC47110@ip.net.ua> References: <37e131660503011947346b94fb@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2/5bycvrmDh4d1IB" Content-Disposition: inline In-Reply-To: <37e131660503011947346b94fb@mail.gmail.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at ip.net.ua cc: freebsd-net@freebsd.org Subject: Re: netgraph question : how to intercept incoming IP packets of a certain type? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2005 12:38:38 -0000 --2/5bycvrmDh4d1IB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 01, 2005 at 10:47:07PM -0500, Aziz KEZZOU wrote: > Hi folks, > Here is what I want to do : "Intercept all incoming IP packets on an > Ethernet interface of a certain type (e.g RSVP) and call my own > function to process, all inside the kernel" >=20 > Netgraph nodes : ng_iface, nf_bpf (and probably ng_ether) look > promising for this task but I can not figure out how to do it in > practice... > =20 > Any help is appreciated. Thanks, >=20 I thought Julian already answered this... You can do this with ng_ipfw(4) in -CURRENT. Or you can filter (with ng_bpf(4)) the packets of interest and forward them somewhere. Example: +---v | (upper) | rl0: [ng_ether] | (lower) | ^ | | | v | (lower) | bpf_rl0: [ng_bpf] | (upper) +---^ [bpf] should be configured to forward matching packets received on "lower" to some other hook, and non-matching packets to "upper". Similarly for packets received on "upper", forward packets of interest to some other hook, and non-matching packets to "lower". Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --2/5bycvrmDh4d1IB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFCJbPWqRfpzJluFF4RAsR1AJ96yk8iSHvAhRNoIQE4OiMJT4+/aACgjEKh Ls2NOcNL7Ug4sbiyA4Ada4Y= =Y0r1 -----END PGP SIGNATURE----- --2/5bycvrmDh4d1IB--