I want to setup a LAN over several point-to-point connections, based on
USB-USB connectors and USB-Ethernet adapters. Since I dont need any L3
or L4 protocol, and what I need is the less possible overhead, I've
thought about using packet sockets (PF_PACKET). What I want is a way of
sending raw stuff into the data portion of ethernet packets. I'd like to
use Packet Datagram sockets, because I'm lazy and don't want to worry
about headers, and if using Packet Raw sockets, I would have to
(wouldn't I? Please see question below).
When creating/binding a packet socket (packet(7), packet(4)), I'm told
to choose a protocol for sending, from if_ether.h .
Now, some cuestions (sorry if trivial):
- What happens if I register a packet Raw socket and don't send correct
headers? Will my packets get discarded? For example, think I create a
socket(PF_PACKET,SOCK_RAW, ETH_P_IP) and when I send packets I don't
build a proper IP header.
- Can I make a packet socket for a protocol number not included in
- If not, what do I need to do in order to be able to send packets for a
user defined protocol? Adding a line in if_ether.h and recompile? I only
need a dummy protocol, just for sending raw data over ethernet packets.
Any help will be appreciated. I'm totally lost...
Thank you for your time.