Dump the packets before sending it and ensure that the packet contents are in the right format. Also check whether any iptables rules are set and if so clear it appropriately. -Mani -----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org]On Behalf Of paridhi bansal Sent: Tuesday, November 26, 2002 12:18 PM To: kernelnewbies@nl.linux.org; dharmenderr@cybage.com; mrsmani@cisco.com Subject: ipforwarding.... hi I am trying to route the packets comming to any of my interfaces according to their destination(ip forwarding)using C on linux. What i am doing is creating a socket, binding it to all interfaces and then reading the pkt destination ip and accordingly forwarding the pkt to the appropriate interface using sendto(). What is happening is: when i ping from one machine(151.2.123.85) to another (192.168.1.1), it shows requyest timed out. The application is showing me that the pkt has been sent to 192 interface. I assume that somehow pkt is not sent from interface to the destination machine as i am not getting any reply pkt from 192.168.1.1. What can be the problem?? What can be the solution???How shall i proceed??? The code is below: s1=socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); bzero((char *)&sock_add,sizeof(sock_add)); sock_add.sin_family=AF_INET; sock_add.sin_addr.s_addr= htonl(INADDR_ANY); sock_add.sin_port=htons(0); if(bind(s1,(struct sockaddr *)&sock_add, sizeof(sock_add)) < 0) printf("Could not bind"); bzero((char *)&so_ad,sizeof(so_ad)); so_ad.sin_family=AF_INET; so_ad.sin_port=htons(0); if(check_ip("151.2.*.*",dest)==1){ inet_aton("151.2.123.75", &(so_ad.sin_addr)); i=1; } else if(check_ip("192.168.1.*",dest)==1) { inet_aton("192.168.1.2", &(so_ad.sin_addr)); printf("\n interface 2 matched"); i=2; } sendto(s1, buffer, sizeof(buffer),0,(struct sockaddr *) &so_ad , sizeof(so_ad)); regrds, Paridhi __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/