From owner-freebsd-net@FreeBSD.ORG Mon Oct 6 05:56:29 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 2BDE0106569E for ; Mon, 6 Oct 2008 05:56:29 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id D0BBE8FC12 for ; Mon, 6 Oct 2008 05:56:28 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender; b=YuPMG/L76JznxzuCtKZxH2rcNcH5741K6eEIRV39NoVpiONsAfjYJyCys3jgcqzckoU5vVd4E4ZY3brLyQsn0G6myTI6LO78AuFzLTiZ/XKgwsc+23FbngYWOptJeAnPf/Rwy2IFHNGxKLoJFbBUZZ5gWf0uWY02CMqJ1ZgA59c=; Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1Kmj51-000KNa-U7; Mon, 06 Oct 2008 09:56:28 +0400 Date: Mon, 6 Oct 2008 09:56:26 +0400 From: Eygene Ryabinkin To: Ryan French Message-ID: References: <200810061730.23641.rfrench@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="M9bFcvWzl0n6AFYF" Content-Disposition: inline In-Reply-To: <200810061730.23641.rfrench@freebsd.org> Sender: rea-fbsd@codelabs.ru Cc: 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 05:56:29 -0000 --M9bFcvWzl0n6AFYF Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Ryan, good day. Mon, Oct 06, 2008 at 05:30:23PM +1300, Ryan French wrote: > I now have receiving,=20 > decoding and sending of packets working, except for one small problem. Wh= en I=20 > send a packet back out the MAC address is wrong. I am looking for a way i= n=20 > the ether_output function in if_ethersubr.c that I can get the MAC addres= s of=20 > the source of the packet and then just send it back to that source. Do you mean by 'the source of the packet' the MAC address of the incoming packet to what you're sending a reply packet? If you can somehow "remember" the MAC address of the packet you're replying to (don't know about internals of your application, so can't judge if it is feasible), you can try to look at the sys/net/if_bridge.c (bridge_enqueue at the first place and bridge_input as the example on how to manipulate the Ethernet header). These might help you, unless you're not using Ethernet as the transport. --=20 Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual =20 )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook=20 {_.-``-' {_/ # --M9bFcvWzl0n6AFYF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjpqIoACgkQthUKNsbL7YgSvgCgj/MymxDyfk7ejaTT7m6HaTJJ KesAn0mfDKrvNpNfqdBlq5N8QAu47s51 =mupS -----END PGP SIGNATURE----- --M9bFcvWzl0n6AFYF--