ping -c 4 172.1.8.111 hangs my system
hi everyone
actually i have written a module project3.c in this module i have a function called get_dmac() from which we r trying to get the destination mac address. compilation of this module was succussfull as module. then i inserted this module using insmod command i could see that there is no problem with loop back packets, but when i try to ping the packets from other system my system hangs ie wn i give the command:
ping -c 4 172.1.8.111
my system hangs
is this because of accessing the hh_data in my module or what ???????????
here is my get_demac function in my module:
int get_dmac(struct sk_buff *skb)
{
int i=0;
char *c;
struct dst_entry *dst = skb->dst;
struct hh_cache *hh = dst->hh;
struct net_device *in;
in = skb->dev;
if (strcmp(in->name,"lo") != 0) {
printk("<0> ETH0 PKT %d \n",skb->len);
read_lock_bh(&hh->hh_lock);
memcpy(c,hh->hh_data,16);
read_unlock_bh(&hh->hh_lock);
printk("\n\nAFTER LOCK AND UNLOCK..........");
while(i<6)
{
dmac[i] = *(c+i+2);
i++;
}
printk("<0> GET_MAC() :%x:%x:%x:%x:%x:%x
\n",dmac[0],dmac[1],dmac[2],dmac[3],dmac[4],dmac[5]);
printk("<0>GROUPING PKT STARTED\n");
kfree_skb(skb);
return 0;
//return check_mac(dmac , skb);
} //end of if
printk("\n<0> LOOPBACK PKT -JUST FORWARDING\n");
read_lock_bh(&hh->hh_lock);
memcpy(skb->data - 16, hh->hh_data, 16);
read_unlock_bh(&hh->hh_lock);
skb_push(skb, hh->hh_len);
printk("\n\n PACKET SENT TO hh_output()...............\n");
return hh->hh_output(skb);
} // END OF get_dmac function
/*module init() and exit part*/
static int hello_init(void)
{
pass_skb = get_dmac; // pass_skb is a function pointer i
// i will be using it in ip_output.c
return 0;
}
static void hello_exit(void)
{
pass_skb = NULL;
printk("\n\n out................. \n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("SHRI");
- Show quoted text -
|