From owner-freebsd-net@FreeBSD.ORG Thu Mar 20 10:57:41 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 16E4A106564A for ; Thu, 20 Mar 2008 10:57:41 +0000 (UTC) (envelope-from alireza.torabi@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.224]) by mx1.freebsd.org (Postfix) with ESMTP id D17C68FC1C for ; Thu, 20 Mar 2008 10:57:40 +0000 (UTC) (envelope-from alireza.torabi@gmail.com) Received: by wr-out-0506.google.com with SMTP id 50so805254wra.13 for ; Thu, 20 Mar 2008 03:57:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=fF9HpfC+RRc7X02ZbYwqwRAbj/HcfwUdbd1tekFmtdY=; b=YzivwYnGMmZO7P07WNsQ6ycjXG2z4pmloJ9q2UHXADfujFBGxrwJuzSFXSLkyQ2UfzHjRyvgf2bzg0l4VcxOrqEUdByI1mjsXGXBDBQvYyWpFMEv/HBiumP2wvsPMSsq9Rg5Cfn6mfl4foZLy/YzkVArEJ1o6PmzEI8XwHYg+AQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=T/HD1tT0SPO9XmPmz5tT2/Ju4eoS/SxYx+BOFGeqV3fQHjA78SwFjteAB7OJZUx4fdWK9jzv3r9b9cmiXcLNuzXLc9zFFNVxSYMVEhScZFKOfJZbES5/+TW/eKwLgi9rbZfQDz7MnK/Dz0qlDMlvfYBR4k4YEfTSO3orcvcIxXU= Received: by 10.115.18.1 with SMTP id v1mr3235363wai.81.1206010659413; Thu, 20 Mar 2008 03:57:39 -0700 (PDT) Received: by 10.115.78.3 with HTTP; Thu, 20 Mar 2008 03:57:39 -0700 (PDT) Message-ID: Date: Thu, 20 Mar 2008 10:57:39 +0000 From: "Alireza Torabi" To: freebsd-net@freebsd.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Cc: vadim_nuclight@mail.ru 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: Thu, 20 Mar 2008 10:57:41 -0000 Thanks for reply. That's sort of the problem. I've got a data link capture of the packet (bpf) and let say I redirect this packet to a SOCK_STREAM on another machine and the whole thing will work fine (OK after rewritting some mac and ip and checksums...). I just need to do this on the SOCK_STREAM of the same machine. If I try to put it in another way: Is it possible to do a bpf write of a packet that can be seen by the interface the bpf is bound to? This means that the interface does it's normal work and the packet will be deliverd to SOCK_STREAM bound to it. A On 3/20/08, Vadim Goncharov wrote: > Hi Alireza Torabi! > > On Thu, 20 Mar 2008 09:43:52 +0000; Alireza Torabi wrote about 'bpf packet capture and SOCK_STREAM socket redirects...': > > > Is it possible to redirect/send/divert a bpf packet capture of one > > interface to a listening tcp socket on another interface of the same > > machine? > > Here is my problem: > > I'm capturing packets on one interface but for some specific tcp > > packets let's say from host A to host B on port P, I want to hijack > > the packet and send it to a listening tcp socket on the other > > interface and reply an "Access Denied" message. > > > I'd like to use the tcp socket on the other interface as it's not > > possible to communicate over the interface that's doing the packet > > capture and I don't want to invent the wheel by doing all the tcp/tcb > > states hence using a tcp socket. > > But if that's a middle of connection, how would you do? Kernel sockets assume > they've acted in a conversation from the very beginning SYN's, so if you > redirect such packet, socket will not understand it. > > If you yopu want to simply close/reset connection, however, this can be done > somehow. > > -- > WBR, Vadim Goncharov. ICQ#166852181 mailto:vadim_nuclight@mail.ru > [Moderator of RU.ANTI-ECOLOGY][FreeBSD][http://antigreen.org][LJ:/nuclight] > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >