I have a question regarding sending a raw packet.
What I want to do is to send an additional information
along with the packet down to IP stack, using RAW_SOCK.
This additional information will be used to build an
another header in front of the IP header of the packet
before sending it to layer 2.
What is the best approach to resolve this problme?
Can I build both headers before call sendto? I am
trying to use
IF (sock = socket(AF_INET, SOCK_RAW, OSPF_PROTO)) > 0
setsockopt(sock, IPPROTO_TP, IP_HDRINCL, &on, sizeof(on));
/* build both private header and IP header */
sendto (sock, .....);
to resolve this problem.
Is this the right way to do it?
know the answer.
Thank you very much for your attention.