ipv6 revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterCopyright (C) 2000, 2001, 2004, 2016 Internet Systems Consortium, Inc. ("ISC")
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterThis Source Code Form is subject to the terms of the Mozilla Public
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterLicense, v. 2.0. If a copy of the MPL was not distributed with this
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterfile, You can obtain one at http://mozilla.org/MPL/2.0/.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterCurrently, there are multiple interesting problems with ipv6
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimplementations on various platforms. These problems range from not
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterbeing able to use ipv6 with bind9 (or in particular the ISC socket
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterlibrary, contained in libisc) to listen-on lists not being respected,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterto strange warnings but seemingly correct behavior of named.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterCOMPILE-TIME ISSUES
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster-------------------
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterThe socket library requires a certain level of support from the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteroperating system. In particular, it must follow the advanced ipv6
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostersocket API to be usable. The systems which do not follow this will
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostercurrently not get any warnings or errors, but ipv6 will simply not
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterfunction on them.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterThese systems currently include, but are not limited to:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster AIX 3.4 (with ipv6 patches)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
416e6233d8b831f113740660ed8857282a289cd8Craig McDonnellRUN-TIME ISSUES
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster---------------
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterIn the original drafts of the ipv6 RFC documents, binding an ipv6
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostersocket to the ipv6 wildcard address would also cause the socket to
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunaaccept ipv4 connections and datagrams. When an ipv4 packet is
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunareceived on these systems, it is mapped into an ipv6 address. For
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunaexample, 1.2.3.4 would be mapped into ::ffff:1.2.3.4. The intent of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterthis mapping was to make transition from an ipv4-only application into
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunaipv6 easier, by only requiring one socket to be open on a given port.
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid LunaLater, it was discovered that this was generally a bad idea. For one,
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunamany firewalls will block connection to 1.2.3.4, but will let through
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna::ffff:1.2.3.4. This, of course, is bad. Also, access control lists
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunawritten to accept only ipv4 addresses were suddenly ignored unless
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterthey were rewritten to handle the ipv6 mapped addresses as well.
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterPartly because of these problems, the latest IPv6 API introduces an
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunaexplicit knob (the "IPV6_V6ONLY" socket option ) to turn off the ipv6
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunamapped address usage.
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterIn bind9, we first check if both the advanced API and the IPV6_V6ONLY
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostersocket option are available. If both of them are available, bind9
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosternamed will bind to the ipv6 wildcard port for both TCP and UDP.
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid LunaOtherwise named will make a warning and try to bind to all available
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteripv6 addresses separately.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterIn any case, bind9 named binds to specific addresses for ipv4 sockets.
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterThe followings are historical notes when we always bound to the ipv6
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterwildcard port regardless of the availability of the API support.
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterThese problems should not happen with the closer checks above.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterIPV6 Sockets Accept IPV4, Specific IPV4 Addresses Bindings Fail
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster---------------------------------------------------------------
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid LunaThe only OS which seems to do this is (some kernel versions of) linux.
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterIf an ipv6 socket is bound to the ipv6 wildcard socket, and a specific
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteripv4 socket is later bound (say, to 1.2.3.4 port 53) the ipv4 binding
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterwill fail.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterWhat this means to bind9 is that the application will log warnings
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterabout being unable to bind to a socket because the address is already
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterin use. Since the ipv6 socket will accept ipv4 packets and map them,
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunahowever, the ipv4 addresses continue to function.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterThe effect is that the config file listen-on directive will not be
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterrespected on these systems.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid LunaIPV6 Sockets Accept IPV4, Specific IPV4 Address Bindings Succeed
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster----------------------------------------------------------------
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterIn this case, the system allows opening an ipv6 wildcard address
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunasocket and then binding to a more specific ipv4 address later. An
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterexample of this type of system is Digital Unix with ipv6 patches
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunaapplied.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid LunaWhat this means to bind9 is that the application will respect
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterlisten-on in regards to ipv4 sockets, but it will use mapped ipv6
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteraddresses for any that do not match the listen-on list. This, in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fostereffect, makes listen-on useless for these machines as well.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid LunaIPV6 Sockets Do Not Accept IPV4
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster-------------------------------
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
8af80418ba1ec431c8027fa9668e5678658d3611Allan FosterOn these systems, opening an IPV6 socket does not implicitly open any
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteripv4 sockets. An example of these systems are NetBSD-current with the
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Lunalatest KAME patch, and other systems which use the latest KAME patches
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteras their ipv6 implementation.
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid LunaOn these systems, listen-on is fully functional, as the ipv6 socket
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosteronly accepts ipv6 packets, and the ipv4 sockets will handle the ipv4
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpackets.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid LunaRELEVANT RFCs
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna-------------
36cbb7068270473f5d3d29304ccb2a0a1453667fDavid Luna
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster3513: Internet Protocol Version 6 (IPv6) Addressing Architecture
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster3493: Basic Socket Interface Extensions for IPv6
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster3542: Advanced Sockets Application Program Interface (API) for IPv6
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster$Id: ipv6,v 1.9 2004/08/10 04:27:51 jinmei Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster