Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What benefits/impact will IPv6 have on application development & design? [closed]

There has been a lot of press about IPv6 and the impending switch over to IPv6 from IPv4. I have some understanding of IPv6, but I've often wondered how much impact IPv6 has on application development & design (specifically)?

Are there some tangible/well known benefits IPv6 provides which we don't already have today?

I know Windows Vista and Server 2008 support IPv6 out-of-the-box, is anyone using (or designing with IPv6 in mind) today, and if so, what are the benefits? Should we be considering IPv6 in current and future projects?

Are there any good examples of IPv6-aware applications?

like image 474
RobS Avatar asked Dec 17 '22 10:12

RobS


1 Answers

Aaron's reply is, I'm afraid, pretty much incorrect. Yes, UI changes will be necessary, but any code using the traditional socket APIs is also likely to need substantial changes to support IPv6.

Most older code uses a specific "address family" constant (AF_INET) and a particular data structure (struct sockaddr_in). Any code still using that is effectively stuck in IPv4 land.

Newer code should use modern API calls such as getaddrinfo() which is capable of returning the right values for protocol, address family (i.e. AF_INET6), address, etc, regardless of whether the remote host uses IPv4 or IPv6 (or both).

It's a bit lengthy, but here's a code sample from the Linux man page for getaddrinfo. Note how the call gets a whole list of potential remote addresses, and tries each in turn until it succeeds:

         memset(&hints, 0, sizeof(struct addrinfo));
         hints.ai_family = AF_UNSPEC;    /* Allow IPv4 or IPv6 */
         hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
         hints.ai_flags = 0;
         hints.ai_protocol = 0;          /* Any protocol */

         s = getaddrinfo(hostname, service, &hints, &result);
         if (s != 0) {
             fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(s));
             exit(EXIT_FAILURE);
         }

         /* getaddrinfo() returns a list of address structures.
            Try each address until we successfully connect(2).
            If socket(2) (or connect(2)) fails, we (close the socket
            and) try the next address. */

         for (rp = result; rp != NULL; rp = rp->ai_next) {
             sfd = socket(rp->ai_family, rp->ai_socktype,
                          rp->ai_protocol);
             if (sfd == -1)
                 continue;

             if (connect(sfd, rp->ai_addr, rp->ai_addrlen) != -1)
                 break;                  /* Success */

             close(sfd);
         }

         if (rp == NULL) {               /* No address succeeded */
             fprintf(stderr, "Could not connect\n");
             exit(EXIT_FAILURE);
         }

         freeaddrinfo(result);           /* No longer needed */
like image 200
Alnitak Avatar answered Apr 28 '23 02:04

Alnitak