user123003
user123003

Reputation:

How to determine if a user's router/ISP doesn't support IPv6 connections?

I'm using BSD sockets, and while I imagine it's easy to determine if a user's OS supports IPv6 (by trying to make a socket with AF_INET6), I'm not sure how to programmatically determine if their router or ISP doesn't support such a connection. Will the connection simply fail, and if so, how do I distinguish that failure from a server simply being offline?

Upvotes: 1

Views: 915

Answers (4)

Hasturkun
Hasturkun

Reputation: 36402

As Ulrich Drepper says in his Userlevel IPv6 Programming Introduction, you should call getaddrinfo with the AI_ADDRCONFIG flag set (which ensures you will only get address types currently configured on the system), then try each result in order until one succeeds (as the results are sorted, with the first most likely to succeed, and so forth) or all fail.

Upvotes: 1

Seth Robertson
Seth Robertson

Reputation: 31451

Most people with publicly routable addresses configured (not fe80::/10 fc00::/7 and friends) and a ipv6 default route would be expected to be connected.

However, normally you shouldn't care whether the problem is because the server is unreachable in one particular way compared to being unreachable for some other reason.

Upvotes: 0

dolphy
dolphy

Reputation: 6498

This post has a lot of good information on the subject, and specifically talks about getaddrinfo providing information like this.

Upvotes: 1

unwind
unwind

Reputation: 399803

One idea would be to include multiple test servers, of as high "quality" as imaginable. I think Google are reachable over IPv6 for instance, and they tend to keep their things running. Add 4-5 more, and you should have a pretty low probability of them all being down at the same time.

Upvotes: 0

Related Questions