[Top][All Lists]

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

[lwip-users] Problem in ip_route function of ip.c..Please help !!!!!!!!

From: Durgaprasad Chivukula
Subject: [lwip-users] Problem in ip_route function of ip.c..Please help !!!!!!!!
Date: Tue, 13 Sep 2005 16:02:53 +0200

  I wrote a tftp client (Linux 2.4.20-8 with gcc ) on lwip using the socket API  (udp sockets ). The function of the tftp  client is to connect to a remote server and it can  get files from the server and put files to the server. When I try to put/get files to/from the server I am getting a segmentation fault .When I debugged my program ,the flow of my program is like this , it will assign an IP address to the tftp client ( the same code present in minimal ) using the tap interface and then connects to a remote server , after connecting to the remote server ,when I tried to get any file , its  showing the segmentation fault and getting halted at the  ip_addr_netcmp function , which is present internally in the ip_route function of ip.c file ,  the ip_addr_netcmp function is implemented as a macro in the ip_addr.h and the flow is indefintely stopped there , when I tried to debug the program , Can any body have some pointers , what might be the  problem with this...I really need desperate help in this
For your reference I am herewith giving the program flow ....
1. I create a udp socket  in the main_thread function ( the same code as in the simhost.c example of unixsim module )
 f= lwip_socket(AF_INET,SOCK_DGRAM,0)
 2. I assign the IP address using the tap if interface  and then in my main function I initialize the necessary functions like sys_init , pbuf_init  , ip_init, udp_init and tcp_init and  I I pass this main_thread to sys_thread_new  function in  my main , 
 3. I connect to the remote server using a function called setpeer ()
 the ip address of the server to which I want to connect , I enter at the commadn prompt
  and the basic code of the setpeer looks like this ....
 peeraddr.sin_port =htons(69);   /* the default TFTP port */
 peeraddr.sin_addr.s_addr =htonl(IP_ADDR_ANY)   /* I really do not know whether this is needed in my case, please give me a hint of this */
lwip_bind(f,(struct sockaddr *)&peeraddr,sizeof(struct sockaddr));   ( binding the previoulsy created socket  f  )
 this is my setpeer function .. I am not getting any error here during my debug process
and then  comes the  get/put files...get /put functionality is also implemeted using the socket API   lwip_sendto and lwip_recvfrom functions, to which the socket created at first ( the udp socket f  ) is passed as one of the argument and the file pointer to get/put
I type get at the command prompt , it asks for the files to get and when I type the file name which is present in a tftpboot directory of the /tftpboot of the linux directory , it should get the files to the current directory.Does this make any difference , I really do not know whether this makes difference , How can say lwip to get the file from /tftpboot ...? if this the problem  ....
But As  I said , when I tried to debug the program my program is getting halted at   if(ip_addr_netcmp(dest,&(netif->ip_addr, &(netif->netmask))) function , which is present in the ip_route function of ip.c file.The same is the case with  "put  "    ...Please let me know what is the problem .... Help!!!!!!!
 I am sorry that I could not provide you with my exact code because I work on a standalone linux PC ,
Durga Prasad Chivukula
Infineon Technologies AG

reply via email to

[Prev in Thread] Current Thread [Next in Thread]