LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   tun tap query (http://www.linuxquestions.org/questions/linux-networking-3/tun-tap-query-521452/)

karan84 01-21-2007 12:27 PM

tun tap query
 
hi
i have one doubt
i configured the tun0 interface after the open systemcall
i.e
"tuntapfd=open("\den\net\tun"........................

the interface is up and running
next i configured it using the following:

"ifconfig %s 10.8.0.2 pointopoint 10.8.0.1 mtu 1500"

next i created a simple udp server which sends a message like"hello" to the tun0 interface

In my tunnel code,if i want to read from the /dev/net/tun interface, if i use the following code


"
while(1)
{
len=read(tuntapfd,temp_buffer,sizeof(temp_buffer));//hangs here
if(len>=0)
{
printf("\n recieved.........\n");
}
else
{
printf("failed :( :( :( ........");
}
"

i know that i shud be using select for reading and shud be non blocking,but i just wantd to test it with a simple read statement

the problem is that the program hangs???????
the data it seems has not been transferred to the /dev/net/tun character device file

please help me out on this
what my doubt exactly is that if i send data say"hello" on the tun0 interface ,will my code be able to use it or access it using the /dev/net/tun character file because this is what i have been trying with no success

how should i proceed with this?


thanks
karan

melvinebenezer@gmail 03-26-2007 11:29 AM

i hav a similar problem ..... did you manage to solve it


All times are GMT -5. The time now is 07:25 AM.