ip6.7p (2010 09)

i
IPv6(7P) IPv6(7P)
The second type is termed as IPv4-mapped IPv6 address and is of the form
0:0:0:0:0:ffff:d.d.d.d
. This address facilitates IPv6 applications to interoperate with
IPv4 applications. Applications can automatically generate this address using
getad-
drinfo() (see getaddrinfo (3N)) when the specified host has only IPv4 address.
IPv6 Multicast
As with IPv4, an application joins a multicast group on a network interface in order to receive multicast
datagrams sent on the network to which that interface connects.
The application must also bind to the destination port number in order to receive datagrams that are sent
to that port number. If the application binds to the unspecified address (all zeroes), it may receive all
datagrams that are sent to the port number. If the application binds to a multicast group address, it may
receive only datagrams sent to that group and port number. It is not necessary to join a multicast group
in order to send datagrams to it.
For each multicast group that an application joins on a given socket and network interface, there is an
associated filter mode and source list. The filter mode can be "exclude" mode or "include" mode. The
source list is a set of IP addresses which will be compared to the source addresses of received multicast
datagrams.
An application uses "exclude" mode when it wants to block reception of multicast datagrams from a
specific set of sources, while allowing multicast datagrams from all other sources.
For groups in "exclude" mode, the source list may be empty, thus allowing reception of multicast
datagrams from all sources. An application uses "include" mode when it wants to allow reception of mul-
ticast datagrams from a specific set of sources, while blocking multicast datagrams from all other sources.
For groups in "include" mode, the source list needs to contain at least one member in order for the appli-
cation to stay joined to the group; removing the last address from an "include" mode source list will cause
the application to leave the group.
Multicast socket options are not supported on SOCK_STREAM sockets.
IPv6 Socket Options
New socket options are defined for IPv6 to send and receive extension headers and to exchange other
optional information between the kernel and application. The options are supported at the
IPPROTO_IPV6 protocol level. The type of the variable pointed to by the optval parameter is indicated
in parenthesis.
IPV6_UNICAST_HOPS
(integer) Sets or gets the hop limit used in outgoing unicast packets.
When this option is set using
setsockopt() (see setsockopt (2)), the
new option value specified is used as the hop limit for all subsequent uni-
cast packets sent via that socket. Valid values are in the range 0-255
(both inclusive) and the default value is 64. For example,
int hoplimit = 50;
setsockopt(s, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
&hoplimit, sizeof(hoplimit));
This option can be used with
getsockopt() (see getsockopt (2)) to
determine the hop limit value the system will use for subsequent unicast
packets sent via that socket.
IPV6_MULTICAST_HOPS
(integer) Sets or gets the hop limit used in outgoing multicast packets.
When this option is set, the new option value specified is used as the hop
limit for all subsequent multicast packets sent via that socket. Valid
values are in the range 0-255 (both inclusive) and the default value is 1.
IPV6_MULTICAST_IF (integer) Sets the interface to use for outgoing multicast packets. The
option value is the index of the selected outgoing interface. For example,
unsigned int index;
index = if_nametoindex("lan0");
setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_IF,
&index, sizeof(index));
IPV6_MULTICAST_LOOP
(boolean) Enables or disables loopback in the IP layer for multicast
datagrams sent through this socket. The value of the variable pointed to
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010