From: Kanhu Rauta Subject: Problem with nf_register_hook Date: Fri, 16 Feb 2007 17:56:33 +0530 Message-ID: <00CD0E63DB0F44FE927ECD64800161CC@cisco.com> Reply-To: Kanhu Rauta Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0055_01C751F3.D0CFA380" Return-path: DKIM-Signature: v=0.5; a=rsa-sha256; q=dns/txt; l=5011; t=1171628803; x=1172492803; c=relaxed/simple; s=sjdkim8002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=krauta@cisco.com; z=From:=20Kanhu=20Rauta=20 |Subject:=20Problem=20with=20nf_register_hook |Sender:=20; bh=MdMUcLcyB5/+m/wVMcO4Fqi6zMWjSU9p3XLgpZGK0BY=; b=rNSqKrr68NQnsjtH+cCDPsIvVM/BTs5YPUaHH4wJH4HZ08VtZ/NkIS1hZfk4IuNsG1kfChbY eof7zWarFObEKBociM/f3y23SfovL7nYdcj3dltq0gwqbfgh/2BlQc5/; Sender: kernelnewbies-bounce@nl.linux.org Errors-to: kernelnewbies-bounce@nl.linux.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: List-subscribe: List-owner: List-post: List-archive: To: kernelnewbies@nl.linux.org, linux-newbie@vger.kernel.org, 'Linux Kernel' ------=_NextPart_000_0055_01C751F3.D0CFA380 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Hi list, I am using Linux 2.6.9-42.7.EL kernel, And registering a function in netfilter like nf_register_hook( &test ); and test is defined like.... static struct nf_hook_ops test = { { NULL, NULL }, print_packet, PF_INET, NF_IP_LOCAL_IN, NF_IP_PRI_FILTER }; print_packet is defined like.... static unsigned int print_packet (unsigned int hook, struct sk_buff **pskb, const struct net_device *indev, const struct net_device *outdev, int (*okfn)(struct sk_buff *) ) { } PROBLEM: the registration of the function is successful..... but I am not getting the local packets(destination ip is my ip) in this hook function (print_packet). But I am able to see the packets meant for me in tcpdump and also in my application running in userspace. This module works successfully in 2.4 kernel.... Can any one please help me to resolve the problem ? With Regards, kanhu ------=_NextPart_000_0055_01C751F3.D0CFA380 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hi=20 list,
 
I = am using=20 Linux 2.6.9-42.7.EL kernel, And registering a function in netfilter=20 like
 
nf_regi= ster_hook(=20 &test );    and test is defined like....=
 
static s= truct=20 nf_hook_ops test
=3D { { NULL, NULL }, print_packet, PF_INET, NF_IP_LO= CAL_IN,=20 NF_IP_PRI_FILTER };
 
print_p= acket is=20 defined like....
static u= nsigned int=20 print_packet (unsigned int hook, struct sk_buff=20 **pskb,
          &n= bsp;    =20 const struct net_device *indev, const struct net_device=20 *outdev,
          &= nbsp;    =20 int (*okfn)(struct sk_buff *) ) {
 
}
 
PROBLEM= : the=20 registration of the function is successful.....
but I a= m not getting=20 the local packets(destination ip is my ip) in this hook function=20 (print_packet).
 
But I a= m able to see=20 the packets meant for me in tcpdump and also in my application runni= ng in=20 userspace.
 
This mo= dule works=20 successfully in 2.4 kernel....
 
 

Can any one please help me to re= solve the=20 problem ?

 With Regards,
     =20 kanhu
------=_NextPart_000_0055_01C751F3.D0CFA380-- -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@nl.linux.org Please read the FAQ at http://kernelnewbies.org/FAQ