mac header in NF_IP_PRE_ROUTING

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

 



Hi!
 
I register a hook with hooknum NF_IP_PRE_ROUTING, and in the hook function
I find out (*skb)->mac.ethernet is equal to (*skb)->nh.iph.
 
Is it a bug?
 
My OS is Redhat Linux 9.0, with kernel version 2.4.20-8.
 
Below is some piece of my code:
 
static unsigned int my_nf_hook_input(unsigned int hooknum,
 struct sk_buff ** skb, const struct net_device * in,
 const struct net_device * out, int (* okfn)(struct sk_buff *))
{
     struct iphdr * ip = (*skb)->nh.iph;
     struct ethhdr * mac = (*skb)->mac.ethernet;
    /* fix me: ? */
    if((void *)mac == (void*)ip)
    {
        printk(KERN_INFO "A bug???\n");
        mac = (struct ethhdr *)((char *)ip - sizeof(struct ethhdr));
    }
 
    ...
     
 
}
 
Regards!

[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux