Previous | Contents |
If an on-link node is not reachable, one of the following messages can appear:
host is unreachable network is unreachable timeout |
Verify that an on-link node or router is reachable by using the ping command. If the command fails or if packets are frequently dropped, complete the following steps:
If an off-link node is not reachable, the following messages appear:
host is unreachable network is unreachable timeout |
Verify that an off-link node is reachable by issuing the ping command.
If there is 100% packet loss, perform the following steps:
Frequently dropped packets indicate either network congestion or an intermittent routing problem.
To determine the cause, do the following:
IPv6 hosts generate their global and site-local unicast addresses automatically by using address prefixes provided by a router on the link. If an on-link node cannot autoconfigure its addresses, perform the following steps:
If another network user reports that message transmission appears to be failing at your router, perform the following steps:
$ SHO SYS /PROCESS=TCPIP$IP6RTRD |
If someone reports a problem reaching your node from another node, perform the following steps:
If a remote node is not configured to accept a connection from your application, the following message might appear:
connection refused |
Verify that TCP/IP Services has been correctly configured on the remote node to accept connections.
Contact the administrator for the remote node and ask whether the
correct socket-based service definitions are defined in the
TCPIP$SERVICES.DAT file. Check whether the service has IPv6 enabled.
5.5.9 Connection Terminates
If the connection terminates abnormally or if a network application appears to hang, perform the following steps:
The TCP/IP Services for OpenVMS programming interface supports the Berkeley Software Distribution (BSD) socket programming interface. It also supports the basic sockets interface extensions for Internet Protocol Version 6 (IPv6) as defined in RFC 2553. The basic syntax of socket functions remains the same. Existing IPv4 applications will continue to operate as before, and IPv6 applications can interoperate with IPv4 applications.
TCP/IP Services for OpenVMS provides Internet domain support for the address family AF_INET and AF_INET6.
This chapter describes the following aspects of the API:
The IPv6 socket interface incorporates the following changes:
struct in6_addr { uint8_t s6_addr[16]: } |
struct sockaddr_in6 { uint8_t sin6_len; sa_family_t sin6_family; in_port_t sin6_port; uint32_t sin6_flowinfo; struct in6_addr sin6_addr; uint32_t sin6_scope_id; }; |
BSD Version 4.3 will be supported in a subsequent release. |
The basic syntax of socket functions remains the same. Existing IPv4
applications will continue to operate as before. IPv6 applications can
interoperate with IPv4 applications.
6.2 Interface Identification
To identify the interface on which a datagram is received, on which a datagram is to be sent, and on which a multicast group is joined, the API uses a small, positive integer called an interface index. The kernel assigns this integer to an interface when the interface is initialized.
The API defines the following new functions:
Function | Description |
---|---|
if_nametoindex | Maps an interface name to its corresponding index. |
if_indextoname | Maps an interface index to its corresponding name. |
if_nameindex | Returns an array of all interface names and indexes. |
if_freenameindex | Frees dynamic memory allocated by if_nameindex to the array of interface names and indexes. |
The if_nametoindex function has the following syntax:
#include <net/if.h> unsigned int if_nametoindex( const char *ifname ); |
If the interface does not exist, the function returns 0 and sets
errno
to ENXIO. If a system error occurs, the function returns 0 and sets
errno
to an appropriate value.
6.2.2 if_indextoname Function
The if_indextoname function has the following syntax:
#include <net/if.h> char *if_indextoname( unsigned int ifindex, char *ifname ); |
The ifname argument points to a buffer that is
IFNAMSIZ bytes in length (IFNAMSIZ is defined in TCPIP$EXAMPLES:IF.H).
If an interface name is found, it is returned in the buffer. If no
interface name corresponds to the specified index, the function returns
NULL and sets
errno
to ENXIO. If a system error occurs, the function returns NULL and sets
errno
to an appropriate value.
6.2.3 if_nameindex Function
The if_nameindex function has the following syntax:
#include <net/if.h> struct if_nameindex *if_nameindex( void ); |
The following if_nameindex structure must also be defined (by including (TCPIP$EXAMPLES:IF.H) prior to the call to if_nameindex :
struct if_nameindex { unsigned int if_index; char *if_name; }; |
The
if_nameindex
function dynamically allocates memory for an array of
if_nameindex
structures, one structure for each interface. A structure with an
if_index
value of 0 and a NULL
if_name
value indicates the end of the array. If an error occurs, the function
returns a NULL pointer and sets
errno
to an appropriate value. To free the memory allocated by this function,
use the
if_freenameindex
function.
6.2.4 if_freenameindex Function
The if_freenameindex function has the following syntax:
#include <net/if.h> void if_freenameindex( struct if_nameindex *ptr ); |
The if_freenameindex function frees dynamic memory that was allocated by the if_nameindex function. The argument to this function is the pointer that was returned by the if_nameindex function.
6.3 IPv6 Multicast Datagrams
6.3.1 Sending IPv6 Multicast Datagrams
To send IPv6 multicast datagrams, an application indicates the
multicast group to send to by specifying an IPv6 multicast address in a
sendto
system call. The system maps the specified IPv6 destination address to
the appropriate Ethernet or FDDI multicast address prior to
transmitting the datagram.
An application can explicitly control multicast options with arguments to the setsockopt system call. The following options can be set by an application using the setsockopt system call:
The examples here illustrate how to use the setsockopt options that apply to IPv6 multicast datagrams only. |
The IPV6_MULTICAST_HOPS option to the setsockopt system call allows an application to specify a value between 0 and 255 for the hop limit field.
Multicast datagrams with a hop limit value of 0 restrict distribution of the multicast datagram to applications running on the local host. Multicast datagrams with a hop limit value of 1 are forwarded only to hosts on the local link. If a multicast datagram has a hop limit value greater than 1 and a multicast router is attached to the sending host's network, multicast datagrams can be forwarded beyond the local link. Multicast routers forward the datagram to known networks that have hosts belonging to the specified multicast group. The hop limit value is decremented by each multicast router in the path. When the hop limit value is decremented to 0, the datagram is not forwarded further.
The following example shows how to use the IPV6_MULTICAST_HOPS option to the setsockopt system call:
u_char hops; hops=2; if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hops, sizeof(hops)) < 0) perror("setsockopt: IPV6_MULTICAST_HOPS error"); |
A datagram addressed to an IPv6 multicast address is transmitted from the default network interface unless the application specifies that an alternate network interface is associated with the socket. The default interface is determined by the interface associated with the default route in the kernel routing table or by the interface associated with an explicit route, if one exists. Using the IPV6_MULTICAST_IF option to the setsockopt system call, an application can specify a network interface other than that specified by the route in the kernel routing table.
The following example shows how to use the IPV6_MULTICAST_IF option to the setsockopt system call to specify an interface other than the default:
u_int if_index = 1; . . . if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, &if_index, sizeof(if_index)) < 0) perror ("setsockopt: IPV6_MULTICAST_IF error"); else printf ("new interface set for sending multicast datagrams\n"); |
The if_index parameter specifies the interface index of the desired interface, or specifies 0 to select a default interface. You can use the if_nametoindex routine to find the interface index.
If a multicast datagram is sent to a group that has the sending node is a member, a copy of the datagram is, by default, looped back by the IP layer for local delivery. The IPV6_MULTICAST_LOOP option to the setsockopt system call allows an application to disable this loopback delivery.
The following example shows how to use the IPV6_MULTICAST_LOOP option to the setsockopt system call:
u_char loop=0; if (setsockopt( sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loop, sizeof(loop)) < 0) perror("setsockopt: IPV6_MULTICAST_LOOP error"); |
If the value of loop is 0, loopback is disabled; if
the value of loop is 1, loopback is enabled. For
performance reasons, you should disable the default, unless
applications on the same host must receive copies of the datagrams.
6.3.2 Receiving IPv6 Multicast Datagrams
Before a node can receive IPv6 multicast datagrams destined for a particular multicast group other than the All Nodes group, an application must direct the node to become a member of that multicast group.
This section describes how an application can direct a node to add itself to and remove itself from a multicast group.
An application can direct the node it is running on to join a multicast group by using the IPV6_JOIN_GROUP option to the setsockopt system call:
struct ipv6_mreq imr6; . . . imr6.ipv6mr_interface = if_index; if (setsockopt( sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char *)&imr6, sizeof(imr6)) < 0) perror("setsockopt: IPV6_JOIN_GROUP error"); |
The imr6 parameter has the following structure:
structipv6_mreq { struct in6_addr ipv6mr_multiaddr; /* IP multicast address of group */ unsigned int ipv6mr_interface; /* local interface index*/ }; |
Each multicast group membership is associated with a particular interface. It is possible to join the same group on multiple interfaces. The ipv6mr_interface variable can be specified with a value of 0, which allows an application to choose the default multicast interface. Alternatively, specifying one of the host's local interfaces allows an application to select a particular multicast-capable interface. The maximum number of memberships that can be added on a single socket is subject to the IPV6_MAX_MEMBERSHIPS value, which is defined in the <netinet/in.h> header file.
To drop membership from a particular multicast group, use the IPV6_LEAVE_GROUP option to the setsockopt system call:
struct ipv6_mreq imr6; if (setsockopt( sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, &imr6, sizeof(imr6)) < 0) perror("setsockopt: IPV6_LEAVE_GROUP error"); |
The imr6 parameter contains the same structure values used for adding membership.
If multiple sockets request that a node join a particular multicast group, the node remains a member of that multicast group until the last of those sockets is closed.
To receive multicast datagrams sent to a specific UDP port, the receiving socket must have bound to that port using the bind system call. More than one process can receive UDP datagrams destined for the same port if the bind system call is preceded by a setsockopt system call that specifies the SO_REUSEPORT option.
Delivery of IP multicast datagrams to SOCK_RAW sockets is determined by the protocol type of the destination.
Previous | Next | Contents |