Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Reg - packet filter: (7 Items)
   
Reg - packet filter  
Hi,

I refered a packet filter wikipage.

In that they given return 1 means stop the packet  processing or return 0 means stack will process packet.

return 1 means who will free the mbuffer.

so i try to free the mbuf.

if i m using m_free() in my code it throws warning implicit declaration m_free so it wont allow to mount the packet 
filter.

How can i free the mbuffer?

please guide me.

Thanks and Regards
K.Senthil





Re: Reg - packet filter  
On Wed, Aug 12, 2009 at 07:49:39AM -0400, Senthil K wrote:
> Hi,
> 
> I refered a packet filter wikipage.
> 
> In that they given return 1 means stop the packet  processing or return 0 means stack will process packet.
> 
> return 1 means who will free the mbuffer.
> 
> so i try to free the mbuf.
> 
> if i m using m_free() in my code it throws warning implicit declaration m_free so it wont allow to mount the packet 
filter.
> 
> How can i free the mbuffer?
> 
> please guide me.

Is this a warning at compile time or link?  If it's at
compile just include <sys/mbuf>.  m_free() is in io-pkt
itself so if it's at the link phase you need to compile your
module as a dll and this will be resolved from within io-pkt
when your module is dlopened by io-pkt.  Also notice that
our drivers pass LDFLAGS+=-Wl,--allow-shlib-undefined in
their makefile to silence any warnings in this area.

-seanb
Re: Reg - packet filter  
Hi Sean,

Its in compile time,i already include <sys/mbuf.h>

still the warning came.

Regards
K.Senthil
Re: Reg - packet filter  
On Wed, Aug 12, 2009 at 09:29:41AM -0400, Senthil K wrote:
> Hi Sean,
> 
> Its in compile time,i already include <sys/mbuf.h>
> 
> still the warning came.

You need to have _KERNEL defined.

-seanb
Re: Reg - packet filter  
Hi Sean,

if i added that _KERNEL in make file,thats gave bunch of error.



Thanks and Regards
K.Senthil
Re: Reg - packet filter  
On Wed, Aug 12, 2009 at 10:17:16AM -0400, Senthil K wrote:
> Hi Sean,
> 
> if i added that _KERNEL in make file,thats gave bunch of error.

The short answer is this:

What you're trying to create would normally be a kernel
module on a monotithic operating system.  On QNX it's
a dll that loads into io-pkt.  A large part of io-pkt
therefore is essentially a chunk of the NetBSD kernel
which is why a lot of the code we've ported requires
_KERNEL defined and assumes a netbsd kernel module
compilation environment.  In our networking repo the
majority of this code is under sys and gets this
environment set up by including sys/qnx.h.  You'll
have to get your environment set up in a similar manner.

-seanb
Re: Reg - packet filter  
Couple of things:

http://netbsd.gw.com/cgi-bin/man-cgi?pfil++NetBSD-current

Note "If the packet processing is to stop, it is the responsibility of the filter to free the packet" so you do have to 
do the free in the filter as you suspected.

In order to create an LSM, make sure that you have the ENTIRE source tree checked out and place your source files under 
a new directory in the sys/lsm directory.  There are a couple of examples (e.g. nraw) of fairly complex filters that you
 can copy to at least set up the proper build environment.  

While it is possible to deviate from this, it is not recommended and requires a lot of understanding of the make and 
build process in order to make it work.  

   R.