Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Does pfil_add_hook() hold 500 mbufs: (2 Items)
   
Does pfil_add_hook() hold 500 mbufs  
Hi,

We have a requirement to intercept the incoming packet on particular interface and check for the proprietary tag in the 
packet header. if the tag matches handover the packet to my application otherwise give it to stack. This is achieved as 
follows.

1) Add a hook function as given below

pfil_add_hook( myFunc, NULL, PFIL_IN | PFIL_WAITOK,          ð_input_pfil_hook);

2) Then "myFunc" will receive the packet and inspect for particular interface and proprietary tag and act accordingly.

It is working fine. but we are observing the packet filter is holding 500 mbufs always with it. i.e, "netstat -m" 
command shows that there are 500 mbufs in use before loading the packet filter module and it increases to 1000 after 
loading the packet filter.
Ther are no other processes running in my card and there is no traffic generated from or destined to my card.

is it expected behavoiur with PF? 

Thanks,
Ramakrishna

Re: Does "ifconfig <if-name> up" command hold 500 mbufs  
Hi,

Sorry for mis-understanding/reporting the problem.
The pf hook does not hold any mbufs with it. Actually, the interface is made up as part of the pf module, and that step 
is consuming the 500 mbufs approximately.

I have 4 tsec interfaces on my card. The LAN interface "tsec0" will be made up as part of the boot sequcence. So when 
the card came up the "netstat -m" command shows that 500 mbufs are in use. Then I executed "ifconfig tsec1 up" command 
which makes "netstat -m" to show 1000 mbufs in use. The mbuf count incremented to 2000 after making tsec2 & tsec3 interfaces UP. The 2000 mbufs are always in used state unless "ifconfig <if-name> 
destroy" command is executed.

is this expected behaviour ? please confirm.

Thanks,
Ramakrishna