Export (0) Print
Expand All

IPPROTO_IPV6 Socket Options

The following tables describe IPPROTO_IPV6 socket options that apply to sockets created for the IPv6 address family (AF_INET6). See the getsockopt and setsockopt function reference pages for more information on getting and setting socket options.

To enumerate protocols and discover supported properties for each installed protocol, use the WSAEnumProtocols, WSCEnumProtocols, or WSCEnumProtocols32 function.

Some socket options require more explanation than these tables can convey; such options contain links to additional information.

IPPROTO_IPV6 Socket Options
OptiongetsetOptval typeDescription
IP_ORIGINAL_ARRIVAL_IFyesyesDWORD (boolean)

Indicates if the WSARecvMsg function should return optional control data containing the original arrival interface where the packet was received for datagram sockets.

This option is used with IPv6 transition technologies (6to4, ISATAP, and Teredo tunnels, for example) that provide address assignment and host-to-host automatic tunneling for unicast IPv6 traffic when IPv6 hosts must traverse IP4 networks to reach other IPv6 networks. IPv6 packets are sent tunneled as IPv4 packets. This option allows the original IPv4 interface where the packet was received to be returned in the WSAMSG structure.

IPV6_ADD_MEMBERSHIPyes ipv6_mreq

Join the socket to the supplied multicast group on the specified interface.

This option is only valid on datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW).

IPV6_DROP_MEMBERSHIPyes ipv6_mreq

Leave the supplied multicast group from the given interface.

This option is only valid on datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW).

IPV6_HDRINCLyesyesDWORD(boolean)

Indicates the application provides the IPv6 header on all outgoing data. If the optval parameter is set to 1 on the call to setsockopt, the option is enabled. If optval is set to 0, the option is disabled. The default value is disabled.

This option is only valid for datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW). A TCP/IP service provider that supports SOCK_RAW should also support IPV6_HDRINCL.

IPV6_HOPLIMITyesyesDWORD (boolean)

Indicates that hop (TTL) information should be returned in the WSARecvMsg function. If optval is set to 1 on the call to setsockopt, the option is enabled. If set to 0, the option is disabled.

This option is only valid for datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW).

IPV6_JOIN_GROUPyes ipv6_mreq Same as IPV6_ADD_MEMBERSHIP
IPV6_LEAVE_GROUPyes ipv6_mreq Same as IPV6_DROP_MEMBERSHIP
IPV6_MULTICAST_HOPSyesyesDWORD

Gets or sets the TTL value associated with IPv6 multicast traffic on the socket. It is illegal to set the TTL to a value greater than 255.

This option is only valid for datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW).

IPV6_MULTICAST_IFyesyesDWORD

Gets or sets the outgoing interface for sending IPv6 multicast traffic. This option does not change the default interface for receiving IPv6 multicast traffic. This option is important for multihomed computers.

The input value for setting this option is a 4-byte interface index of the desired outgoing interface in host byte order. The GetAdaptersAddresses function can be used to obtain the interface index information. If optval is set to NULL on call to setsockopt, the default IPv6 interface is used. If optval is zero , the default interface for receiving multicast is specified for sending multicast traffic.

When getting this option, the optval returns the current default interface index for sending multicast IPv6 traffic in host byte order.

IPV6_MULTICAST_LOOPyesyesDWORD (boolean)

Indicates multicast data sent on the socket will be echoed to the sockets receive buffer if it is also joined on the destination multicast group. If optval is set to 1 on the call to setsockopt, the option is enabled. If set to 0, the option is disabled.

This option is only valid for datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW).

IPV6_PKTINFO yesyesDWORD (boolean)Indicates that packet information should be returned by the WSARecvMsg function.
IPV6_PROTECTION_LEVEL yesyesINTEnables restriction of a socket to a specified scope, such as addresses with the same link local or site local prefix. Provides various restriction levels and default settings. See IPV6_PROTECTION_LEVEL for more information.
IPV6_RECVIFyesyesDWORD (boolean)

Indicates whether the IP stack should populate the control buffer with details about which interface received a packet with a datagram socket. When this value is true, the WSARecvMsg function will return optional control data containing the interface where the packet was received for datagram sockets.

This option allows the IPv6 interface where the packet was received to be returned in the WSAMSG structure.

This option is only valid for datagram and raw sockets (the socket type must be SOCK_DGRAM or SOCK_RAW).

IPV6_UNICAST_HOPSyesyesDWORDGets or sets the current TTL value associated with IPv6 socket for unicast traffic. It is illegal to set the TTL to a value greater than 255.
IPV6_UNICAST_IFyesyesDWORD (IF_INDEX)

Gets or sets the outgoing interface for sending IPv6 traffic. This option does not change the default interface for receiving IPv6 traffic. This option is important for multihomed computers.

The input value for setting this option is a 4-byte interface index of the desired outgoing interface in host byte order. The GetAdaptersAddresses function can be used to obtain the interface index information. If optval is zero, the default interface for sending IPv6 traffic is set to unspecified.

When getting this option, the optval returns the current default interface index for sending IPv6 traffic in host byte order.

IPV6_V6ONLYyesyesDWORD (boolean)Indicates if a socket created for the AF_INET6 address family is restricted to IPv6 communications only. Sockets created for the AF_INET6 address family may be used for both IPv6 and IPv4 communications. Some applications may want to restrict their use of a socket created for the AF_INET6 address family to IPv6 communications only.

When this value is nonzero (the default on Windows), a socket created for the AF_INET6 address family can be used to send and receive IPv6 packets only.

When this value is zero, a socket created for the AF_INET6 address family can be used to send and receive packets to and from an IPv6 address or an IPv4 address. Note that the ability to interact with an IPv4 address requires the use of IPv4 mapped addresses.

This socket option is supported on Windows Vista or later.

 

Windows Support for IPPROTO_IPV6 Socket Options
OptionWindows 8Windows Server 2012Windows 7Windows Server 2008Windows VistaWindows Server 2003Windows XP

IP_ORIGINAL_ARRIVAL_IF

xxx

IPV6_ADD_MEMBERSHIP

xxxxxxx

IPV6_DROP_MEMBERSHIP

xxxxxxx

IPV6_HDRINCL

xxxxxxx

IPV6_HOPLIMIT

xxxxxxx

IPV6_JOIN_GROUP

xxxxxxx

IPV6_LEAVE_GROUP

xxxxxxx

IPV6_MULTICAST_HOPS

xxxxxxx

IPV6_MULTICAST_IF

xxxxxxx

IPV6_MULTICAST_LOOP

xxxxxxx

IPV6_PKTINFO

xxxxxxx

IPV6_PROTECTION_LEVEL

xxxxxxx

IPV6_RECVIF

xxxxx

IPV6_UNICAST_HOPS

xxxxxxx

IPV6_UNICAST_IF

xxxxx

IPV6_V6ONLY

xxxxx

 

Remarks

On the Microsoft Windows Software Development Kit (SDK) released for Windows Vista and later, the organization of header files has changed and IPPROTO_IPV6 level is defined in the Ws2def.h header file which is automatically included in the Winsock2.h header file. The IPPROTO_IPV6 socket options are defined in the Ws2ipdef.h header file which is automatically included in the Ws2tcpip.h header file. The Ws2def.h and Ws2ipdef.h header files should never be used directly.

The IP_ORIGINAL_ARRIVAL_IF socket option is supported on Windows Server 2008 R2 as well as on Windows 7.

Requirements

Header

Ws2def.h (include Winsock2.h);
Winsock2.h on Windows Server 2003 and Windows XP

 

 

Community Additions

ADD
Show:
© 2014 Microsoft