[Planetlab-users] Raw socket's functions stripped?
michal at cs.vu.nl
Tue Jul 19 16:37:23 EDT 2005
>> Could you also check whether you can see a complete TCP handshake?
>> I can only see SYN and ACK (but not SYNACK) when opening a TCP connection
>> to a server running on a planetlab node.
> Here's a snippet of a "tethereal -i vnet" run on planetlab-1 while running
> "curl http://www.yahoo.com/":
Yeah, I observe similar results when using tpcdump. I actually identified
the problem: it seems that it somehow matters what sll.sll_protocol value
is used when binding the socket. If that value is htons(ETH_P_IP), as you
recommend, then only outgoing packets are retrieved. However, if I set it
to htons(ETH_P_ALL), then I can read packets transmitted in either
direction. Here is the code:
if ((sock=socket(PF_PACKET,SOCK_DGRAM,htons(ETH_P_ALL)))==-1) fatal("monitor:socket");
sll.sll_family = PF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL); /* <<< HERE <<< */
sll.sll_ifindex = ifr.ifr_ifindex;
if (bind(sock,(struct sockaddr*)&sll,sizeof(struct sockaddr_ll))==-1) fatal("monitor:bind");
It is not entirely clear why it happens, and it can actually qualify as a
bug. But anyway, it is good to finally have it working properly.
More information about the Users