sock_buff is NULL !

Kesava Srinivas vunnavafuture at gmail.com
Mon Nov 21 14:02:46 EST 2011


HI Team,

Trying to make this code work; but some how it is entering the if condition
mentioned below.sock_buff is still a NULL Pointer.I can see that Function
was registered with the Ipv4 Hooks. Any ideas/scenarios where the sock_buff
remains as NULL Pointer??? Testing this code by trying to do ssh with this
machine.

Any Help is really appreciated !!

#########
static struct nf_hook_ops netfilter_ops;
struct sk_buff *sock_buff;

unsigned int main_hook(unsigned int hooknum,struct sk_buff **skb,const
struct net_device *in,const struct net_device *out,int (*okfn)(struct
sk_buff*)) {
 sock_buff = *skb;
        if(!sock_buff){
           printk(KERN_ERR "Entered unexpected loop \n");
               return NF_ACCEPT;
         }/* Check for sk_buff NULL */
}
int init_module()
{
        netfilter_ops.hook              =       (nf_hookfn *) main_hook;
        netfilter_ops.hooknum           =       NF_INET_PRE_ROUTING;
        netfilter_ops.pf                =       PF_INET;
        netfilter_ops.priority          =       NF_IP_PRI_FIRST;
        nf_register_hook(&netfilter_ops);


}
######################


-Thnx,
VKS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111122/f0568826/attachment.html 


More information about the Kernelnewbies mailing list