Help: What's the raw packet socket?

Help: What's the raw packet socket?

Post by bg.. » Sat, 01 Jul 2006 18:00:18



Dear all,

I am a primary programmer on network.

Quote:>From some documents, I have read that some interfaces between host and

clients are programed by the raw packet socket. My question is:

1. What's the raw packet socket?
2. What's the differnce between a general socket and the raw packet
socket?
3. Where could I found more details about the raw packet socket?

Thanks

Jian Zhang

 
 
 

Help: What's the raw packet socket?

Post by Spoo » Sat, 01 Jul 2006 18:22:25



> I am a primary programmer on network.

What?

Quote:> From some documents, I have read that some interfaces between host and
> clients are programed by the raw packet socket. My question is:

> 1. What's the raw packet socket?
> 2. What's the difference between a general socket and the raw packet
> socket?
> 3. Where could I found more details about the raw packet socket?

I'd start with:

man 7 raw
man 7 packet

http://www.linuxmanpages.com/man7/raw.7.php
http://www.linuxmanpages.com/man7/packet.7.php

 
 
 

1. RAW socket packets help......

I've been dissecting 2 programs written in C for Linux to understand RAW
socket programming better and have some questions.

One of the programs adds a Custom IP header and a custom TCP header by using
the IP and TCP header structures and setting these as the message to be sent
in the sendto command.  Done in this way you have to know the source and
destination address as these are added to the IP header structure.  If it
done like this why do you still have to pass the destination address as a
separate parameter to the sendto function.  Surely the message data is put
into a Ethernet frame and sent out without modification.

The second program uses ICMP it again sets up an icmphdr structure and uses
this as the data to be sent, but this time there is no mention of the source
address field or destination field, which is still required in a ICMP
packet, the destination is sent as a separate parameter to sendto.  In this
case where does it get the source address from?  and how can I set up
program one so that the source address is automatically added like it is
here?

Thanks for any help ...

Justin....

2. SOCKS5 instead of NAT + ipfw ?

3. Prompt problem

4. How to send 'raw' packets via sendto on a SOCK_PACKET sockt

5. Increment a variable ?

6. Send/Recv of ethernet packets useing raw sockets

7. Why not a return bout?

8. raw packet socket; how to retransmit

9. Trouble passing TCP packets through Raw Socket

10. Raw sockets and zero-source IP packets

11. raw socket packet and iptables

12. Sending multicast packet on a raw socket