Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - pfil functions error: (12 Items)
   
pfil functions error  
Hello,
           I have a question regarding the pfil hook functions. The below link has some example code to add and remove a
 pfil hook along with entry function. 

http://www.qnx.com/developers/docs/6.4.1/io-pkt_en/user_guide/filtering.html#Packet_Filters

This code when compiled gives me errors for all the pfil calls, like 
pfil_head_get(), pfil_add_hook(), pfil_remove_hook() etc. Do I have to include any library. I am building this on QNX6.4
.0. I have all the header files needed for io-pkt.

I get an error saying the above pfil calls "was not declared in this scope". 

Can you please let me know if I have to include any libs for pfil functions

Thanks
Vinod
Re: pfil functions error  
On Fri, Dec 11, 2009 at 05:23:55PM -0500, Vinod Kolapuram wrote:
> Hello,
>            I have a question regarding the pfil hook functions. The below link has some example code to add and remove
 a pfil hook along with entry function. 
> 
> http://www.qnx.com/developers/docs/6.4.1/io-pkt_en/user_guide/filtering.html#Packet_Filters
> 
> This code when compiled gives me errors for all the pfil calls, like 
> pfil_head_get(), pfil_add_hook(), pfil_remove_hook() etc. Do I have to include any library. I am building this on QNX6
.4.0. I have all the header files needed for io-pkt.
> 
> I get an error saying the above pfil calls "was not declared in this scope". 
> 
> Can you please let me know if I have to include any libs for pfil functions
> 

You probaly need to have _KERNEL defined.  Also make sure
you're buiding a dll.

-seanb
Re: pfil functions error  
I haven't done this in a while, so maybe things have changed, but when I was building a filter, the full source tree was
 checked out and built, I placed the build directory under .../sys/lsm/... and I copied the build infrastructure from 
one of the other lsm's (common.mk etc).  I'd start with copying the build infrastructure  and see what happens (note 
that the lsm.mk file here assumes that the full tree is in place

http://community.qnx.com/integration/viewvc/viewvc.cgi/trunk/lib/io-pkt/sys/lsm/?root=core_networking&system=exsy1001)
)

The wiki should really be updated to include information on how to build a filter :>.

    Robert.
Re: pfil functions error  
Hi Robert,
                As I mentioned I was trying to build the pfil hook application on 6.4.0, not 6.4.1. In the QNC 
documentation where I downloaded the Core Netowrking source code, it clearly mentions that the pre-requisite is 6.4.1. 
Can I not build the io-pkt pfil related application on 6.4.0.

As Sean mentioned when I added the _KERNEL flag, I was able to see many missing files and might be even the different 
versions of the files which are needed to build the pfil hook application properly.

But my question is can we not buiild pfil hook filter module on 6.4.0?

If yes then what are the extra files, folder, libraries needed to support the pfil hook implementation.

Or is it a msut that I should have minimum 6.4.1 version of QNX to implement pfil hook application?


Right now I am downloading 6.4.1.

Thanks
Vinod
Re: pfil functions error  
Sorry there was a typo in my prvious posting , its QNX not QNC.
Re: pfil functions error  
Hi Vinod:

   You can definitely build filters under 6.4.0.  Just do the same thing as suggested previously by downloading and 
building the full source tree and then placing your build directory under sys/lsm (and copy one of the other LSM build 
infrastructure).

   Robert.
Re: pfil functions error  
Hi Robert,
                Thanks for the help but I am facing few problems here.

1. To build a io-pkt filter module, do I need to do such a huge exercise by downloading the fullsource tree and 
buiilding?

2. For our project, we have 6.4.0. OS with needed binaries and headers. I want to build a io-pkt filter module on 6.4.0.
 This is on a seperate machine.

3. On the other spare machine I tried doing the full source checkout (with a pre-requisite of 6.4.1, which I installed 
it on my PC) and I have executed the first 4 steps to build the source tree. The steps are given at below link.
http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/BuildTheOSSource

On the 5th step I am unable to execute "make OSLIST=nto hinstall ". I get an erro. I took a snapshort of my error and 
attaching it in a jpg file. On this spare machine I also have older versions of QNX630 and 632.

4.But the ".metadata" folder is created in the build directory.

5. Even if I am making my sample code work on this new build with 6.4.1, how am I going to make it work on 6.4.0.  I 
would end up not knowing the missing files and binaries for 6.4.0 to build the pfil hook. I am using Jamfile to build my
 application on 6.4.0. 


I think there should me a smooth transition for building io-pkt from io-net.

Hi Sean,
             when I tried to put the _KERNEL define in my Makefile (Jamfile).
I started getting lots of missing files and path mismatch. I corrected the path mismatch by including the io-pkt/sys 
folder in my Makefile. I was able to get rid of all the path mismatch errors. Now I get few erros like in the libkern.h 
file
"error: 'std::uintmax_t strtoumax(const char*, char**, int)' 
conflicts with previous using declaration 
'std::uintmax_t std::strtoumax(const char*, char**, int)' 
I also get many errors in systm.h for the function "copyinstr() the errors are invalid conversion from void * to char*.

I think might be my project with 6.4.0 does not have the right headers or the binaries for the headers or they can be 
mismatch with these.

Please try to put me in the right direction.

Thanks
Vinod
Attachment: Image hinstall_err.JPG 71.37 KB
Re: pfil functions error  
> 1. To build a io-pkt filter module, do I need to do such a huge exercise by downloading the fullsource tree and 
buiilding?
>   
That's actually not such a huge task. Try it, you might like it :-)
> On the 5th step I am unable to execute "make OSLIST=nto hinstall ". I get an erro. I took a snapshort of my error and 
attaching it in a jpg file. On this spare machine I also have older versions of QNX630 and 632.
>   
There's no makefile where you issue the make command. You need to 
navigate down to lib/io-pkt.

/P
Re: pfil functions error  
Hi Patrik,
             That is what I was thinking too, there is no make file except the "qconf-override.mk" I buiild with few 
parameters as explained in the link below.

But the below links suggested I should build it from the build directory (which is the directory where I do a svn 
checkout .

http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/BuildTheOSSource

http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/Source_Guide

Then according to you even the "stage" folder has to be created in io-pkt folder for the binaries to be put in there.

Most of the information or statements here contradict each other. For a new comer like me its a never ending ride.

I though of building at least the lsm folder under "io-pkt/sys/". I was able to buiid it successfully. Then I though od 
building the whole source tree from io-pkt folder. So I executed the " make OSLIST=nto hinstall " and it seemed to work.
 Then I executed "make OSLIST=nto install " It took almost couple of hours to build and broke at "io-pkt/sys/lib/libdrvr
". Here a file "hwi_find_bus.c" includes "<drvr/hwinfo.h>", this file in turn includes "<sys/hwinfo.h>" This file is 
located at "io-pkt/sys/lib/libstartup/public/sys/".  The errors I get is this "sys/hwinfo.h" is not available to the 
make file. Should I update the header file with full path or should I update the make file itself. I am not that 
familiar with make file, but I have attached the one which should infact make that folder available for compilation. Can
 you have a look at let me know.

Thanks
Vinod
Attachment: Text common.mk 384 bytes
Re: pfil functions error  
Vinod Kolapuram wrote:
> Hi Patrik,
>              That is what I was thinking too, there is no make file except the "qconf-override.mk" I buiild with few 
parameters as explained in the link below.
>
> But the below links suggested I should build it from the build directory (which is the directory where I do a svn 
checkout .
>
> http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/BuildTheOSSource
>
> http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/Source_Guide
>   
Perhaps the wiki needs updating now that in the repository splits 
libsocket and the stack:
trunk/lib/socket <- libsocket
trunk/lib/io-pkt <- stack stuff
It used to be that the two shared trunk root dir.

> Then according to you even the "stage" folder has to be created in io-pkt folder for the binaries to be put in there.
>   
The stage can really be anywhere. It's good practice to have it parallel 
to your trunk dir.
> Most of the information or statements here contradict each other. For a new comer like me its a never ending ride.
>   
Apologies if it's confusing, we've just moved things in the repository 
around.
> It took almost couple of hours to build 
That's surprising, what are you building on? VMware?
> and broke at "io-pkt/sys/lib/libdrvr". Here a file "hwi_find_bus.c" includes "<drvr/hwinfo.h>", this file in turn 
includes "<sys/hwinfo.h>" This file is located at "io-pkt/sys/lib/libstartup/public/sys/".  The errors I get is this "
sys/hwinfo.h" is not available to the make file. Should I update the header file with full path or should I update the 
make file itself. I am not that familiar with make file, but I have attached the one which should infact make that 
folder available for compilation. Can you have a look at let me know.
>   
You'll need to hinstall from lib/libstartup.

/P
Re: pfil functions error  
Hi Patrik,
              Thanks for the input. I am not using VMware.

When I do a hinstall at libstartup folder nothing happens.

I have a question regarding the stage folder.

Since you siad stage folder should be in parallel to trunk. When I executed the 
below commands

% cd <BUILD_ROOT>/trunk 
% make OSLIST=nto hinstall 

which are at step 5 in the "build the OS Source". There was nothing written into stage folder.  Don't you think there 
should be some out put written into this stage folder at this point of time?

I have other problem with cygwin. As I mentioned earlier there are 4 versions of QNX OS on my machine. 630 632 640 and 
641. I have installed cygwin from the net in my "C" folder. When I tried to execute the hinstall command from Libstartup
 folder, it gives me fatal error "system shared memory version mismatch detected - 0x8A88009C/0x2D1E009C". It clearly 
says that there might me more than one version of cygwin.dll, try  deleting all except the latest version. I don't know 
if its a good idea now. 
Each version of QNX has a cygwin dll in the "bin" folder. 
Making the source code compile has become a big task for me.

Or can anyone please let me know the libs and binaries needed for  implemention pfil hook under io-pkt for QNX6.4.0 . I 
just want to try out with the  latest headers & binaries so that I can rule out the possibility of missing stuff.

Thanks
Vinod
Re: pfil functions error  
Vinod Kolapuram wrote:
> Hi Patrik,
>               Thanks for the input. I am not using VMware.
Well, it shouldn't take that long to build. Could be because you're 
using Windows and/or cygwin. My full build took 7 minutes. Now we 
probably have different hardware, so this is no indication of how long 
it should take for you, but it shouldn't take a couple of hours.
> When I do a hinstall at libstartup folder nothing happens.
>   
Err, I was thinking about a different repository. The file should be 
installed into stage when you build io-pkt.
> I have a question regarding the stage folder.
>
> Since you siad stage folder should be in parallel to trunk.
There's no hard rule. I mentioned it is good practice because then you 
know which stage is for what code (if you have multiple workspaces at 
the same time).

Make sure you have set the QCONF_OVERRIDE environment variable (note 
that it is underscore "_" not a dash "-" in the middle) and that it has 
correct contents.
>  When I executed the 
> below commands
>
> % cd <BUILD_ROOT>/trunk 
> % make OSLIST=nto hinstall 
>
> which are at step 5 in the "build the OS Source". There was nothing written into stage folder.  Don't you think there 
should be some out put written into this stage folder at this point of time?
>   
Again, since the repository has changed, the wikis aren't totally up to 
date. You'll need to cd deeper into the trunk before starting your 
build. First into lib/socket to hinstall its headers, then into 
lib/io-pkt to build the stack. When you're actually building something 
you'll see that the stage area builds up with header files and 
executables and libraries.

Also take note of:
"Request your patience that you work around the build by adding in a 
Makefile.dnm to the component that is not building (Makefile.dnm == 
Makefile Do No Make )"
http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/BuildTheOSSource
> I have other problem with cygwin. As I mentioned earlier there are 4 versions of QNX OS on my machine. 630 632 640 and
 641. I have installed cygwin from the net in my "C" folder. When I tried to execute the hinstall command from 
Libstartup folder, it gives me fatal error "system shared memory version mismatch detected - 0x8A88009C/0x2D1E009C". It 
clearly says that there might me more than one version of cygwin.dll, try  deleting all except the latest version. I 
don't know if its a good idea now. 
> Each version of QNX has a cygwin dll in the "bin" folder. 
>   
I don't have experience with cygwin. Nor have I used multiple versions 
of the development tools installed at the same time. Perhaps you could 
ask at the tools forum:
http://community.qnx.com/sf/discussion/do/listTopics/projects.toolchain/discussion.core_development_tools
Or one of the core os forums:
http://community.qnx.com/sf/go/projects.core_os/discussion
> Making the source code compile has become a big task for me.
>   
I'm sorry about that. It shouldn't be that hard. Please try the steps 
and checks I've outlined.

I just verified on a fresh checkout that it works for me. I only had to 
create a Makefile.dnm in lib/io-pkt/sys/dev_qnx/e1000 directory because 
of an outside dependency.

Hope this helps!
/P