LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-13-2006, 01:14 AM   #1
venkatesh111
Member
 
Registered: Mar 2006
Posts: 34

Rep: Reputation: 15
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 -
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
System hangs; Atheros Madwifi-ping times out every 15/16 times james 456 Linux - Networking 0 01-12-2006 06:55 PM
Cannot ping local system when pinging system is set for static IP SkipHuffman Linux - Networking 4 08-22-2005 11:56 AM
net driver causes system hangs (keyboard hangs) yjchen Linux - Networking 0 10-21-2004 10:12 PM
Ping hangs and Konq times out... Lostboy7500 Linux - Networking 1 10-09-2004 06:41 PM
NETSAINT configure hangs at /sbin/ping Ilektro Linux - Software 0 12-14-2002 10:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration