Need Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am writting netfilter call back function (see in_packet function in the attached file).

I am getting error

network.c:32: dereferencing pointer to incomplete type

Cannot figure out why. Since struct sk_buff **pskb points to sock struct and sock struct has a field ny the name of family.

Please help

Usman
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/module.h>

#include <linux/errno.h>
#include <linux/types.h>

#include <linux/socket.h>
#include <linux/in.h>
#include <linux/netfilter_ipv4.h>

MODULE_LICENSE("GPL");

static unsigned int in_packet(unsigned int, struct sk_buff **,
const struct net_device *, const struct net_device *, int (*okfn)(struct sk_buff *));
static int init_module(void);
static void cleanup_module(void);

/* this function is called by Netfilter layer, when NF_IP_LOCAL_IN is hit */
static unsigned int in_packet(unsigned int hook,
                              struct sk_buff **pskb,
                              const struct net_device *in,
                              const struct net_device *out,
                              int (*okfn)(struct sk_buff *))
{
 pid_t  pid;

 printk("protocol   = %x\n", (*pskb)->protocol);
 printk("ip_summed  = %x\n", (*pskb)->ip_summed);
 printk("len        = %x\n", (*pskb)->len);
 printk("sk         = %x\n", (*pskb)->sk);
 printk("sk->family = %x\n", (*pskb)->sk->family);

 return(NF_ACCEPT);
}

static struct nf_hook_ops ip_ops =
   {
    {NULL, NULL},
    in_packet,
    PF_INET,
    NF_IP_LOCAL_IN,
    NF_IP_PRI_FILTER
   };

static int init_module(void)
{
 /* Register hooks */
 if (nf_register_hook(&ip_ops) < 0)
    {
     printk("could not register netfilter hook\n");
     return(-1);
    }

 printk("Zero Network module loaded\n");

 return(0);
}

static void cleanup_module(void)
{
 nf_unregister_hook(&ip_ops);
 printk("Zero Network module unloaded\n");
}

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux