Compatibility of Low-Level Socket APIs with Mapped IPv6 Addresses

I am currently working on an application that communicates with an IPv4 node in an IPv6-only network. During DNS resolution for the server node on JIO and T-Mobile networks, I am receiving IPv4 and mapped IPv6 addresses.

In my application, I am using these mapped IPv6 addresses in two different contexts:

  1. For high-level API calls on the app side, I am using URLSession API (in either Objective-C or Swift).
  2. For another target(c/c++), I am making low-level socket API calls(bind etc). These calls use the address passed from the app layer.

As node is resolved to IPV4 and mapped IPv6 addresses

My question is: Are low-level Socket APIs(bind etc) compatible with these mapped IPv6 addresses (example 64:ff9b::103.135.122.10)?

Mapped IPv6 with Well know perfix(64:ff9b)

Please provide the document/rfc reference for the same.

Any guidance or resources on this topic would be greatly appreciated.

You’re using the sytem’s DNS resolver, right?

During DNS resolution for the server node on JIO and T-Mobile networks, I am receiving IPv4 and mapped IPv6 addresses.

The resolve-then-connect approach is suboptimal on Apple platforms. In general, I recommend that you use a connect-by-name API. I put a bunch of info about this in TN3151 Choosing the right networking API.

For high-level API calls on the app side, I am using URLSession API (in either Objective-C or Swift).

You’re passing IP addresses to URLSession? Why not pass the DNS name in directly?

For another target (c/c++), I am making low-level socket API calls (bind etc). These calls use the address passed from the app layer.

Using the resolve-then-connect approach is your only option with BSD Sockets, but to work in all situations your sockets code must implement Happy Eyeballs. Again, TN3151 talks more about this.

Are low-level Socket APIs (bind etc) compatible with these mapped IPv6 addresses (example 64:ff9b::103.135.122.10)?

Yes.

Although, questions like this are irrelevant once you implement Happy Eyeballs, because if a specific address fails you’ll fall back to one that works.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi @eskimo ,

My concern is the compatibility of low-level socket APIs with IPv4-mapped IPv6 addresses. Specifically, I'm interested in whether functions like bind, accept, and connect can seamlessly work with a mapped IPv6 address like 64:ff9b::103.135.122.10. I've consulted the following thread for reference and it is stated:

We do not support under-the-sockets bump-in-API (RFC 3338) and we do not support 464XLAT...

https://developer.apple.com/forums/thread/5643.

Things might move faster if you answer my specific questions, including:

You’re using the sytem’s DNS resolver, right?

and:

You’re passing IP addresses to URLSession? Why not pass the DNS name in directly?


You wrote:

I've consulted the following thread for reference and it is stated:

That thread is 8 years old, so you should be cautious about drawing conclusions from it.

There’s a difference between “supports IPv4-mapped IPv6 addresses” and “supports 464XLAT”. Apple platforms support IPv4-mapping IPv6 addresses just fine, and that support is used regularly on DNS64/NAT64 networks. See the various resources linked to by Supporting IPv6-only Networks.

If you explain more about the background for your questions, I may be able to offer more concrete advice.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Compatibility of Low-Level Socket APIs with Mapped IPv6 Addresses
 
 
Q