HPlogo HP-UX IPv6 Porting Guide: HP-UX 11i v2 September 2004 > Chapter 5 Overview of IPv4 and IPv6 Call Set-up

Using AF_INET6 Socket to Receive IPv4 Communications

» 

Technical documentation

Complete book in PDF

 » Table of Contents

An IPv6 application using an AF_INET6 socket can accept TCP connection requests from a remote IPv4 application. The example below is contrived to demonstrate an incoming IPv4 packet destined for an application’s IPv6 socket.

In this overview diagram, an incoming IPv4 packet requests connection to an IPv6 socket. IPv6 internally creates an IPv4-mapped IPv6 address and accepts the connection.

Figure 5-3 Title not available (Using AF_INET6 Socket to Receive IPv4 Communications)

  1. An IPv4 packet arrives at an Ethernet port.

  2. The Ethernet driver examines the type field in the Ethernet packet.

    86DD type is an IPv6 packet

    0800 type is an IPv4 packet

    Here type is 0800, so the Ethernet driver strips-off the Ethernet header and passes the IPv4 packet to the IPv4/IP module.

    The IPv4/IP protocol stack passes the information and the IPv4-mapped IPv6 address (::FFFF:1.2.3.4) to the socket layer.

  3. The application calls accept() to accept the remote connection request. The application was already listening on an established IPv6 socket.

  4. The application calls getnameinfo() to lookup the host name for IP address ::FFFF:1.2.3.4. See getnameinfo(3N) later in the guide for more information.

  5. The search finds the host name for the 1.2.3.4 address in the hosts database and getnameinfo() returns the host name.

    NOTE: In the case where getnameinfo() cannot locate the node name corresponding to an IPv4 address, getnameinfo() returns the numeric form of the IPv4-mapped IPv6 address instead of the node name. Displaying the IPv4-mapped IPv6 address may cause compatibility issues for certain applications. In this case, HP recommends a pure IPv4 address is displayed.
© 2004 Hewlett-Packard Development Company, L.P.