From owner-freebsd-net@FreeBSD.ORG Thu Jan 8 14:15:45 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5DADFBA2 for ; Thu, 8 Jan 2015 14:15:45 +0000 (UTC) Received: from smtp2.informatik.tu-muenchen.de (mail-out2.informatik.tu-muenchen.de [131.159.0.36]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C9986B4 for ; Thu, 8 Jan 2015 14:15:44 +0000 (UTC) Received: from [131.159.50.43] (homer.sec.in.tum.de [131.159.50.43]) by services.sec.in.tum.de (Postfix) with ESMTPSA id 80F6710110D41; Thu, 8 Jan 2015 15:08:12 +0100 (CET) Message-ID: <54AE8F6D.8010900@sec.in.tum.de> Date: Thu, 08 Jan 2015 15:08:45 +0100 From: Julian Kirsch User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-Version: 1.0 To: freebsd-net@freebsd.org Subject: Re: How to get the IP and TCP fields in mbuf References: In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: weh@microsoft.com X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 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, 08 Jan 2015 14:15:45 -0000 Hi Wei, Are you looking for something like this? + struct ip *ip = mtod(m, struct ip *); m is a struct mbuf *. You cann look into my knock-patch for FreeBSD [0] for further examples. Best, Julian [0] https://gnunet.org/knock On 08.01.2015 14:18, Wei Hu wrote: > Hi, > > I am wondering if there is existing macros in the FreeBSD kernel to extract to get to the point of the IP and TCP head in a given mbuf. > > Thanks, > Wei > > > _______________________________________________ > 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" > -- Julian Kirsch Chair for IT-Security (I20) Department of Computer Science, Technische Universität München Boltzmannstrasse 3, D-85748 Garching bei München Phone: +49-89-289-18587 Room: 01.08.53