About Raw socket, vlan + ip header
Subsystems (2)
Hi,
My name is Sriram, have a question about raw socket programming.
Writing a socket program where, I'm trying to construct a ether frame with vlan id and copying ip header there after. By using PF_PACKET family.
But when I do a sendto, the ip header is stripped off from the packet. Could you please let me know how to go about?
Having the ip header is necessary for a software here.
Thanks for the time.
Sriram
Quoted 6 lines · Sriram Raghunathan
Writing a socket program where, I'm trying to construct a ether frame with vlan id and copying ip header there after. By using
PF_PACKETfamily.But when I do a sendto, the ip header is stripped off from the packet. Could you please let me know how to go about?
man 7 packet
...
The socket_type is either SOCK_RAW for raw packets including the link level header or SOCK_DGRAM for cooked packets with the link level
header removed. The link level header information is available in a
common format in a sockaddr_ll. protocol is the IEEE 802.3 protocol
...
Are you opening a SOCK_RAW or a SOCK_DGRAM PF_PACKET socket?
Phil.
Hi Philippe,
Using SOCK_RAW.
Sriram
Quoted 20 lines · ext Philippe Troin
Quoted 6 lines · Sriram Raghunathan
Writing a socket program where, I'm trying to construct a ether frame with vlan id and copying ip header there after. By using
PF_PACKETfamily.But when I do a sendto, the ip header is stripped off from the packet. Could you please let me know how to go about?
man 7 packet
...
Thesocket_typeis eitherSOCK_RAWfor raw packets including the link level header orSOCK_DGRAMfor cooked packets with the link level
header removed. The link level header information is available in a
common format in asockaddr_ll. protocol is the IEEE 802.3 protocol
...Are you opening a
SOCK_RAWor aSOCK_DGRAMPF_PACKETsocket?Phil.