From owner-freebsd-net@FreeBSD.ORG Mon Oct 6 11:48:21 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 0F27F106569B for ; Mon, 6 Oct 2008 11:48:21 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by mx1.freebsd.org (Postfix) with ESMTP id 9138B8FC0C for ; Mon, 6 Oct 2008 11:48:20 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: by ey-out-2122.google.com with SMTP id 6so714190eyi.7 for ; Mon, 06 Oct 2008 04:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=C7OVEYMDns79ego23JU9Cm8n3hwIBL2T4+mAhlf6xck=; b=cKxY+nV+w83rlnHYTRpi/qmPeclyHIN4VNlV/USs52HUKAUjIBuua8FWc7//zzb1Gt kKyAldKC008K7Ira1IyS+4BizfvapeiCYbpMBfw2t2Jyg+ewMAWmT8164uEJdN0XdXHm 3Jybld7yXdXFvrCmuBtxIYrsLJp6xDUcbg5A8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=Elci1Lz43ZJ5Jfj+pwaGnUPIldncHni5iOvxFxTQKsFhruCf7avnqXvXLZ2zrDHIpE iB/18WZ9RfwjPoTEUMX1oX8/dI4zaB1P2wYGa6YawCF3GZj5U046Sb/stiB4nyBV9+BH /SIT1+uo9Kb+m0jH1N//ZGEKPMjoaZWkQniVQ= Received: by 10.103.247.14 with SMTP id z14mr2714055mur.39.1223293698929; Mon, 06 Oct 2008 04:48:18 -0700 (PDT) Received: from localhost (cable-234-140.cgates.lt [79.133.234.140]) by mx.google.com with ESMTPS id e10sm10584173muf.14.2008.10.06.04.48.17 (version=SSLv3 cipher=RC4-MD5); Mon, 06 Oct 2008 04:48:18 -0700 (PDT) Date: Mon, 6 Oct 2008 14:48:14 +0300 From: Gleb Kurtsou To: Julian Elischer Message-ID: <20081006114814.GB3497@rybacik> References: <200810061730.23641.rfrench@freebsd.org> <48E9AA84.90804@elischer.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <48E9AA84.90804@elischer.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Ryan French , freebsd-net@freebsd.org Subject: Re: Getting packets MAC source address in if_ethersubr.c 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: Mon, 06 Oct 2008 11:48:21 -0000 On (06/10/2008 14:04), Julian Elischer wrote: > Ryan French wrote: > > Hi All, > > > > For my implementation of MPLS I have just about run out of time for my > > dissertation so at the moment I am trying to create fake routing table > > entries e.t.c. rather than doing this properly (I will be doing this once uni > > is finished and I have more free time to work on it). I now have receiving, > > decoding and sending of packets working, except for one small problem. When I > > send a packet back out the MAC address is wrong. I am looking for a way in > > the ether_output function in if_ethersubr.c that I can get the MAC address of > > the source of the packet and then just send it back to that source. If anyone > > knows how to do this without having to use arpresolve or anything like that > > (the IP address of the destination is not going to be the same as the IP > > destination in the packet) or without having to setup a proper routing table > > then it would be much appreciated. > > > > Thanks, > > -Ryan > > _______________________________________________ > > 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" > > > You could create a tag type that holds a layer 2 address, and attach > it to the packet on ingresss, > > it should stay with the packet as long as it's not destroyed.. > then on egress you could find it and use it.. That's exactly what I did for Google Summer Of Code project this year http://wiki.freebsd.org/GlebKurtsov/Improving_layer2_filtering Ryan, you can have a look at first changesets in perforce and extract only functionality you need.