Winsock - Bind IPv6 client socket to non-private\temporary IP address?

Dylan Taft 0 Reputation points
2023-10-15T06:08:43.6966667+00:00

Bit of a stretch, does Microsoft support https://datatracker.ietf.org/doc/html/rfc5014
RFC 5014
With windows socket programming?

So, SLAAC configured devices will end up with a "public" IP and several temporary "privacy" ip addresses. By default, outbound connections are made bound to the temporary IPs - ie for web browsing - those IPs expire frequently.

What if you want to bind to the public IP, as is would be useful in a p2p application?

Do I have to resort to WMI\CIM to query something like MSFT_NetRoutefor the default route, and their IP addresses and expiration times, or an API call like GetBestRoute, GetAdaptersAddresses?

RFC 5014 solves for it cleanest with setsockopt() on other OSes that support it, you just set an option that the app prefers to use the public address.

I don't see IPV6_PREFER_SRC_PUBLIC listed here
https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,764 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.