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

About SOCK_RAW and IPPROTO_IPV6 ?

171 views
Skip to first unread message

Seong Moon

unread,
May 2, 2007, 4:33:00 AM5/2/07
to
Hello ! There.

I'd like to send IPv4 Packet using following socket in my win32 application.
socket(AF_INET, SOCK_RAW, IPPROTO_IPV6);

The above socket() returns NO error. But sebsquent socket functions such as
bind(), connect(), sendto() do NOT operate correctly.

For checking of my fault, I've tried using IPPROTO_ICMP instead of
IPPROTO_IPV6. Then bind(), connect() and sendto() functions work correctly.

One more check, I've tried like below :
socket(AF_INET, SOCK_RAW, 0);
setsockopt(sockhd, IPPROTO_IP, IP_HDRINCL, optVal, &optLen);
... build IPv4 header
... then, sendto();
But, The windows converts Protocol field of sending packet to the value
'0x0', although I set the value to IPPROTO_IPV6(41).

Why can I use SOCK_RAW with IPPROTO_IPV6 ?
Could anyone tell me why I can't or how I can ?

Thanks in advance.

Arkady Frenkel

unread,
May 2, 2007, 5:24:08 AM5/2/07
to
Strange that it return No error , because you have to use AF_INET6 and not
AF_INET.
Check http://msdn2.microsoft.com/en-us/library/ms740506.aspx for additional
info for raw sockets in ipv6
Arkady

"Seong Moon" <Seon...@discussions.microsoft.com> wrote in message
news:140431A2-BCF4-4926...@microsoft.com...

Seong Moon

unread,
May 2, 2007, 8:16:00 PM5/2/07
to
I DO use the IP version 4 RAW socket not the IP version 6 RAW socket.
So, I call socket() with below parameters
int af : AF_INET,
int type : SOCK_RAW,
int protocol : IPPROTO_IPV6(41)

The last 'protocol' parameter just means that I want to set the Protocol
field of IP version 4 header to IPPROTO_IPV6(41) value.

If I want to build IP version 6 Packet, I would call socket() with AF_INET6.
BUT, In this situation I'd like to build IP version 4 Packet.

Thanks in anyway.

Arkady Frenkel

unread,
May 3, 2007, 2:49:31 AM5/3/07
to
I see what you mean now, but I'm not sure that it possible in such way. Ask
additionally on
microsoft.public.platformsdk.networking.ipv6

Arkady

"Seong Moon" <Seon...@discussions.microsoft.com> wrote in message

news:8857BCD1-D98B-448B...@microsoft.com...

0 new messages