Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 Feb 2010 14:47:57 +1100
From:      Lawrence Stewart <lstewart@freebsd.org>
To:        Lukasz Jaroszewski <lvj@nietykalni.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: PFIL: how to get tcp/ip fields from mbuf
Message-ID:  <4B67A06D.10405@freebsd.org>
In-Reply-To: <3930e0781002010302r3758968cl5f010bd7a585cca4@mail.gmail.com>
References:  <3930e0781002010302r3758968cl5f010bd7a585cca4@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 02/01/10 22:02, Lukasz Jaroszewski wrote:
> Hello,
> I am wondering about most elegant and proper way to get IP header
> fields from mbuf, using PFILs. I have read Murat Balaban paper on
> PFIL_HOOKS where I found some example function. Question is how can I
> access IP header field in such manner.
>
> static int
> hisar_chkinput(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
> struct inpcb *inp)
> {
>          in_bytes += (*m)->m_len;
>          return 0;
> }

I hacked on a tool that uses pfil hooks to do in-kernel TCP data 
gathering. Probably has some useful snippets for you to look at in 
addition to Robert's suggestion.

http://svn.freebsd.org/base/projects/tcp_ffcaia2008_head/sys/netinet/siftr.c

Cheers,
Lawrence



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B67A06D.10405>