Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Mar 2008 17:35:17 +1100
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Alireza Torabi <alireza.torabi@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: bpf packet capture and SOCK_STREAM socket redirects...
Message-ID:  <20080321063517.GK85901@server.vk2pj.dyndns.org>
In-Reply-To: <cffd8c580803200427u62d8d3b9q208364a8a96de7ba@mail.gmail.com>
References:  <cffd8c580803192006g4045258bxcf8fa10b322a640@mail.gmail.com> <cffd8c580803200243u4465889m197d2a7ca6d0fff7@mail.gmail.com> <slrnfu4g5d.1b5e.vadim_nuclight@hostel.avtf.net> <cffd8c580803200357l686d6e40qb49b3ecadb734151@mail.gmail.com> <slrnfu4hm4.1b5e.vadim_nuclight@hostel.avtf.net> <cffd8c580803200427u62d8d3b9q208364a8a96de7ba@mail.gmail.com>

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

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

On Thu, Mar 20, 2008 at 11:27:53AM +0000, Alireza Torabi wrote:
>Imagine this:
>
>           | (1)
>     packets
>           |                     | (4)
>        [nic1]             [nic2]
>         bpf             SOCK_STREAM
>          |  (2)                |
>              [FreeBSD] (3)
>
>1) all user traffic are being monitored
>2) bpf on [nic] is capturing these packets
>3) after processing we know a connection is about to be established from A=
 to B
>
>NOW:
>4) I want to deliver this packet to the socket on [nic2]
>and as this is a tcp socket it'll take care of it from there
>(my code here for this sockets sends and arbitary data to A making it
>think it came from B)

Have a look at divert(4).  I suspect it comes closest to what you want.

--=20
Peter Jeremy
Please excuse any delays as the result of my ISP's inability to implement
an MTA that is either RFC2821-compliant or matches their claimed behaviour.

--69pVuxX8awAiJ7fD
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iEYEARECAAYFAkfjVyUACgkQ/opHv/APuIeSYwCbBRTRNgeMWCPUcaJQzR2j4PS/
Rw0AnRnVjwm57vmmj1fxoPMncQhIK050
=/whQ
-----END PGP SIGNATURE-----

--69pVuxX8awAiJ7fD--



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