Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - when does the iface_hook() gets invoked: (10 Items)
   
when does the iface_hook() gets invoked  
Hi,
   In io-pkt implementation , when does the iface_hook gets invoked. I mount the filter and I see the input hook and 
output hook get invoked as a when packets come in and go out of stack. But I am unable to see the message I have put in 
when the iface_hook is added.

If I am not wrong this gets invoked when the filter module attaches to the driver ethernet driver module.

I do not see this happening.

I am just executing the sample code. 

Can anyone please put in the right direction?

Regards
Vinod
Re: when does the iface_hook() gets invoked  
On 13/01/10 08:20 PM, Vinod Kolapuram wrote:
> Hi,
>     In io-pkt implementation , when does the iface_hook gets invoked.
The PFIL_IFNET hook is invoked when the interface is attached (created) 
or detached (destroyed).

>   I mount the filter and I see the input hook and output hook get invoked as a when packets come in and go out of 
stack. But I am unable to see the message I have put in when the iface_hook is added.
>    
You probably loaded the filter after the interface was created.

Hope this helps!
/P
Re: when does the iface_hook() gets invoked  
Hi Patrik,
              Well that is my question. When you say the interface is attached to which interface are you referring. My 
ethernet driver has to be mounted even before my filter gets mounted right?

My question is how to exercise my attach functionality and why doesn't the pfil filter module get attached to the active
 ethernet driver.

Regards
Vinod
Re: when does the iface_hook() gets invoked  
I'm sorry, I don't really understand where the misunderstanding is. If 
anybody else knows, please jump in!

Please see below...

> When you say the interface is attached to which interface are you referring.
The network interface, e.g. en0 or wm0. What you create by loading a 
devn-/devnp- network driver with correct parameters and which you remove 
by calling ifconfig <ifname> destroy. In stack terminology this leads to 
"attaching" and "detaching" the interface respectively.

Maybe the confusion is with these terms vs. the pf API which uses terms 
"attach" and "detach" interface hooks? It's because they too refer to 
the same event happening in the stack when they're called.


>   My ethernet driver has to be mounted even before my filter gets mounted right?
>    
I don't think there's a requirement that one loads before the other.

> My question is how to exercise my attach functionality and why doesn't the pfil filter module get attached to the 
active ethernet driver.
>    

I'm afraid I don't understand what you mean here.

As I wrote before, "The PFIL_IFNET hook is invoked when the [network] 
interface is attached (created) or detached (destroyed)." I.e. if you've 
already loaded the network driver, then the network interface has likely 
already been created and the PFIL_IFNET hook will be called for it until 
the it is destroyed.

I'm hoping the above will help, if not then here's a good wiki page on 
the topic:
http://community.qnx.com/sf/wiki/do/viewPage/projects.networking/wiki/Filtering_wiki_page

/P
Re: when does the iface_hook() gets invoked  
Hi Patrik,
              I have added some log messages on each function of the sample pfil filter code which you are reffering to.
 I even have one message when the interface is attached or detached.
My question is, in my case when the pfil filter module is mounted manually with mount command from the shell, by then 
already the ethernet driver is loaded and available. 

Do you mean to say the pfil hook interface is attached to the ethernet driver when I mount the pfil filter module

Or

the pfil hook interface is yet to be attached to the driver. If it is yet to be attached, then how do I attach my pfil 
filter module to the ethernet driver. Only then it makes sense to extract the stack data.

I just posted one more question please respond to that.



Thanks
Vinod
Re: when does the iface_hook() gets invoked  
Hi Vinod:

I think that the confusion is coming from the fact that the pfil hook attaches itself to the stack (above the driver 
interface), and not into a driver .

The iface hook will get invoked when an ethernet interface is either added into the stack (mounted) or removed from the 
stack (destroyed).   There doesn't have to be any driver interface present when you load in the pfil hook.

The sample code does something a bit peculiar in that it detaches itself as soon as any interface is destroyed.  This 
was just a convenient mechanism for showing how to remove the pfil hook and not representative of any standard way of 
operating.

The ifacecfg hook will get called if you re-configure any interface (e.g. by bringing any interface up or down).

   Robert.
Re: when does the iface_hook() gets invoked  
> Hi Vinod:
> 
> I think that the confusion is coming from the fact that the pfil hook attaches
>  itself to the stack (above the driver interface), and not into a driver .
> 
> The iface hook will get invoked when an ethernet interface is either added 
> into the stack (mounted) or removed from the stack (destroyed).   There 
> doesn't have to be any driver interface present when you load in the pfil hook
> .
Robert Can you please help me find in QXN boot up sequence as I want to mount my pfil filter module before the ethernet 
driver is loaded. I think its in some rc files. Please let me know where to change the sequence
> 
> The sample code does something a bit peculiar in that it detaches itself as 
> soon as any interface is destroyed.  This was just a convenient mechanism for 
> showing how to remove the pfil hook and not representative of any standard way
>  of operating.
> 
> The ifacecfg hook will get called if you re-configure any interface (e.g. by 
> bringing any interface up or down).
Can I reconfigure the ethernet driver devn-i82544.so. I mean its running under io-pkt and I think the driver cannot me 
unmounted in io-pkt.
> 
>    Robert.


Thanks
Vinod
Re: when does the iface_hook() gets invoked  
On 14/01/10 07:26 PM, Vinod Kolapuram wrote:
>> Hi Vinod:
>>
>> I think that the confusion is coming from the fact that the pfil hook attaches
>>   itself to the stack (above the driver interface), and not into a driver .
>>
>> The iface hook will get invoked when an ethernet interface is either added
>> into the stack (mounted) or removed from the stack (destroyed).   There
>> doesn't have to be any driver interface present when you load in the pfil hook
>> .
>>      
> Robert Can you please help me find in QXN boot up sequence as I want to mount my pfil filter module before the 
ethernet driver is loaded. I think its in some rc files. Please let me know where to change the sequence
>    
You're in control of this (at least the parts that are discussed in this 
context). You can create your own script inside an image. But I'm 
assuming from your earlier questions that you are using a standard PC 
install, in which case you have several options, e.g. can change the 
enum scripts or slay the stack in rc.local and restart it with the 
drivers and lsms in the order you want... The latter is probably easiest.

>> The sample code does something a bit peculiar in that it detaches itself as
>> soon as any interface is destroyed.  This was just a convenient mechanism for
>> showing how to remove the pfil hook and not representative of any standard way
>>   of operating.
>>
>> The ifacecfg hook will get called if you re-configure any interface (e.g. by
>> bringing any interface up or down).
>>      
> Can I reconfigure the ethernet driver devn-i82544.so. I mean its running under io-pkt and I think the driver cannot me
 unmounted in io-pkt.
>    
I don't understand what you're asking, it doesn't make sense. 
Reconfigure and unmount are two different things.

/P
Re: when does the iface_hook() gets invoked  
On 14/01/10 05:25 PM, Robert craig wrote:
> Hi Vinod:
>
> I think that the confusion is coming from the fact that the pfil hook attaches itself to the stack (above the driver 
interface), and not into a driver .
>    
Yes, thanks Robert,

I see that it makes sense that this was where the confusion was coming 
from...

/P
Re: when does the iface_hook() gets invoked  
On 14/01/10 03:53 PM, Vinod Kolapuram wrote:
> Hi Patrik,
>                I have added some log messages on each function of the sample pfil filter code which you are reffering 
to. I even have one message when the interface is attached or detached.
> My question is, in my case when the pfil filter module is mounted manually with mount command from the shell, by then 
already the ethernet driver is loaded and available.
>    
Yes, the ethernet driver is already loaded an the network interfaces it 
creates are already created. Hence when you load the example filter the 
stack won't call any PFIL_IFNET hooks for creation of interface since 
the interface already exists.

> Do you mean to say the pfil hook interface is attached to the ethernet driver when I mount the pfil filter module
>
> Or
>
> the pfil hook interface is yet to be attached to the driver. If it is yet to be attached, then how do I attach my pfil
 filter module to the ethernet driver. Only then it makes sense to extract the stack data.
>    
The pfil hook interface is to the stack, not the driver. Your example 
pfil code is registering hooks with the stack not the driver.

> I just posted one more question please respond to that.
>    
Sure, I'll try my best :-)

PS. If you need prompt support then please go through the appropriate 
QNX support channels. We're a community here and everyone here makes 
every attempt to help on their own time but sometimes there's a lot to 
do... :-)

Hope we'll get this cleared out, have a good weekend!
/P