tcp raw socket programming recvfrom()

Alin-Adrian Anton aanton at reversedhell.net
Thu Jul 10 17:32:56 PDT 2003


Toni Andjelkovic wrote:

>On Wed, Jul 09 2003 (12:45:14 +0300), Alin-Adrian Anton wrote:
>  
>
>>Usually? What does usually mean? I know I can use bpf. But is there 
>>another way to look at incoming TCP packet ? What I did is I sent a TCP 
>>SYN packet and the server answers with a TCP SYN_ACK packet. How can I 
>>look at the SYN_ACK packet using raw sockets?
>>    
>>
>
>Try libpcap or tcpdump.
>
>Cheers,
>Toni
>
>
>  
>
Libcap uses /dev/bpf for *BSD, and RAW recvfrom for linux and others. My 
goal is to experience with the freebsd system, not only to receive that 
packet. I just want to understand why *BSD socket model, which is the 
original socket model, chose not to allow recvfrom with raw sockets, on 
TCP and UDP protocols. It allows it with ICMP and all others. I just 
want to understand why this choice.

Linux didn't respect that, and in linux it is possible to recvfrom with 
raw socket, on TCP and UDP protocols too.

In the end, I will just use the /dev/bpf to get the work done. I want to 
play with the system, and understand it, not with a portable lib :P .
The goal is not to get things done, for that there is libcap. The goal 
is to explore src/sys details and IP stack.

PS: ethereal is a great sniffer :-)

Thanks :-).

Alin.




More information about the freebsd-hackers mailing list