From owner-freebsd-net@FreeBSD.ORG Fri Mar 21 06:35:19 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D95E3106566B for ; Fri, 21 Mar 2008 06:35:19 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 620368FC18 for ; Fri, 21 Mar 2008 06:35:19 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c220-239-20-82.belrs4.nsw.optusnet.com.au [220.239.20.82]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m2L6ZHZP009048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Mar 2008 17:35:18 +1100 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.2/8.14.1) with ESMTP id m2L6ZH4x086482; Fri, 21 Mar 2008 17:35:17 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.2/8.14.2/Submit) id m2L6ZHRg086481; Fri, 21 Mar 2008 17:35:17 +1100 (EST) (envelope-from peter) Date: Fri, 21 Mar 2008 17:35:17 +1100 From: Peter Jeremy To: Alireza Torabi Message-ID: <20080321063517.GK85901@server.vk2pj.dyndns.org> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="69pVuxX8awAiJ7fD" Content-Disposition: inline In-Reply-To: X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-net@freebsd.org Subject: Re: bpf packet capture and SOCK_STREAM socket redirects... X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Mar 2008 06:35:20 -0000 --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--