On Thu, May 21, 2009 at 11:24 PM, Jitendra Pradhan <jitendra.pradhan@xxxxxxxxxxxxxxxx> wrote: > Hi All, > > > > I would like to send UDP packet from my kernel module to a UDP server > application bound with loop back IP(127.0.0.1) and a particular port(say > 1000), where both the module and udp server applications are running in a > single machine. > > > > But I am not able to capture the UDP packets that I am sending to that UDP > server from my kernel module through the ethereal. I have specified the > destination IP and port as 127.0.0.1 and 1000 respectively in the packet. > But It works fine when I specify destination IP other than 127.0.0.1 > > From: http://www.abc.se/~m6695/udp.html I found a UDP server. Copying the source, and modifying the INADDR_ANY to INADDR_LOOPBACK as shown in patch below: --- udp_server.c 2009-05-27 12:17:35.000000000 +0800 +++ udp_server1.c 2009-05-27 12:21:29.000000000 +0800 @@ -24,7 +24,7 @@ int main(void) memset((char *) &si_me, 0, sizeof(si_me)); si_me.sin_family = AF_INET; si_me.sin_port = htons(PORT); - si_me.sin_addr.s_addr = htonl(INADDR_ANY); + si_me.sin_addr.s_addr = htonl(INADDR_LOOPBACK ); if (bind(s, &si_me, sizeof(si_me))==-1) diep("bind"); for (i=0; i<NPACK; i++) { Compile and run it, and u get: From: /root/download>netstat -anup udp 0 0 0.0.0.0:9930 0.0.0.0:* 11768/a.out To: /root/download>netstat -anup udp 0 0 127.0.0.1:9930 0.0.0.0:* 11839/a.out Is this what u are looking for? > > My main objective is to send the udp packet from the kernel space to an udp > application bound with 127.0.0.1 and an udp port ( say 1000) where both the > module and UDP applications are running in a single machine. > > > > > > I will really appreciate if I get any help on this regard. > > > > Thanks, > > Jitendra > > > > -- Regards, Peter Teoh -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ