<span style="font-family: courier new,monospace;">HI Team,</span><br><br><font face="courier new,monospace">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.<br>
<br>Any Help is really appreciated !!<br><br>#########<br>static struct nf_hook_ops netfilter_ops;<br>struct sk_buff *sock_buff;<br><br>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*)) {<br>
 sock_buff = *skb;<br>        if(!sock_buff){<br>           printk(KERN_ERR &quot;Entered unexpected loop \n&quot;);<br>               return NF_ACCEPT;<br>         }/* Check for sk_buff NULL */<br>}<br>int init_module()<br>
{<br>        netfilter_ops.hook              =       (nf_hookfn *) main_hook;<br>        netfilter_ops.hooknum           =       NF_INET_PRE_ROUTING;<br>        <a href="http://netfilter_ops.pf">netfilter_ops.pf</a>                =       PF_INET;<br>
        netfilter_ops.priority          =       NF_IP_PRI_FIRST;<br>        nf_register_hook(&amp;netfilter_ops);<br>                                                                                                                                                      <br>
}<br>######################<br><br><br>-Thnx,<br>VKS<br></font>