Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Raw IP sockets and port number

109 views
Skip to first unread message

Michael White

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to
Hi,

I want to use a Raw IP socket (type AF_INET) to send GRE messages.
A couple of quick questions:

1) How do I set the TOS in the IP header?
2) Is the port field in the sockaddr used on a Raw IP socket?
3) When sending a Raw IP message, what is the format of the data
that needs to be passed to sendto()? Does it include the IP
header or just the GRE header and body?

Any help would be greatly appreciated. If it's somewhere in the VxWorks
manuals,
that'd be helpful, too.

Thanks in advance.
---
Michael White, qa1...@ftw.mot.com
Cellular Infrastructure Group
Ft. Worth, Texas (817)245-6418

Theo Öjerteg

unread,
Aug 16, 2000, 3:00:00 AM8/16/00
to
Have a look in th e Unix Network programmers guide to see how this is
done...
There are som source code from the book (which is very good) to download
from
http://www.kohala.com/start/unpv12e.html

Basically, to send IP data on a raw socket, you just create the socket and
start sending data. specifying
If you specify IP_HDR_INCLUDE the the pointer to the data, used when
sending, should point to the very first byte in the IP header otherwise it
should be a pointer to the data in the ip packet.

good luck
/Theo

Luke Diamand

unread,
Aug 23, 2000, 10:24:07 PM8/23/00
to
I have a vague feeling that SOCK_RAW isn't supported under vxWorks.
I could be wrong, though.

Luke Diamand

>Michael White wrote:
>
>> Hi,
>>
>> I want to use a Raw IP socket (type AF_INET) to send GRE messages.
>> A couple of quick questions:
>>
>> 1) How do I set the TOS in the IP header?
>> 2) Is the port field in the sockaddr used on a Raw IP socket?
>> 3) When sending a Raw IP message, what is the format of the data
>> that needs to be passed to sendto()? Does it include the IP
>> header or just the GRE header and body?
>>
>> Any help would be greatly appreciated. If it's somewhere in the VxWorks
>> manuals,
>> that'd be helpful, too.
>>
>> Thanks in advance.
>> ---
>> Michael White, qa1...@ftw.mot.com
>> Cellular Infrastructure Group
>> Ft. Worth, Texas (817)245-6418
>


--

Vijay Kumar Peshkar

unread,
Aug 24, 2000, 12:22:47 AM8/24/00
to
Michael,

RAW sockets in general and RAW IP sockets in particular should not
be bound to any port. there is no concept of a "port" at the IP
layer. "port" is a transport layer thing (as in TCP and UDP).
You should just use sendto() and recvfrom() to send/receive
data immediately after opening the socket. when an IP datagram
is received, you will get a copy of the data. In fact , if you have
multiple RAW IP applications running on your system, each will
receive a copy. the data delivered thus is delivered to a "host"
whose address is specified by the IP address, not to the particular
port.

Hope this helps.

regards,
Vijay

0 new messages