draft-ietf-ipngwg-rfc2553bis-06.txt   draft-ietf-ipngwg-rfc2553bis-07.txt 
IPNG Working Group R.E. Gilligan IPNG Working Group R.E. Gilligan
INTERNET-DRAFT: draft-ietf-ipngwg-rfc2553bis-06.txt Cache Flow INTERNET-DRAFT: draft-ietf-ipngwg-rfc2553bis-07.txt Cache Flow
Obsoletes RFC 2553 S. Thomson Obsoletes RFC 2553 S. Thomson
Cisco Cisco
J. Bound J. Bound
J. McCann J. McCann
Hewlett-Packard Hewlett-Packard
W. R. Stevens W. R. Stevens
September 2002
Basic Socket Interface Extensions for IPv6 Basic Socket Interface Extensions for IPv6
<draft-ietf-ipngwg-rfc2553bis-06.txt> <draft-ietf-ipngwg-rfc2553bis-07.txt>
Status of this Memo Status of this Memo
This document is an Internet-Draft and is in full conformance with This document is an Internet-Draft and is in full conformance with
all provisions of Section 10 of RFC2026. all provisions of Section 10 of RFC2026.
This document is a submission by the Internet Protocol IPv6 Working This document is a submission by the Internet Protocol IPv6 Working
Group of the Internet Engineering Task Force (IETF). Comments should Group of the Internet Engineering Task Force (IETF). Comments should
be submitted to the ipng@sunroof.eng.sun.com mailing list. be submitted to the ipng@sunroof.eng.sun.com mailing list.
skipping to change at page 7, line 31 skipping to change at page 7, line 31
The sin6_family field identifies this as a sockaddr_in6 structure. This The sin6_family field identifies this as a sockaddr_in6 structure. This
field overlays the sa_family field when the buffer is cast to a sockaddr field overlays the sa_family field when the buffer is cast to a sockaddr
data structure. The value of this field must be AF_INET6. data structure. The value of this field must be AF_INET6.
The sin6_port field contains the 16-bit UDP or TCP port number. This The sin6_port field contains the 16-bit UDP or TCP port number. This
field is used in the same way as the sin_port field of the sockaddr_in field is used in the same way as the sin_port field of the sockaddr_in
structure. The port number is stored in network byte order. structure. The port number is stored in network byte order.
The sin6_flowinfo field is a 32-bit field that contains two pieces of The sin6_flowinfo field is a 32-bit field that contains two pieces of
information: the traffic class and the flow label. The contents and information: the traffic class and the flow label. The contents and
interpretation of this member is specified in [1]. The sin6_flowinfo interpretation of this member is specified in [1].
field SHOULD be set to zero by an implementation prior to using the
sockaddr_in6 structure by an application on receive operations.
The sin6_addr field is a single in6_addr structure (defined in the The sin6_addr field is a single in6_addr structure (defined in the
previous section). This field holds one 128-bit IPv6 address. The previous section). This field holds one 128-bit IPv6 address. The
address is stored in network byte order. address is stored in network byte order.
The ordering of elements in this structure is specifically designed so The ordering of elements in this structure is specifically designed so
that when sin6_addr field is aligned on a 64-bit boundary, the start of that when sin6_addr field is aligned on a 64-bit boundary, the start of
the structure will also be aligned on a 64-bit boundary. This is done the structure will also be aligned on a 64-bit boundary. This is done
for optimum performance on 64-bit architectures. for optimum performance on 64-bit architectures.
skipping to change at page 12, line 54 skipping to change at page 12, line 52
/* follows explicit in the data structure */ /* follows explicit in the data structure */
int64_t __ss_align; /* field to force desired structure */ int64_t __ss_align; /* field to force desired structure */
/* storage alignment */ /* storage alignment */
char __ss_pad2[_SS_PAD2SIZE]; char __ss_pad2[_SS_PAD2SIZE];
/* 112 byte pad to achieve desired size, */ /* 112 byte pad to achieve desired size, */
/* _SS_MAXSIZE value minus size of ss_family */ /* _SS_MAXSIZE value minus size of ss_family */
/* __ss_pad1, __ss_align fields is 112 */ /* __ss_pad1, __ss_align fields is 112 */
}; };
The above example implementation illustrates a data structure which will The above example implementation illustrates a data structure which will
align on a 64-bit boundary. An implementation-specific field "_ss_align" align on a 64-bit boundary. An implementation-specific field
along with "_ss_pad1" is used to force a 64-bit alignment which covers "__ss_align" along with "__ss_pad1" is used to force a 64-bit alignment
proper alignment good enough for the needs of sockaddr_in6 (IPv6), which covers proper alignment good enough for the needs of sockaddr_in6
sockaddr_in (IPv4) address data structures. The size of padding field (IPv6), sockaddr_in (IPv4) address data structures. The size of padding
_ss_pad1 depends on the chosen alignment boundary. The size of padding field __ss_pad1 depends on the chosen alignment boundary. The size of
field _ss_pad2 depends on the value of overall size chosen for the total padding field __ss_pad2 depends on the value of overall size chosen for
size of the structure. This size and alignment are represented in the the total size of the structure. This size and alignment are represented
above example by implementation specific (not required) constants in the above example by implementation specific (not required) constants
_SS_MAXSIZE (chosen value 128) and _SS_ALIGNSIZE (with chosen value 8).
_SS_MAXSIZE (chosen value 128) and _SS_ALIGNMENT (with chosen value 8).
Constants _SS_PAD1SIZE (derived value 6) and _SS_PAD2SIZE (derived value Constants _SS_PAD1SIZE (derived value 6) and _SS_PAD2SIZE (derived value
112) are also for illustration and not required. The derived values 112) are also for illustration and not required. The derived values
assume sa_family_t is 2 bytes. The implementation specific definitions assume sa_family_t is 2 bytes. The implementation specific definitions
and structure field names above start with an underscore to denote and structure field names above start with an underscore to denote
implementation private namespace. Portable code is not expected to implementation private namespace. Portable code is not expected to
access or reference those fields or constants. access or reference those fields or constants.
On implementations where sockaddr data structure includes a "sa_len", On implementations where the sockaddr data structure includes a "sa_len"
field this data structure would look like this: field this data structure would look like this:
/* /*
* Definitions used for sockaddr_storage structure paddings design. * Definitions used for sockaddr_storage structure paddings design.
*/ */
#define _SS_PAD1SIZE (_SS_ALIGNSIZE - #define _SS_PAD1SIZE (_SS_ALIGNSIZE -
(sizeof (uint8_t) + sizeof (sa_family_t)) (sizeof (uint8_t) + sizeof (sa_family_t))
#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (sa_family_t)+ #define _SS_PAD2SIZE (_SS_MAXSIZE -
(sizeof (uint8_t) + sizeof (sa_family_t) +
_SS_PAD1SIZE + _SS_ALIGNSIZE)) _SS_PAD1SIZE + _SS_ALIGNSIZE))
struct sockaddr_storage { struct sockaddr_storage {
uint8_t ss_len; /* address length */ uint8_t ss_len; /* address length */
sa_family_t ss_family; /* address family */ sa_family_t ss_family; /* address family */
/* Following fields are implementation specific */ /* Following fields are implementation specific */
char __ss_pad1[_SS_PAD1SIZE]; char __ss_pad1[_SS_PAD1SIZE];
/* 6 byte pad, this is to make implementation /* 6 byte pad, this is to make implementation
/* specific pad up to alignment field that */ /* specific pad up to alignment field that */
/* follows explicit in the data structure */ /* follows explicit in the data structure */
int64_t __ss_align; /* field to force desired structure */ int64_t __ss_align; /* field to force desired structure */
skipping to change at page 15, line 26 skipping to change at page 15, line 25
if_nameindex(). if_nameindex().
#include <net/if.h> #include <net/if.h>
void if_freenameindex(struct if_nameindex *ptr); void if_freenameindex(struct if_nameindex *ptr);
The ptr argument shall be a pointer that was returned by if_nameindex(). The ptr argument shall be a pointer that was returned by if_nameindex().
After if_freenameindex() has been called, the application shall not use After if_freenameindex() has been called, the application shall not use
the array of which ptr is the address. the array of which ptr is the address.
Currently net/if.h doesn't have prototype definitions for functions and
it is recommended that these definitions be defined in net/if.h as well
as the struct if_nameindex{}.
5. Socket Options 5. Socket Options
A number of new socket options are defined for IPv6. All of these new A number of new socket options are defined for IPv6. All of these new
options are at the IPPROTO_IPV6 level. That is, the "level" parameter options are at the IPPROTO_IPV6 level. That is, the "level" parameter
in the getsockopt() and setsockopt() calls is IPPROTO_IPV6 when using in the getsockopt() and setsockopt() calls is IPPROTO_IPV6 when using
these options. The constant name prefix IPV6_ is used in all of the new these options. The constant name prefix IPV6_ is used in all of the new
socket options. This serves to clearly identify these options as socket options. This serves to clearly identify these options as
applying to IPv6. applying to IPv6.
The declaration for IPPROTO_IPV6, the new IPv6 socket options, and The declaration for IPPROTO_IPV6, the new IPv6 socket options, and
skipping to change at page 18, line 28 skipping to change at page 18, line 25
option. By default this option is turned off. option. By default this option is turned off.
Here is an example of setting this option: Here is an example of setting this option:
int on = 1; int on = 1;
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
(char *)&on, sizeof(on)) == -1) (char *)&on, sizeof(on)) == -1)
perror("setsockopt IPV6_V6ONLY"); perror("setsockopt IPV6_V6ONLY");
else else
printf("IPV6_V6ONLY set0); printf("IPV6_V6ONLY set\n");
Note - This option has no effect on the use of IPv4 Mapped addresses Note - This option has no effect on the use of IPv4 Mapped addresses
which enter a node as a valid IPv6 addresses for IPv6 communications as which enter a node as a valid IPv6 addresses for IPv6 communications as
defined by Stateless IP/ICMP Translation Algorithm (SIIT) [5]. defined by Stateless IP/ICMP Translation Algorithm (SIIT) [5].
An example use of this option is to allow two versions of the same An example use of this option is to allow two versions of the same
server process to run on the same port, one providing service over IPv6, server process to run on the same port, one providing service over IPv6,
the other providing the same service over IPv4. the other providing the same service over IPv4.
6. Library Functions 6. Library Functions
skipping to change at page 19, line 55 skipping to change at page 19, line 50
as valid within multiple supported families, the implementation will as valid within multiple supported families, the implementation will
attempt to resolve the name in all supported families and, in absence attempt to resolve the name in all supported families and, in absence
of errors, one or more results shall be returned. of errors, one or more results shall be returned.
If the nodename argument is not null, it can be a descriptive name or If the nodename argument is not null, it can be a descriptive name or
can be an address string. If the specified address family is AF_INET, can be an address string. If the specified address family is AF_INET,
AF_INET6, or AF_UNSPEC, valid descriptive names include host names. AF_INET6, or AF_UNSPEC, valid descriptive names include host names.
If the specified address family is AF_INET or AF_UNSPEC, address If the specified address family is AF_INET or AF_UNSPEC, address
strings using Internet standard dot notation as specified in strings using Internet standard dot notation as specified in
inet_addr() are valid. If the specified address family is AF_INET6 inet_addr() are valid. If the specified address family is AF_INET6
or AF_UNSPEC, standard IPv6 text forms described in inet_ntop() are or AF_UNSPEC, standard IPv6 text forms described in inet_pton() are
valid. valid.
If nodename is not null, the requested service location is named by If nodename is not null, the requested service location is named by
nodename; otherwise, the requested service location is local to the nodename; otherwise, the requested service location is local to the
caller. caller.
If servname is null, the call shall return network-level addresses If servname is null, the call shall return network-level addresses
for the specified nodename. If servname is not null, it is a null- for the specified nodename. If servname is not null, it is a null-
terminated character string identifying the requested service. This terminated character string identifying the requested service. This
can be either a descriptive name or a numeric representation suitable can be either a descriptive name or a numeric representation suitable
skipping to change at page 22, line 17 skipping to change at page 22, line 10
be used with the specified nodename and/or servname. Otherwise, be used with the specified nodename and/or servname. Otherwise,
addresses shall be returned for use only with the specified address addresses shall be returned for use only with the specified address
family. If ai_family is not AF_UNSPEC and ai_protocol is not zero, family. If ai_family is not AF_UNSPEC and ai_protocol is not zero,
then addresses are returned for use only with the specified address then addresses are returned for use only with the specified address
family and protocol; the value of ai_protocol shall be interpreted as family and protocol; the value of ai_protocol shall be interpreted as
in a call to the socket() function with the corresponding values of in a call to the socket() function with the corresponding values of
ai_family and ai_protocol . ai_family and ai_protocol .
The freeaddrinfo() function frees one or more addrinfo structures The freeaddrinfo() function frees one or more addrinfo structures
returned by getaddrinfo(), along with any additional storage returned by getaddrinfo(), along with any additional storage
associated with those structures. If the ai_next field of the associated with those structures (for example, storage pointed to by
structure is not null, the entire list of structures is freed. The the ai_canonname and ai_addr fields; an application must not
freeaddrinfo() function must support the freeing of arbitrary reference this storage after the associated addrinfo structure has
sublists of an addrinfo list originally returned by getaddrinfo(). been freed). If the ai_next field of the structure is not null, the
entire list of structures is freed. The freeaddrinfo() function must
support the freeing of arbitrary sublists of an addrinfo list
originally returned by getaddrinfo().
Functions getaddrinfo() and freeaddrinfo() must be thread-safe. Functions getaddrinfo() and freeaddrinfo() must be thread-safe.
A zero return value for getaddrinfo() indicates successful A zero return value for getaddrinfo() indicates successful
completion; a non-zero return value indicates failure. The possible completion; a non-zero return value indicates failure. The possible
values for the failures are listed below under Error Return Values. values for the failures are listed below under Error Return Values.
Upon successful return of getaddrinfo(), the location to which res Upon successful return of getaddrinfo(), the location to which res
points shall refer to a linked list of addrinfo structures, each of points shall refer to a linked list of addrinfo structures, each of
which shall specify a socket address and information for use in which shall specify a socket address and information for use in
skipping to change at page 29, line 31 skipping to change at page 29, line 31
4. Added IPV6_V6ONLY IP level socket option to permit nodes 4. Added IPV6_V6ONLY IP level socket option to permit nodes
to not process IPv4 packets as IPv4 Mapped addresses to not process IPv4 packets as IPv4 Mapped addresses
in implementations. in implementations.
5. Added SIIT to references and added new contributors. 5. Added SIIT to references and added new contributors.
Acknowledgments Acknowledgments
This specification's evolution and completeness were significantly This specification's evolution and completeness were significantly
influenced by the efforts of Richard Stevens, who has passed on. Rich's influenced by the efforts of Richard Stevens, who has passed on.
wisdom and talent made the specification what it is today. The co- Richard's wisdom and talent made the specification what it is today.
authors will long think of Richard with great respect. The co-authors will long think of Richard with great respect.
Thanks to the many people who made suggestions and provided feedback to Thanks to the many people who made suggestions and provided feedback to
this document, including: this document, including:
Werner Almesberger, Ran Atkinson, Fred Baker, Dave Borman, Andrew Werner Almesberger, Ran Atkinson, Fred Baker, Dave Borman, Andrew
Cherenson, Alex Conta, Alan Cox, Steve Deering, Richard Draves, Francis Cherenson, Alex Conta, Alan Cox, Steve Deering, Richard Draves, Francis
Dupont, Robert Elz, Brian Haberman, Jun-ichiro itojun Hagino, Marc Dupont, Robert Elz, Brian Haberman, Jun-ichiro itojun Hagino, Marc
Hasson, Tom Herbert, Bob Hinden, Wan-Yen Hsu, Christian Huitema, Koji Hasson, Tom Herbert, Bob Hinden, Wan-Yen Hsu, Christian Huitema, Koji
Imada, Markus Jork, Ron Lee, Alan Lloyd, Charles Lynn, Dan McDonald, Imada, Markus Jork, Ron Lee, Alan Lloyd, Charles Lynn, Dan McDonald,
Dave Mitton, Finnbarr Murphy, Thomas Narten, Josh Osborne, Craig Dave Mitton, Finnbarr Murphy, Thomas Narten, Josh Osborne, Craig
 End of changes. 13 change blocks. 
30 lines changed or deleted 30 lines changed or added

This html diff was produced by rfcdiff 1.33. The latest version is available from http://tools.ietf.org/tools/rfcdiff/