[Planetlab-users] a question about raw sockets (one more time)
Brought to you by:
alklinga
|
From: Michal S. <mi...@cs...> - 2003-10-28 08:43:25
|
Andy, > To monitor incoming and outgoing packets on a port, PlanetLab provides raw > "sniffer" sockets. Here is a bit of documentation: > > http://www.planet-lab.org/raw_sockets/api_sniffer.html > I followed the instructions exactly, and: - I can see incoming raw IP packets :-) - I still cannot see any outgoing ones :-( For example, during a TCP-handshake, I can see incoming SYN and ACK packets, but I cannot see any SYNACK packet between them. Here is a piece of my code: #define PACKET_SIZE 1500 int m,on; char packet[PACKET_SIZE]; if ((m=socket(PF_INET,SOCK_RAW,IPPROTO_TCP))==-1) fatal("monitor:socket"); on=1;if (setsockopt(m,SOL_SOCKET,SO_REUSEADDR,&on,sizeof(int))==-1) fatal("monitor:reuseaddr"); on=1;if (setsockopt(m,0,SO_RAW_SNIFF,&on,sizeof(int))==-1) fatal("monitor:setrawsniff"); if (bind(m,(struct sockaddr*)&sa,sizeof(struct sockaddr_in))==-1) fatal("monitor:bind"); and then loop on recvfrom(m,packet,PACKET_SIZE,0,NULL,NULL); Any ideas what may be wrong? BTW, thanks to everyone who tried to help me the last time :-) Kind regards, M. -- Michal Szymaniak | mailto:mi...@cs... | http://www.cs.vu.nl/~mszyman |